Added get Up-To-Date Script Routine if Script is broken

This commit is contained in:
NewBit
2021-10-30 14:59:34 +02:00
parent a429ed574e
commit 1ed64ba83a
2 changed files with 62 additions and 15 deletions
+5 -1
View File
@@ -207,7 +207,7 @@ rootAVD.bat %LOCALAPPDATA%\Android\Sdk\system-images\android-31\google_apis_play
* Once choosen, the script will make that Version to your local one.
* Prebuilt Kernel and Modules will be pulled from [AOSP](https://android.googlesource.com/kernel/prebuilts)
* Starting Magisk from Terminal via `adb shell monkey -p com.topjohnwu.magisk -c android.intent.category.LAUNCHER 1`
* API 28 (Pie) is **not supported** at all -> [because](https://source.android.com/devices/bootloader/partitions/system-as-root#sar-partitioning)
### 2 Ways to boot the AVD into Safe Mode
* 1st Way - If the AVD still boots normal:
@@ -248,6 +248,9 @@ rootAVD.bat %LOCALAPPDATA%\Android\Sdk\system-images\android-31\google_apis_play
* [[Oct. 2021] - Android 11 (R) API 30 Google Apis Play Store x86_64 r10 Darwin/MacOS Production Build](https://dl.google.com/android/repository/sys-img/google_apis_playstore/x86_64-30_r10-darwin.zip)
### Magisk v22.1+ Successfully tested with Stock Kernel on
* [[Oct. 2021] - Android 8 (Oreo) API 26 Google Apis Play Store x86 r07 Production Build](https://dl.google.com/android/repository/sys-img/google_apis_playstore/x86-26_r07.zip)
* [[Oct. 2021] - Android 7 (Nougat) API 24 Google Apis Play Store x86 r19 Production Build](https://dl.google.com/android/repository/sys-img/google_apis_playstore/x86-24_r19.zip)
* [[Oct. 2021] - Android 7 (Nougat) API 24 Google Apis x86_64 r27 Production Build](https://dl.google.com/android/repository/sys-img/google_apis/x86_64-24_r27.zip)
* [[Oct. 2021] - Android 11 (R) API 30 Google Apis Play Store x86 r09 Windows Production Build](https://dl.google.com/android/repository/sys-img/google_apis_playstore/x86-30_r09-windows.zip)
* [[Oct. 2021] - Android 10 (Q) API 29 Google Apis Play Store x86 r08 Windows Production Build](https://dl.google.com/android/repository/sys-img/google_apis_playstore/x86-29_r08-windows.zip)
* [[Oct. 2021] - Android 11 (R) API 30 Google Apis Play Store x86 r09 Darwin/MacOS Production Build](https://dl.google.com/android/repository/sys-img/google_apis_playstore/x86-30_r09-darwin.zip)
@@ -272,6 +275,7 @@ rootAVD.bat %LOCALAPPDATA%\Android\Sdk\system-images\android-31\google_apis_play
### Change Logs
#### [October 2021]
* [rootAVD.sh] - Added get Up-To-Date Script Routine if Script is broken
* [rootAVD.sh] - Updated LZ4 decompression Routine
* [rootAVD.sh] - Updated InstallPrebuiltKernelModules Routine to support ARM64 Kernels
* [rootAVD.sh] - Updated Busybox Extraction Routine
+57 -14
View File
@@ -49,8 +49,14 @@ get_flags() {
KEEPFORCEENCRYPT=false
fi
fi
export RECOVERYMODE=false
RECOVERYMODE=false
if [[ $API -eq 28 ]]; then
RECOVERYMODE=true
fi
export RECOVERYMODE
export KEEPVERITY
export KEEPFORCEENCRYPT
echo "[*] RECOVERYMODE=$RECOVERYMODE"
@@ -534,14 +540,16 @@ json_value() {
$BB grep -o "\"""${1}""\"\:.*" | $BB sed -e "s/.*\"""${1}""\": //" -e 's/[",]*$//' -e 's/["]*$//' -e 's/[,]*$//' -e "s/\"//" -n -e "${2}"p
}
CheckAVDIsOnline() {
echo "[-] Checking AVDs Internet connection..."
AVDIsOnline=false
$BB timeout 3 $BB wget -q --spider --no-check-certificate http://github.com > /dev/null 2>&1
if [ $? -eq 0 ]; then
CheckAVDIsOnline() {
if [ -z $AVDIsOnline ]; then
echo "[-] Checking AVDs Internet connection..."
AVDIsOnline=false
$BB timeout 3 $BB wget -q --spider --no-check-certificate http://github.com > /dev/null 2>&1
if [ $? -eq 0 ]; then
AVDIsOnline=true
fi
$AVDIsOnline && echo "[!] AVD is online" || echo "[!] AVD is offline"
fi
$AVDIsOnline && echo "[!] AVD is online" || echo "[!] AVD is offline"
export AVDIsOnline
}
@@ -555,6 +563,7 @@ GetPrettyVer() {
}
DownLoadFile() {
CheckAVDIsOnline
if ("$AVDIsOnline"); then
local URL="$1"
local SRC="$2"
@@ -727,6 +736,30 @@ CheckAvailableMagisks() {
export MAGISKVERCHOOSEN
}
DownloadUptoDateSript() {
echo "[*] Trying to Download the Up-To-Date Script Version"
local DLL_URL="https://github.com/newbit1/rootAVD/raw/master/"
local DLL_SCRIPT="rootAVD.sh"
local DLL_ROOTAVD_ZIP="https://github.com/newbit1/rootAVD/archive/refs/heads/master.zip"
local PKG_NAME="com.topjohnwu.magisk"
local PKG_PATH=""
echo "[!] Temporarily installing Magisk"
pm clear $PKG_NAME >/dev/null 2>&1
pm uninstall $PKG_NAME >/dev/null 2>&1
pm install -r $MZ >/dev/null 2>&1
PKG_PATH=$(pm path $PKG_NAME)
PKG_PATH=${PKG_PATH%/*}
PKG_PATH=${PKG_PATH#*:}
cp -Rf $PKG_PATH/lib $BASEDIR/
pm clear $PKG_NAME >/dev/null 2>&1
pm uninstall $PKG_NAME >/dev/null 2>&1
CopyBusyBox
DownLoadFile $DLL_URL $DLL_SCRIPT
}
ExtractBusyboxFromScript() {
local BBSCR=$BASEDIR/bbscript.sh
local bblineoffset=""
@@ -754,8 +787,8 @@ ExtractBusyboxFromScript() {
$($BB >/dev/null 2>&1)
if [[ ! "$?" == "0" ]]; then
echo "[!] There is no busybox behind the script"
echo "[!] Run rootAVD with UpdateBusyBoxScript first"
exit 0
#echo "[!] Run rootAVD with UpdateBusyBoxScript first"
DownloadUptoDateSript
fi
}
@@ -794,6 +827,18 @@ UpdateBusyBoxToScript() {
#sed -i "$((bblineoffset+1))","$last_line"'d' $BBSCR
}
CopyBusyBox() {
chmod -R 755 $BASEDIR/lib
cp -f $BASEDIR/lib/$ABI/libbusybox.so $BB >/dev/null 2>&1
$BB >/dev/null 2>&1 || cp -f $BASEDIR/lib/$ARCH32/libbusybox.so $BB >/dev/null 2>&1
}
MoveBusyBox() {
chmod -R 755 $BASEDIR/lib
mv -f $BASEDIR/lib/$ABI/libbusybox.so $BB >/dev/null 2>&1
$BB >/dev/null 2>&1 || mv -f $BASEDIR/lib/$ARCH32/libbusybox.so $BB >/dev/null 2>&1
}
PrepBusyBoxAndMagisk() {
echo "[-] Switch to the location of the script file"
BASEDIR="`getdir "${BASH_SOURCE:-$0}"`"
@@ -821,11 +866,9 @@ PrepBusyBoxAndMagisk() {
echo "[*] Extracting Magisk.zip ..."
$BB unzip $MZ -oq
fi
MoveBusyBox
chmod -R 755 $BASEDIR/lib
mv -f $BASEDIR/lib/$ABI/libbusybox.so $BB >/dev/null 2>&1
$BB >/dev/null 2>&1 || mv -f $BASEDIR/lib/$ARCH32/libbusybox.so $BB >/dev/null 2>&1
$BB >/dev/null 2>&1 || ExtractBusyboxFromScript
chmod -R 755 $BASEDIR