Compatible with POSIX Standard

This commit is contained in:
q3aql 2024-07-16 05:00:58 +02:00
parent cc0941a0d7
commit ac86389aaf

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env sh
# Author: q3aql@duck.com # Author: q3aql@duck.com
# Pack elf binary and it's dependencies into standalone executable using appimagetool # 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 "Terminal=false" >> ${desktop_file_path}/${desktop_file_name}.desktop
echo "Categories=System;" >> ${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 echo "StartupWMClass=mpv" >> ${desktop_file_path}/${desktop_file_name}.desktop
# Create icon for desktop file echo 'pngfile' > ${desktop_file_path}/${desktop_file_name}.png
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
} }
# Check if file exist # Check if file exist
@ -91,8 +80,8 @@ else
temp_dir=$(mktemp -d) temp_dir=$(mktemp -d)
echo "Creating static binary ${2} from ${1}" echo "Creating static binary ${2} from ${1}"
cp -L ${1} ${temp_dir}/ cp -L ${1} ${temp_dir}/
echo "Linking libraries ${libraries}"
for libraries in ${libs} ; do for libraries in ${libs} ; do
echo "Linking library ${libraries}"
cp -L ${libraries} ${temp_dir}/ cp -L ${libraries} ${temp_dir}/
done done
echo "Creating executable linker" echo "Creating executable linker"
@ -102,7 +91,7 @@ else
create_desktop_file "${temp_dir}" "${program}" create_desktop_file "${temp_dir}" "${program}"
chmod 777 -R "${temp_dir}" chmod 777 -R "${temp_dir}"
echo "Building static binary in ${2}" 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} rm -rf ${temp_dir}
if [ -f "${2}" ] ; then if [ -f "${2}" ] ; then
echo "Created successfully" echo "Created successfully"