Skip to content

Commit 869a3b1

Browse files
authored
Update android-tools-appimage.sh
1 parent 98bab3b commit 869a3b1

1 file changed

Lines changed: 10 additions & 11 deletions

File tree

android-tools-appimage.sh

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

33
APP=android-tools-appimage
4+
APPDIR="$APP".AppDir
45
SITE="https://dl.google.com/android/repository"
56

67
# CREATE DIRECTORIES
78
if [ -z "$APP" ]; then exit 1; fi
8-
mkdir -p "./$APP/tmp" && cd "./$APP/tmp" || exit
9+
mkdir -p "./$APP/tmp" && cd "./$APP/tmp" || exit 1
910

1011
# DOWNLOAD THE ARCHIVE
11-
wget "$SITE/platform-tools-latest-linux.zip" && unzip -qq ./*.zip
12-
cd ..
13-
mkdir -p "./$APP.AppDir/usr/bin" && mv --backup=t ./tmp/*/* "./$APP.AppDir/usr/bin"
14-
cd ./$APP.AppDir || exit
12+
wget "$SITE/platform-tools-latest-linux.zip" && unzip -qq ./*.zip && cd .. \
13+
&& mkdir -p "./$APP.AppDir/usr/bin" && mv --backup=t ./tmp/*/* "./$APP.AppDir/usr/bin" \
14+
&& cd ./"$APPDIR" || exit 1
1515

1616
# DESKTOP ENTRY
1717
cat >> ./Android-$APP.desktop << 'EOF'
@@ -25,7 +25,7 @@ Terminal=true
2525
EOF
2626

2727
# GET ICON
28-
wget https://developer.android.com/static/images/brand/Android_Robot.png -O ./Android.png 2> /dev/null
28+
wget https://developer.android.com/static/images/brand/Android_Robot.png -O ./Android.png 2> /dev/null
2929
ln -s ./Android.png ./.DirIcon
3030

3131
# AppRun
@@ -72,17 +72,16 @@ else
7272
fi
7373
EOF
7474
chmod a+x ./AppRun
75+
APPVERSION=$(awk -F = '/Revision/ {print $2; exit}' ./usr/bin/source.properties)
7576

7677
# MAKE APPIMAGE
77-
APPVERSION=$(cat ./usr/bin/source.properties | grep vision | awk -F = '{print $NF; exit}')
7878
cd ..
79-
wget -q $(wget -q https://api.github.com/repos/probonopd/go-appimage/releases -O - | grep -v zsync | grep -i continuous | grep -i appimagetool | grep -i x86_64 | grep browser_download_url | cut -d '"' -f 4 | head -1) -O appimagetool
79+
APPIMAGETOOL=$(wget -q https://api.github.com/repos/probonopd/go-appimage/releases -O - | sed 's/[()",{}]/ /g; s/ /\n/g' | grep -o 'https.*continuous.*tool.*86_64.*mage$')
80+
wget -q "$APPIMAGETOOL" -O appimagetool
8081
chmod a+x ./appimagetool
8182

8283
# Do the thing!
83-
ARCH=x86_64 VERSION=$(./appimagetool -v | grep -o '[[:digit:]]*') ./appimagetool -s ./$APP.AppDir &&
84-
ls ./*.AppImage || { echo "appimagetool failed to make the appimage"; exit 1; }
85-
mv ./*AppImage ./"$APPVERSION"-"android-tools.AppImage"
84+
ARCH=x86_64 VERSION="$APPVERSION" ./appimagetool -s ./"$APPDIR" || { echo "appimagetool failed to make the appimage"; exit 1; }
8685
if [ -z "$APP" ]; then exit 1; fi # Being extra safe lol
8786
mv ./*.AppImage .. && cd .. && rm -rf "./$APP"
8887
echo "All Done!"

0 commit comments

Comments
 (0)