11#! /bin/sh
22
33APP=android-tools-appimage
4+ APPDIR=" $APP " .AppDir
45SITE=" https://dl.google.com/android/repository"
56
67# CREATE DIRECTORIES
78if [ -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
1717cat >> ./Android-$APP .desktop << 'EOF '
@@ -25,7 +25,7 @@ Terminal=true
2525EOF
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
2929ln -s ./Android.png ./.DirIcon
3030
3131# AppRun
7272fi
7373EOF
7474chmod 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}' )
7878cd ..
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
8081chmod 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; }
8685if [ -z " $APP " ]; then exit 1; fi # Being extra safe lol
8786mv ./* .AppImage .. && cd .. && rm -rf " ./$APP "
8887echo " All Done!"
0 commit comments