Compare commits
2 Commits
cc0941a0d7
...
0ec31aea91
Author | SHA1 | Date | |
---|---|---|---|
0ec31aea91 | |||
ac86389aaf |
22
packelf-appimage-copylibs.sh
Executable file
22
packelf-appimage-copylibs.sh
Executable 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
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/bash
|
||||
#!/usr/bin/env sh
|
||||
|
||||
# Author: q3aql@duck.com
|
||||
# Pack elf binary and it's dependencies into standalone executable using appimagetool
|
||||
|
@ -49,18 +49,7 @@ create_desktop_file() {
|
|||
echo "Terminal=false" >> ${desktop_file_path}/${desktop_file_name}.desktop
|
||||
echo "Categories=System;" >> ${desktop_file_path}/${desktop_file_name}.desktop
|
||||
echo "StartupWMClass=mpv" >> ${desktop_file_path}/${desktop_file_name}.desktop
|
||||
# Create icon for desktop file
|
||||
echo '<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" version="1">' > ${desktop_file_path}/${desktop_file_name}.svg
|
||||
echo ' <rect style="opacity:0.2" width="40" height="40" x="4" y="5" rx="12" ry="12"/>' >> ${desktop_file_path}/${desktop_file_name}.svg
|
||||
echo ' <rect style="fill:#e4e4e4" width="40" height="40" x="4" y="4" rx="12" ry="12"/>' >> ${desktop_file_path}/${desktop_file_name}.svg
|
||||
echo ' <path style="opacity:0.2;fill:#ffffff" d="M 16,4 C 9.352,4 4,9.352 4,16 v 1 C 4,10.352 9.352,5 16,5 h 16 c 6.648,0 12,5.352 12,12 V 16 C 44,9.352 38.648,4 32,4 Z"/>' >> ${desktop_file_path}/${desktop_file_name}.svg
|
||||
echo ' <path style="fill:#3084e9" d="M 17 12 A 5 5 0 0 0 12 17 A 5 5 0 0 0 17 22 L 31 22 L 31 12 L 17 12 z"/>' >> ${desktop_file_path}/${desktop_file_name}.svg
|
||||
echo ' <path style="fill:#aeaeae" d="M 17 26 L 17 36 L 31 36 A 5 5 0 0 0 36 31 A 5 5 0 0 0 31 26 L 17 26 z"/>' >> ${desktop_file_path}/${desktop_file_name}.svg
|
||||
echo ' <path style="opacity:0.1" d="M 17 12 A 5 5 0 0 0 12 17 A 5 5 0 0 0 12.027344 17.515625 A 5 5 0 0 1 17 13 L 31 13 L 31 12 L 17 12 z M 17 26 L 17 27 L 31 27 A 5 5 0 0 1 35.972656 31.484375 A 5 5 0 0 0 36 31 A 5 5 0 0 0 31 26 L 17 26 z"/>' >> ${desktop_file_path}/${desktop_file_name}.svg
|
||||
echo ' <path style="opacity:0.2" d="M 31 13 A 5 5 0 0 0 26 18 A 5 5 0 0 0 31 23 A 5 5 0 0 0 36 18 A 5 5 0 0 0 31 13 z M 17 27 A 5 5 0 0 0 12 32 A 5 5 0 0 0 17 37 A 5 5 0 0 0 22 32 A 5 5 0 0 0 17 27 z"/>' >> ${desktop_file_path}/${desktop_file_name}.svg
|
||||
echo ' <circle style="fill:#ffffff" cx="31" cy="17" r="5"/>' >> ${desktop_file_path}/${desktop_file_name}.svg
|
||||
echo ' <circle style="fill:#ffffff" cx="17" cy="31" r="5"/>' >> ${desktop_file_path}/${desktop_file_name}.svg
|
||||
echo '</svg>' >> ${desktop_file_path}/${desktop_file_name}.svg
|
||||
echo 'pngfile' > ${desktop_file_path}/${desktop_file_name}.png
|
||||
}
|
||||
|
||||
# Check if file exist
|
||||
|
@ -91,8 +80,8 @@ else
|
|||
temp_dir=$(mktemp -d)
|
||||
echo "Creating static binary ${2} from ${1}"
|
||||
cp -L ${1} ${temp_dir}/
|
||||
echo "Linking libraries ${libraries}"
|
||||
for libraries in ${libs} ; do
|
||||
echo "Linking library ${libraries}"
|
||||
cp -L ${libraries} ${temp_dir}/
|
||||
done
|
||||
echo "Creating executable linker"
|
||||
|
@ -102,7 +91,7 @@ else
|
|||
create_desktop_file "${temp_dir}" "${program}"
|
||||
chmod 777 -R "${temp_dir}"
|
||||
echo "Building static binary in ${2}"
|
||||
appimagetool ${temp_dir} "${2}" &> /dev/null
|
||||
appimagetool ${temp_dir} "${2}" > /dev/null 2> /dev/null
|
||||
rm -rf ${temp_dir}
|
||||
if [ -f "${2}" ] ; then
|
||||
echo "Created successfully"
|
||||
|
|
Loading…
Reference in New Issue
Block a user