mirror of
https://github.com/Phantop/appdwarf.git
synced 2025-01-09 13:47:08 +00:00
appdwarf: improve trap unmount and remove appdir
This commit is contained in:
parent
e8fd79baf5
commit
da26521b63
7
appdwarf
7
appdwarf
|
@ -14,6 +14,7 @@ header() {
|
||||||
export APPDIR APPIMAGE="$(realpath "$0")" ARGV0="$0" OWD="$PWD"
|
export APPDIR APPIMAGE="$(realpath "$0")" ARGV0="$0" OWD="$PWD"
|
||||||
args="-o offset=auto -o tidy_strategy=swap -o workers=4"
|
args="-o offset=auto -o tidy_strategy=swap -o workers=4"
|
||||||
[ ! -d "$APPDIR" ] && mkdir "$APPDIR" && dwarfs $args "$0" "$APPDIR" 2>/dev/null
|
[ ! -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" "$@"
|
"$APPDIR/AppRun" "$@"
|
||||||
res=$?
|
res=$?
|
||||||
fusermount -quz "$APPDIR"
|
fusermount -quz "$APPDIR"
|
||||||
|
@ -46,7 +47,7 @@ zzexe_header() {
|
||||||
awk 'f;/^exit \$res$/{f=1}' "$0" | head -c-1 | zstd -cd > "$out"
|
awk 'f;/^exit \$res$/{f=1}' "$0" | head -c-1 | zstd -cd > "$out"
|
||||||
chmod +x "$out"
|
chmod +x "$out"
|
||||||
ln -s "$out" "$dir"
|
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")" "$@"
|
"$dir/$(basename "$out")" "$@"
|
||||||
res=$?
|
res=$?
|
||||||
rm "$out" "$dir/$(basename "$out")"
|
rm "$out" "$dir/$(basename "$out")"
|
||||||
|
@ -76,7 +77,7 @@ case "$1" in
|
||||||
shift
|
shift
|
||||||
zzexe "$@" ;;
|
zzexe "$@" ;;
|
||||||
--version | -v )
|
--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 ;;
|
tput setaf 6; echo Built by July 🏳️🌈; exit ;;
|
||||||
-* | '' )
|
-* | '' )
|
||||||
echo "Usage: appdwarf [option] [APP/FILE/FOLDER/URL] [compression options]"
|
echo "Usage: appdwarf [option] [APP/FILE/FOLDER/URL] [compression options]"
|
||||||
|
@ -142,5 +143,5 @@ head="$(mktemp)"
|
||||||
printfunc header > "$head"
|
printfunc header > "$head"
|
||||||
|
|
||||||
mkdwarfs -o "$(realpath "$1").sh" -B5 --header "$head" -i "$@"
|
mkdwarfs -o "$(realpath "$1").sh" -B5 --header "$head" -i "$@"
|
||||||
rm "$head"
|
rm -rf "$head" "$1"
|
||||||
chmod +x "$(realpath "$1").sh"
|
chmod +x "$(realpath "$1").sh"
|
||||||
|
|
Loading…
Reference in a new issue