Skip to content

Commit 9ddc771

Browse files
authored
refactor and update script (#5)
1 parent 6cf320b commit 9ddc771

File tree

1 file changed

+19
-16
lines changed

1 file changed

+19
-16
lines changed

android-tools-appimage.sh

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,24 @@
11
#!/bin/sh
22

3-
export ARCH=x86_64
3+
set -eu
4+
5+
export ARCH="$(uname -m)"
46
APP=android-tools-appimage
5-
APPDIR="$APP".AppDir
67
SITE="https://dl.google.com/android/repository/platform-tools-latest-linux.zip"
78
ICON="https://github.com/pkgforge-dev/android-tools-AppImage/blob/main/Android.png?raw=true"
89
APPIMAGETOOL="https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage"
9-
SHARUN="https://github.com/VHSgunzo/sharun/releases/latest/download/sharun-$(uname -m)"
1010
LIB4BIN="https://raw.githubusercontent.com/VHSgunzo/sharun/refs/heads/main/lib4bin"
1111

1212
# CREATE DIRECTORIES AND DOWNLOAD THE ARCHIVE
13-
[ -n "$APP" ] || exit 1
14-
mkdir -p ./"$APP"/"$APPDIR"/shared && cd ./"$APP"/"$APPDIR" || exit 1
15-
wget "$SITE" && unzip -q *.zip && rm -f ./*.zip || exit 1
16-
mv ./platform-tools ./shared/bin || exit 1
13+
mkdir -p ./AppDir/shared
14+
cd ./AppDir
15+
wget "$SITE"
16+
unzip -q *.zip
17+
rm -f ./*.zip
18+
mv -v ./platform-tools ./shared/bin
1719

1820
# DESKTOP & ICON
19-
cat >> ./Android-$APP.desktop << 'EOF'
21+
cat >> ./android-tools.desktop << 'EOF'
2022
[Desktop Entry]
2123
Name=Android-platform-tools
2224
Type=Application
@@ -25,14 +27,14 @@ Exec="sh -ic ' android-tools "";"" \\$SHELL'"
2527
Categories=Utility;
2628
Terminal=true
2729
EOF
28-
wget "$ICON" -O ./Android.png && ln -s ./Android.png ./.DirIcon
30+
wget "$ICON" -O ./Android.png
31+
ln -s ./Android.png ./.DirIcon
2932

3033
# BUNDLE ALL DEPENDENCIES
31-
wget "$SHARUN" -O ./sharun || exit 1
32-
wget "$LIB4BIN" -O ./lib4bin || exit 1
33-
chmod +x ./sharun ./lib4bin
34+
wget "$LIB4BIN" -O ./lib4bin
35+
chmod +x ./lib4bin
3436

35-
HARD_LINKS=1 ./lib4bin ./shared/bin/* && rm -f ./lib4bin || exit 1
37+
./lib4bin -p -v -s -k ./shared/bin/*
3638

3739
# AppRun
3840
cat >> ./AppRun << 'EOF'
@@ -137,8 +139,9 @@ export VERSION="$(awk -F"=" '/vision/ {print $2}' ./shared/bin/source.properties
137139
echo "$VERSION" > ~/version
138140

139141
# Do the thing!
140-
cd .. && wget -q "$APPIMAGETOOL" -O appimagetool && chmod +x ./appimagetool
142+
cd ..
143+
wget "$APPIMAGETOOL" -O appimagetool
144+
chmod +x ./appimagetool
141145
./appimagetool --comp zstd \
142-
--mksquashfs-opt -Xcompression-level --mksquashfs-opt 22 ./"$APPDIR" || exit 1
143-
[ -n "$APP" ] && mv ./*.AppImage .. && cd .. && rm -rf "$APP" || exit 1
146+
--mksquashfs-opt -Xcompression-level --mksquashfs-opt 22 ./AppDir
144147
echo "All Done!"

0 commit comments

Comments
 (0)