From 3ebee5f2541bcfc3d83bc25657711628d78f7298 Mon Sep 17 00:00:00 2001 From: Phantop Date: Sat, 11 Jun 2022 15:02:34 -0400 Subject: [PATCH] appdwarf: Switch to AppImage standard environmental variables as v3.0 Deprecates $APPDWARF_CMD for $ARGV0, as part of the standard Also finally removes the separate header, as it seems to not be needed anymore --- AppRun | 7 +++---- appdwarf | 5 +---- apps/mkgo | 4 ++-- apps/mkjava | 2 +- apps/mkmp3tag | 2 +- apps/mknode | 2 +- apps/mkrust | 2 +- apps/mktex | 11 ++--------- apps/rustsolus | 2 +- apps/ungoogled | 2 +- header | 17 ++++++++++------- header_separate | 11 ----------- 12 files changed, 24 insertions(+), 43 deletions(-) delete mode 100755 header_separate diff --git a/AppRun b/AppRun index dcc75c9..33ce0df 100755 --- a/AppRun +++ b/AppRun @@ -1,5 +1,4 @@ #!/bin/sh -HERE=$(dirname "$(readlink -f "${0}")") -export PATH="${HERE}":"${HERE}"/bin:"$PATH" -export LD_LIBRARY_PATH="${HERE}"/lib64:"${HERE}"/lib:"$LD_LIBRARY_PATH" -exec "${HERE}"/"$APPDWARF_CMD" "$@" +export PATH="${APPDIR}":"${APPDIR}"/bin:"$PATH" +export LD_LIBRARY_PATH="${APPDIR}"/lib64:"${APPDIR}"/lib:"$LD_LIBRARY_PATH" +exec "$APPDIR/$ARGV0" "$@" diff --git a/appdwarf b/appdwarf index abe91ef..5d28316 100755 --- a/appdwarf +++ b/appdwarf @@ -6,7 +6,6 @@ if [ $# -eq 0 ] || [ "$1" = -h ] || [ "$1" = --help ]; then # print help text tput setaf 7 echo " -a, --appimage Convert a given AppImage to appdwarf" echo " -f, --folder Make image mount to a given folder (no AppRun)" - echo " -s, --separate Use old, separated header format" echo " -u, --url Fetch and convert AppImage from URL" echo; tput setaf 5 echo " -h, --help Print this help text" @@ -28,14 +27,12 @@ while true; do # process args HEAD=/tmp/dwarfhead sed -i "2s|$|\"$2\"|" "$HEAD" shift ;; - --separate | -s) - HEAD="$HEAD"_separate ;; --url | -u) app=$(basename "$2") aria2c -x16 -s16 "$2" -o "$app" || wget "$2" -O "$app" shift ;; --version | -v) - tput setaf 2; echo appdwarf v2.9 + tput setaf 2; echo appdwarf v3.0 tput setaf 4; echo Built by July 🏳️‍🌈 exit ;; --) diff --git a/apps/mkgo b/apps/mkgo index 2fad227..3924079 100755 --- a/apps/mkgo +++ b/apps/mkgo @@ -6,8 +6,8 @@ LINK=$(curl -sL https://go.dev/dl | grep -om1 dl/go.\*linux-amd64.tar.gz) curl -L https://go.dev/"$LINK" | tar xz -C$DIR cp "$(dirname "$(readlink -f "${0}")")"/../AppRun $DIR/go -sed -i 5s#/#/bin/# $DIR/go/AppRun -sed -i '4a export GOPROXY=direct' $DIR/go/AppRun +sed -i '4i export GOPROXY=direct' $DIR/go/AppRun +sed -i 4s#/#/bin/# $DIR/go/AppRun appdwarf $DIR/go mv $DIR/go.sh go diff --git a/apps/mkjava b/apps/mkjava index 170982c..4a8aafa 100755 --- a/apps/mkjava +++ b/apps/mkjava @@ -11,7 +11,7 @@ mv $DIR/jdk* $DIR/jdk $DIR/jdk/bin/jlink --add-modules ALL-MODULE-PATH --output $DIR/jre --strip-debug --no-man-pages --no-header-files --compress=0 cp "$(dirname "$(readlink -f "${0}")")"/../AppRun $DIR/jre -sed -i 5s#/#/bin/# $DIR/jre/AppRun +sed -i 4s#/#/bin/# $DIR/jre/AppRun appdwarf $DIR/jre "$@" mv $DIR/jre.sh java"$VER" diff --git a/apps/mkmp3tag b/apps/mkmp3tag index 94e2cf3..319ab2e 100755 --- a/apps/mkmp3tag +++ b/apps/mkmp3tag @@ -9,7 +9,7 @@ aria2c "$LINK" -d $DIR -o exe rm $DIR/exe mv $DIR/Mp3tag.exe $DIR/mp3tag cp "$(dirname "$(readlink -f "${0}")")"/../AppRun $DIR -sed -i '5s/ / wine /' $DIR/AppRun +sed -i '4s/ / wine /' $DIR/AppRun appdwarf $DIR mv $DIR.sh mp3tag diff --git a/apps/mknode b/apps/mknode index 17bc1e2..173d315 100755 --- a/apps/mknode +++ b/apps/mknode @@ -10,7 +10,7 @@ mv $DIR/node* $DIR/node strip $DIR/node/bin/node cp "$(dirname "$(readlink -f "${0}")")"/../AppRun $DIR/node -sed -i 5s#/#/bin/# $DIR/node/AppRun +sed -i 4s#/#/bin/# $DIR/node/AppRun appdwarf $DIR/node mv $DIR/node.sh node diff --git a/apps/mkrust b/apps/mkrust index 9dff0b7..fefcaa2 100755 --- a/apps/mkrust +++ b/apps/mkrust @@ -11,7 +11,7 @@ for i in cargo rustc rust-std-$ARCH/; do mv "$DIR/rust-nightly-$ARCH/$i"/* $DIR/rust; done cp "$(dirname "$(readlink -f "${0}")")"/../AppRun $DIR/rust -sed -i 5s#/#/bin/# $DIR/rust/AppRun +sed -i 4s#/#/bin/# $DIR/rust/AppRun appdwarf $DIR/rust mv $DIR/rust.sh cargo diff --git a/apps/mktex b/apps/mktex index 45b5ef1..d383281 100755 --- a/apps/mktex +++ b/apps/mktex @@ -43,15 +43,8 @@ EOF $DIR/tl/install-tl -profile $DIR/tl/prof cp "$(dirname "$(readlink -f "${0}")")"/../AppRun $DIR/tex -sed -i 3s#/bin#/bin/x86_64-linux# $DIR/tex/AppRun -sed -i 5s#/#/bin/x86_64-linux# $DIR/tex/AppRun - -cat > $DIR/tex/AppRun << 'EOF' -#!/bin/sh -HERE=$(dirname "$(readlink -f "${0}")") -export PATH="${HERE}"/bin/x86_64-linux:"$PATH" -"${HERE}"/bin/x86_64-linux/"$APPDWARF_CMD" "$@" -EOF +sed -i 2s#/bin#/bin/x86_64-linux# $DIR/tex/AppRun +sed -i 4s#/#/bin/x86_64-linux# $DIR/tex/AppRun chmod +x $DIR/tex/AppRun diff --git a/apps/rustsolus b/apps/rustsolus index aa853ca..a85bfea 100755 --- a/apps/rustsolus +++ b/apps/rustsolus @@ -9,7 +9,7 @@ rm $DIR/*.eopkg rm -r $DIR/usr/lib64/rustlib/i686-unknown-linux-gnu cp "$(dirname "$(readlink -f "${0}")")"/../AppRun $DIR/usr -sed -i 5s#/#/bin/# $DIR/usr/AppRun +sed -i 4s#/#/bin/# $DIR/usr/AppRun appdwarf $DIR/usr mv $DIR/usr.sh cargo diff --git a/apps/ungoogled b/apps/ungoogled index 3033fc3..0aa5dac 100755 --- a/apps/ungoogled +++ b/apps/ungoogled @@ -1,3 +1,3 @@ #!/bin/sh ID="$(curl -L https://ungoogled-software.github.io/ungoogled-chromium-binaries | grep -m7 href | tail -n 1 | awk -F'[<>]' '{print $5}')" -appdwarf -s -u "https://github.com/clickot/ungoogled-chromium-binaries/releases/download/$ID/ungoogled-chromium_$ID.AppImage" +appdwarf -u "https://github.com/clickot/ungoogled-chromium-binaries/releases/download/$ID/ungoogled-chromium_$ID.AppImage" diff --git a/header b/header index 100ab14..ea20fb9 100755 --- a/header +++ b/header @@ -1,14 +1,17 @@ #!/bin/sh # shellcheck disable=SC2086,SC2155 -DIR="/tmp/dwarf_$(basename "$0")$(echo "$0" | md5sum | head -c5)" +export APPDIR="/tmp/dwarf_$(basename "$0")$(echo "$0" | md5sum | head -c5)" +export APPIMAGE="$0" +export ARGV0="$(basename "$0")" +export OWD="$PWD" export APPDWARF_CMD="$(basename "$0")" -if [ ! -d "$DIR" ]; then - mkdir "$DIR" +if [ ! -d "$APPDIR" ]; then + mkdir "$APPDIR" ARG="-o offset=auto -o tidy_strategy=swap -o workers=4" - dwarfs $ARG "$0" "$DIR" 2>/dev/null + dwarfs $ARG "$0" "$APPDIR" 2>/dev/null fi -"$DIR/AppRun" "$@" -fusermount -quz "$DIR" -rmdir "$DIR" 2> /dev/null +"$APPDIR/AppRun" "$@" +fusermount -quz "$APPDIR" +rmdir "$APPDIR" 2> /dev/null exit diff --git a/header_separate b/header_separate deleted file mode 100755 index 8e98605..0000000 --- a/header_separate +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh -# shellcheck disable=SC2086,SC2155 -DIR="$(mktemp -td dwarf_"$(basename "$0")"XXXXX)" -ARG="-o offset=auto -o tidy_strategy=swap -o workers=4" -export APPDWARF_CMD="$(basename "$0")" -dwarfs $ARG "$0" "$DIR" 2>/dev/null - -"$DIR/AppRun" "$@" -fusermount -uz "$DIR" -rmdir "$DIR" -exit