Add packelf-appimage-copylibs.sh

This commit is contained in:
q3aql 2024-07-16 05:01:15 +02:00
parent ac86389aaf
commit 0ec31aea91

22
packelf-appimage-copylibs.sh Executable file
View File

@ -0,0 +1,22 @@
#!/usr/bin/env sh
# Author: q3aql@duck.com
# Pack elf binary and it's dependencies into standalone executable using appimagetool
# License: GPLv2.0
# Require: https://github.com/AppImage/appimagetool/releases
if [ -z "${1}" ] ; then
echo "$0 <ELF_SRC_PATH> <PATH_TO_COPY_LIBRARIES>"
exit 0
else
if [ -z "${2}" ] ; then
echo "$0 <ELF_SRC_PATH> <PATH_TO_COPY_LIBRARIES>"
exit 0
else
libs="$(ldd "${1}" | grep -F '/' | sed -E 's|[^/]*/([^ ]+).*?|/\1|')"
for library in ${libs} ; do
cp -L ${library} ${2}
echo "Copied ${library} to ${2}"
done
fi
fi