PortableLinuxGames/findMissingLibraries

51 lines
977 B
Plaintext
Raw Permalink Normal View History

2013-11-25 15:44:38 -08:00
#!/bin/bash
# Author : Ismael Barros² <ismael@barros2.org>
# License : BSD http://en.wikipedia.org/wiki/BSD_license
2013-11-19 13:15:10 -08:00
2013-11-25 15:44:38 -08:00
# This script is meant to be run inside an AppDir.
# It will try to run the AppRun script with strace,
# and detect which libraries are loaded in runtime.
2014-01-16 14:18:18 -08:00
pg4l_dir=$(dirname $(readlink -f $0))
. "$pg4l_dir/util.sh"
2013-11-25 15:44:38 -08:00
opt_copy=
2013-11-26 22:49:32 -08:00
bin=./AppRun
2013-11-25 15:44:38 -08:00
while getopts "c" arg; do
case $arg in
c)
opt_copy=1
2013-11-26 22:49:32 -08:00
shift $((OPTIND-1))
2013-11-25 15:44:38 -08:00
;;
esac
done
2014-07-31 09:43:51 -07:00
bin="./AppRun"
args=
if [ -n "$1" ]; then
bin="$1"
shift
args=$@
fi
2013-11-26 22:49:32 -08:00
bin="$(readlink -f "$bin")"
2013-11-25 15:44:38 -08:00
process() {
while read -r line; do
file=$(basename "$line")
if [ -f "usr/lib/$file" ]; then
2014-01-16 14:18:18 -08:00
echo -e "[${GOOD} existing ${NORMAL}]" $file
2013-11-25 15:44:38 -08:00
else
2014-01-16 14:18:18 -08:00
echo -e "[${BAD} missing ${NORMAL}]" $file
2013-11-25 15:44:38 -08:00
if [ "$opt_copy" ]; then
cp -v "$line" "usr/lib/"
fi
fi
done
}
2013-11-26 22:49:32 -08:00
export APPRUN_HELPERS="strace"
2014-07-31 09:43:51 -07:00
"$bin" $args | egrep "open\(" | egrep -v ENOENT | egrep -v EACCESS | egrep -o "/usr/.*\\.so[^\"]*" | process