mirror of
https://github.com/Phantop/appdwarf.git
synced 2024-10-31 20:14:27 +00:00
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
This commit is contained in:
parent
19b9cd80da
commit
3ebee5f254
7
AppRun
7
AppRun
|
@ -1,5 +1,4 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
HERE=$(dirname "$(readlink -f "${0}")")
|
export PATH="${APPDIR}":"${APPDIR}"/bin:"$PATH"
|
||||||
export PATH="${HERE}":"${HERE}"/bin:"$PATH"
|
export LD_LIBRARY_PATH="${APPDIR}"/lib64:"${APPDIR}"/lib:"$LD_LIBRARY_PATH"
|
||||||
export LD_LIBRARY_PATH="${HERE}"/lib64:"${HERE}"/lib:"$LD_LIBRARY_PATH"
|
exec "$APPDIR/$ARGV0" "$@"
|
||||||
exec "${HERE}"/"$APPDWARF_CMD" "$@"
|
|
||||||
|
|
5
appdwarf
5
appdwarf
|
@ -6,7 +6,6 @@ if [ $# -eq 0 ] || [ "$1" = -h ] || [ "$1" = --help ]; then # print help text
|
||||||
tput setaf 7
|
tput setaf 7
|
||||||
echo " -a, --appimage Convert a given AppImage to appdwarf"
|
echo " -a, --appimage Convert a given AppImage to appdwarf"
|
||||||
echo " -f, --folder Make image mount to a given folder (no AppRun)"
|
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 " -u, --url Fetch and convert AppImage from URL"
|
||||||
echo; tput setaf 5
|
echo; tput setaf 5
|
||||||
echo " -h, --help Print this help text"
|
echo " -h, --help Print this help text"
|
||||||
|
@ -28,14 +27,12 @@ while true; do # process args
|
||||||
HEAD=/tmp/dwarfhead
|
HEAD=/tmp/dwarfhead
|
||||||
sed -i "2s|$|\"$2\"|" "$HEAD"
|
sed -i "2s|$|\"$2\"|" "$HEAD"
|
||||||
shift ;;
|
shift ;;
|
||||||
--separate | -s)
|
|
||||||
HEAD="$HEAD"_separate ;;
|
|
||||||
--url | -u)
|
--url | -u)
|
||||||
app=$(basename "$2")
|
app=$(basename "$2")
|
||||||
aria2c -x16 -s16 "$2" -o "$app" || wget "$2" -O "$app"
|
aria2c -x16 -s16 "$2" -o "$app" || wget "$2" -O "$app"
|
||||||
shift ;;
|
shift ;;
|
||||||
--version | -v)
|
--version | -v)
|
||||||
tput setaf 2; echo appdwarf v2.9
|
tput setaf 2; echo appdwarf v3.0
|
||||||
tput setaf 4; echo Built by July 🏳️🌈
|
tput setaf 4; echo Built by July 🏳️🌈
|
||||||
exit ;;
|
exit ;;
|
||||||
--)
|
--)
|
||||||
|
|
|
@ -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
|
curl -L https://go.dev/"$LINK" | tar xz -C$DIR
|
||||||
|
|
||||||
cp "$(dirname "$(readlink -f "${0}")")"/../AppRun $DIR/go
|
cp "$(dirname "$(readlink -f "${0}")")"/../AppRun $DIR/go
|
||||||
sed -i 5s#/#/bin/# $DIR/go/AppRun
|
sed -i '4i export GOPROXY=direct' $DIR/go/AppRun
|
||||||
sed -i '4a export GOPROXY=direct' $DIR/go/AppRun
|
sed -i 4s#/#/bin/# $DIR/go/AppRun
|
||||||
|
|
||||||
appdwarf $DIR/go
|
appdwarf $DIR/go
|
||||||
mv $DIR/go.sh go
|
mv $DIR/go.sh go
|
||||||
|
|
|
@ -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
|
$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
|
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 "$@"
|
appdwarf $DIR/jre "$@"
|
||||||
mv $DIR/jre.sh java"$VER"
|
mv $DIR/jre.sh java"$VER"
|
||||||
|
|
|
@ -9,7 +9,7 @@ aria2c "$LINK" -d $DIR -o exe
|
||||||
rm $DIR/exe
|
rm $DIR/exe
|
||||||
mv $DIR/Mp3tag.exe $DIR/mp3tag
|
mv $DIR/Mp3tag.exe $DIR/mp3tag
|
||||||
cp "$(dirname "$(readlink -f "${0}")")"/../AppRun $DIR
|
cp "$(dirname "$(readlink -f "${0}")")"/../AppRun $DIR
|
||||||
sed -i '5s/ / wine /' $DIR/AppRun
|
sed -i '4s/ / wine /' $DIR/AppRun
|
||||||
|
|
||||||
appdwarf $DIR
|
appdwarf $DIR
|
||||||
mv $DIR.sh mp3tag
|
mv $DIR.sh mp3tag
|
||||||
|
|
|
@ -10,7 +10,7 @@ mv $DIR/node* $DIR/node
|
||||||
strip $DIR/node/bin/node
|
strip $DIR/node/bin/node
|
||||||
|
|
||||||
cp "$(dirname "$(readlink -f "${0}")")"/../AppRun $DIR/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
|
appdwarf $DIR/node
|
||||||
mv $DIR/node.sh node
|
mv $DIR/node.sh node
|
||||||
|
|
|
@ -11,7 +11,7 @@ for i in cargo rustc rust-std-$ARCH/; do
|
||||||
mv "$DIR/rust-nightly-$ARCH/$i"/* $DIR/rust; done
|
mv "$DIR/rust-nightly-$ARCH/$i"/* $DIR/rust; done
|
||||||
|
|
||||||
cp "$(dirname "$(readlink -f "${0}")")"/../AppRun $DIR/rust
|
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
|
appdwarf $DIR/rust
|
||||||
mv $DIR/rust.sh cargo
|
mv $DIR/rust.sh cargo
|
||||||
|
|
11
apps/mktex
11
apps/mktex
|
@ -43,15 +43,8 @@ EOF
|
||||||
$DIR/tl/install-tl -profile $DIR/tl/prof
|
$DIR/tl/install-tl -profile $DIR/tl/prof
|
||||||
|
|
||||||
cp "$(dirname "$(readlink -f "${0}")")"/../AppRun $DIR/tex
|
cp "$(dirname "$(readlink -f "${0}")")"/../AppRun $DIR/tex
|
||||||
sed -i 3s#/bin#/bin/x86_64-linux# $DIR/tex/AppRun
|
sed -i 2s#/bin#/bin/x86_64-linux# $DIR/tex/AppRun
|
||||||
sed -i 5s#/#/bin/x86_64-linux# $DIR/tex/AppRun
|
sed -i 4s#/#/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
|
|
||||||
|
|
||||||
chmod +x $DIR/tex/AppRun
|
chmod +x $DIR/tex/AppRun
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ rm $DIR/*.eopkg
|
||||||
rm -r $DIR/usr/lib64/rustlib/i686-unknown-linux-gnu
|
rm -r $DIR/usr/lib64/rustlib/i686-unknown-linux-gnu
|
||||||
|
|
||||||
cp "$(dirname "$(readlink -f "${0}")")"/../AppRun $DIR/usr
|
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
|
appdwarf $DIR/usr
|
||||||
mv $DIR/usr.sh cargo
|
mv $DIR/usr.sh cargo
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
ID="$(curl -L https://ungoogled-software.github.io/ungoogled-chromium-binaries | grep -m7 href | tail -n 1 | awk -F'[<>]' '{print $5}')"
|
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"
|
||||||
|
|
17
header
17
header
|
@ -1,14 +1,17 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# shellcheck disable=SC2086,SC2155
|
# 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")"
|
export APPDWARF_CMD="$(basename "$0")"
|
||||||
if [ ! -d "$DIR" ]; then
|
if [ ! -d "$APPDIR" ]; then
|
||||||
mkdir "$DIR"
|
mkdir "$APPDIR"
|
||||||
ARG="-o offset=auto -o tidy_strategy=swap -o workers=4"
|
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
|
fi
|
||||||
|
|
||||||
"$DIR/AppRun" "$@"
|
"$APPDIR/AppRun" "$@"
|
||||||
fusermount -quz "$DIR"
|
fusermount -quz "$APPDIR"
|
||||||
rmdir "$DIR" 2> /dev/null
|
rmdir "$APPDIR" 2> /dev/null
|
||||||
exit
|
exit
|
||||||
|
|
|
@ -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
|
|
Loading…
Reference in a new issue