diff --git a/appdwarf b/appdwarf index c32005c..24f3f8a 100755 --- a/appdwarf +++ b/appdwarf @@ -14,6 +14,7 @@ header() { export APPDIR APPIMAGE="$(realpath "$0")" ARGV0="$0" OWD="$PWD" args="-o offset=auto -o tidy_strategy=swap -o workers=4" [ ! -d "$APPDIR" ] && mkdir "$APPDIR" && dwarfs $args "$0" "$APPDIR" 2>/dev/null + trap 'fusermount -quz $APPDIR' 0 1 2 3 6 14 15 EXIT "$APPDIR/AppRun" "$@" res=$? fusermount -quz "$APPDIR" @@ -46,7 +47,7 @@ zzexe_header() { awk 'f;/^exit \$res$/{f=1}' "$0" | head -c-1 | zstd -cd > "$out" chmod +x "$out" ln -s "$out" "$dir" - trap : 0 1 2 3 6 14 15 + trap 'rm "$out" "$dir/$(basename "$out")"' 0 1 2 3 6 14 15 EXIT "$dir/$(basename "$out")" "$@" res=$? rm "$out" "$dir/$(basename "$out")" @@ -76,7 +77,7 @@ case "$1" in shift zzexe "$@" ;; --version | -v ) - tput setaf 2; echo appdwarf 2022.09.09 + tput setaf 2; echo appdwarf 2022.10.10 tput setaf 6; echo Built by July 🏳️‍🌈; exit ;; -* | '' ) echo "Usage: appdwarf [option] [APP/FILE/FOLDER/URL] [compression options]" @@ -142,5 +143,5 @@ head="$(mktemp)" printfunc header > "$head" mkdwarfs -o "$(realpath "$1").sh" -B5 --header "$head" -i "$@" -rm "$head" +rm -rf "$head" "$1" chmod +x "$(realpath "$1").sh"