Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/system/bin/bash
- # Author: Johannes Krämer
- # Email: dev@blade83.de
- # This Script is for Android Phones!
- # You need a rootet Phone and the curl Library
- # Download here: http://curl.haxx.se/download.html#Linux
- # Copy the Binary Files (data/local/bin/*) to /system/bin/ on your Android Phone.
- # Usage:
- # Open a Terminal on your Phone and type in app_reinstall developerbase
- clear
- if [ $UID != '0' ]; then
- echo -e "\033[31mYou need SuperUser rights!\033[32m"
- exit 1
- fi
- function usage()
- {
- echo -e "\033[32mapp_reinstall:
- $*
- Usage:
- app_reinstall <subdomainname> or
- sh app_reinstall <subdomainname>
- " >&2
- exit 2
- }
- if [ $# -lt 1 ]; then
- usage "needs a <subdomainname>"
- fi
- param1=$(echo "$1" | sed 's/[a-z/A-Z]//g')
- if [ "$param1" ]; then
- usage "wrong <subdomainname> character(s) found"
- fi
- echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
- echo -e "|Collect installed TMedia Applications:|\n\n\033[33m"
- # Change here the search Parameters! if you use the bundle ID de.yourCompanyName.appname
- # then change it to installedPackages=`pm list packages | grep yourCompanyName`
- installedPackages=`pm list packages | grep timbuli`
- echo "$installedPackages" | sed -e 's/package:/\n/g'
- echo -e "\033[0m"
- packageExists=$(echo "$installedPackages" | grep "$1")
- if [ "$packageExists" ]; then
- echo -e "\nUninstalling current Version from System"
- # change here your Package Name!!!!!
- pm uninstall "de.timbulimedia.$1"
- fi
- # change here your Package Name <timbulimedia>
- if [ -f "/mnt/sdcard/Download/de.timbulimedia.$1.apk" ]; then
- echo -e "\n\nRemoving old *.apk Files"
- # change here your Package Name !!!!!
- rm "/mnt/sdcard/Download/de.timbulimedia.$1.apk"
- echo -e "Done"
- fi
- echo -e "\nSearching for download... \n"
- # change here your server APK url !!!!!
- serverStatus=`curl -Is "http://$1.timbulimedia.de/APP/de.timbulimedia.$1.apk" | head -n 1`
- if [ "$(echo "$serverStatus" | grep -E -o "[0-9]{3}+")" -eq 200 ]; then
- # change here your Package Name and APK URL <timbulimedia>!!!!!
- curl -o "/mnt/sdcard/Download/de.timbulimedia.$1.apk" "http://$1.timbulimedia.de/APP/de.timbulimedia.$1.apk"
- echo -e "\nDownload complete. \n"
- echo -e "Installing new Application... \n"
- # change here your Package Name <timbulimedia>!!!!!
- pm install "/mnt/sdcard/Download/de.timbulimedia.$1.apk" &> /dev/null
- echo -e "\nApplication was successful updated! \n"
- else
- echo -e "\n\033[31mCan not find \"$1\"!\033[32m \n\n\n"
- fi
- echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement