11#! /bin/sh
22
3+ export ARCH=x86_64
34APP=android-tools-appimage
45APPDIR=" $APP " .AppDir
5- SITE=" https://dl.google.com/android/repository"
6-
7- # CREATE DIRECTORIES
8- if [ -z " $APP " ]; then exit 1; fi
9- mkdir -p " ./$APP /tmp" && cd " ./$APP /tmp" || exit 1
6+ SITE=" https://dl.google.com/android/repository/platform-tools-latest-linux.zip"
7+ ICON=" https://developer.android.com/static/images/brand/Android_Robot.png"
8+ 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$' )
109
11- # DOWNLOAD THE ARCHIVE
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
10+ # CREATE DIRECTORIES AND DOWNLOAD THE ARCHIVE
11+ [ -n " $APP " ] || exit 1
12+ mkdir -p ./" $APP " /" $APPDIR " /usr && cd ./" $APP " /" $APPDIR " /usr || exit 1
13+ wget " $SITE " && unzip -q * .zip && rm -f ./* .zip || exit 1
14+ mv ./platform-* ./bin && cd .. || exit 1
1515
16- # DESKTOP ENTRY
16+ # DESKTOP & ICON
1717cat >> ./Android-$APP .desktop << 'EOF '
1818[Desktop Entry]
1919Name=Android-platform-tools
@@ -23,10 +23,7 @@ Exec="sh -ic ' android-tools "";"" \\$SHELL'"
2323Categories=Utility;
2424Terminal=true
2525EOF
26-
27- # GET ICON
28- wget https://developer.android.com/static/images/brand/Android_Robot.png -O ./Android.png 2> /dev/null
29- ln -s ./Android.png ./.DirIcon
26+ wget " $ICON " -O ./Android.png && ln -s ./Android.png ./.DirIcon
3027
3128# AppRun
3229cat >> ./AppRun << 'EOF '
@@ -36,6 +33,7 @@ UDEVNOTICE='No android udev rules detected, use "--getudev" to install'
3633UDEVREPO="https://github.com/M0Rf30/android-udev-rules.git"
3734export PATH="$CURRENTDIR:$PATH"
3835cat /etc/udev/rules.d/*droid.rules >/dev/null 2>&1 && UDEVNOTICE=""
36+ ARGV0="${ARGV0#./}"
3937
4038_get_udev_rules() {
4139 if cat /etc/udev/rules.d/*droid.rules >/dev/null 2>&1; then
@@ -130,16 +128,10 @@ case $ARGV0 in
130128esac
131129EOF
132130chmod a+x ./AppRun
133- APPVERSION=$( awk -F = ' /Revision/ {print $2; exit}' ./usr/bin/source.properties)
134-
135- # MAKE APPIMAGE
136- cd ..
137- 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$' )
138- wget -q " $APPIMAGETOOL " -O appimagetool
139- chmod a+x ./appimagetool
131+ export VERSION=" $( awk -F" =" ' /vision/ {print $2}' ./usr/bin/source.properties) "
140132
141133# Do the thing!
142- ARCH=x86_64 VERSION= " $APPVERSION " ./appimagetool -s ./ " $APPDIR " || { echo " appimagetool failed to make the appimage " ; exit 1 ; }
143- if [ -z " $APP " ] ; then exit 1; fi # Being extra safe lol
144- mv ./* .AppImage .. && cd .. && rm -rf " ./ $APP "
134+ cd .. && wget -q " $APPIMAGETOOL " -O appimagetool && chmod +x ./appimagetool
135+ ./appimagetool -s ./ " $APPDIR " || exit 1
136+ [ -n " $APP " ] && mv ./* .AppImage .. && cd .. && rm -rf " $APP " || exit 1
145137echo " All Done!"
0 commit comments