mirror of
https://gitlab.com/newbit/rootAVD.git
synced 2026-07-03 13:15:10 +02:00
Added ListAllAVDs and InstallApps as Arguments
This commit is contained in:
@@ -107,6 +107,15 @@ Command Examples:
|
||||
* The Time Window is between the **Launching Emulator Bar** is approx **half way** until the **Google Boot Screen** appears
|
||||
* Confirmation
|
||||
* On the Bottom Left Corner reads: **Safe mode**
|
||||
|
||||
### Automotive Notes
|
||||
* After patching the ramdisk.img and cycle power, switch to user 0 via `adb shell am switch-user 0`
|
||||
* open the Magisk App and the **Requires Additional Setup** pops up -> reboot AVD
|
||||
* switch again to user 0
|
||||
* open the Magisk App -> Settings -> Multiuser Mode -> **User-Independent** -> reboot AVD
|
||||
* Every time you want to Grant Su Permissions, switch to user 0 and then back to 10 `adb shell am switch-user 10`
|
||||
* Alternative, you can install the Module [magisk-single-user](https://github.com/seebz/magisk-single-user)
|
||||
* and remove all user higher than 0 i.e. `pm remove-user 13` or `pm remove-user 10`
|
||||
|
||||
### Links
|
||||
* [XDA [GUIDE] Build / Mod AVD Kernel Android 10 / 11 rootAVD [Magisk] [USB passthrough Linux] [Google Play Store API]](https://forum.xda-developers.com/t/guide-build-mod-avd-kernel-android10-x86_64-29-root-magisk-usb-passthrough-linux.4212719)
|
||||
@@ -117,6 +126,7 @@ Command Examples:
|
||||
* [[GUIDE][Build|Mod|Update][kernel-ranchu][goldfish][5.4][5.10][GKI][ramdisk.img][modules][rootAVD][Android 11(R) 12(S)][AVD][Google Play Store API]](https://forum.xda-developers.com/t/guide-build-mod-update-kernel-ranchu-goldfish-5-4-5-10-gki-ramdisk-img-modules-rootavd-android-11-r-12-s-avd-google-play-store-api.4220697)
|
||||
|
||||
### Magisk v22.1+ Successfully tested with Stock Kernel on
|
||||
* [[May. 2021] - Android 10 (Q) API 29 Google Apis Play Store x86 r01 Darwin/MacOS Production Build](https://dl.google.com/android/repository/sys-img/android-automotive/x86-29_r01.zip)
|
||||
* [[Apr. 2021] - Android 12 (S) API 30 Google Apis Play Store x86_64 r03 Windows Production Build](https://dl.google.com/android/repository/sys-img/google_apis_playstore/x86_64-S_r03-windows.zip)
|
||||
* [[Apr. 2021] - Android 12 (S) API 30 Google Apis Play Store x86_64 r03 Darwin/MacOS Production Build](https://dl.google.com/android/repository/sys-img/google_apis_playstore/x86_64-S_r03-darwin.zip)
|
||||
* [[Mar. 2021] - Android 12 (S) API 30 Google Apis Play Store x86_64 r02 Darwin/MacOS Production Build](https://dl.google.com/android/repository/sys-img/google_apis_playstore/x86_64-S_r02-darwin.zip)
|
||||
@@ -131,6 +141,8 @@ Command Examples:
|
||||
|
||||
### Change Logs
|
||||
#### [May 2021]
|
||||
* [rootAVD.sh] - Added "ListAllAVDs" Argument that **Lists Command Examples for ALL installed AVDs**
|
||||
* [rootAVD.sh] - Added "InstallApps" Argument to **Just install all APKs placed in the Apps folder**
|
||||
* [rootAVD.bat] - Added comprehensive Help Menu
|
||||
|
||||
<details>
|
||||
@@ -183,3 +195,4 @@ Command Examples:
|
||||
* [shakalaca MagiskOnEmulator](https://github.com/shakalaca/MagiskOnEmulator)
|
||||
* [Akianonymus _json_value](https://gist.github.com/cjus/1047794#gistcomment-3313785)
|
||||
* [Tad Fisher Android Nixpkgs](https://github.com/tadfisher/android-nixpkgs)
|
||||
* [Sébastien Corne magisk-single-user](https://github.com/seebz)
|
||||
|
||||
+64
-26
@@ -214,7 +214,7 @@ checkfile() {
|
||||
# If all is done well so far, you can install some APK's to the AVD
|
||||
# every APK file in the Apps DIR will be (re)installed
|
||||
# Like magisk.apk etc.
|
||||
installapps() {
|
||||
install_apps() {
|
||||
APPS="Apps/*"
|
||||
echo "[-] Install all APKs placed in the Apps folder"
|
||||
FILES=$APPS
|
||||
@@ -334,18 +334,23 @@ CopyMagiskToAVD() {
|
||||
# The Folder where the script was called from
|
||||
ROOTAVD="`getdir "${BASH_SOURCE:-$0}"`"
|
||||
MAGISKZIP=$ROOTAVD/Magisk.zip
|
||||
|
||||
|
||||
# change to ROOTAVD directory
|
||||
cd $ROOTAVD
|
||||
|
||||
# Kernel Names
|
||||
BZFILE=$ROOTAVD/bzImage
|
||||
KRFILE=kernel-ranchu
|
||||
|
||||
if ( "$InstallApps" ); then
|
||||
install_apps
|
||||
exit
|
||||
fi
|
||||
|
||||
ADBWORKDIR=/data/data/com.android.shell
|
||||
ADBBASEDIR=$ADBWORKDIR/Magisk
|
||||
echo "[-] In any AVD via ADB, you can execute code without root in $ADBWORKDIR"
|
||||
|
||||
# change to ROOTAVD directory
|
||||
cd $ROOTAVD
|
||||
|
||||
# Download the Magisk apk/zip file -> Magisk-v22.0
|
||||
MAGISKZIPDL=https://github.com/topjohnwu/Magisk/releases/download/v22.0/Magisk-v22.0.apk
|
||||
# If Magisk.zip file already exist, don't download it again
|
||||
@@ -418,7 +423,7 @@ CopyMagiskToAVD() {
|
||||
echo "[-] Clean up the ADB working space"
|
||||
adb shell rm -rf $ADBBASEDIR
|
||||
|
||||
installapps
|
||||
install_apps
|
||||
|
||||
echo "[-] Shut-Down & Reboot the AVD and see if it worked"
|
||||
echo "[-] Root and Su with Magisk for Android Studio AVDs"
|
||||
@@ -1061,21 +1066,36 @@ FindSystemImages() {
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
cd $HOME > /dev/null
|
||||
for SI in $(find $SYSIM_DIR -type f -iname ramdisk.img); do
|
||||
SYSIM_EX="~/$SI"
|
||||
done
|
||||
cd - > /dev/null
|
||||
|
||||
echo "${bold}./rootAVD.sh $SYSIM_EX${normal}"
|
||||
if [[ ! $SYSIM_EX == "" ]]; then
|
||||
echo "${bold}./rootAVD.sh $SYSIM_EX DEBUG PATCHFSTAB GetUSBHPmodZ${normal}"
|
||||
echo "${bold}./rootAVD.sh EnvFixTask${normal}"
|
||||
echo "${bold}./rootAVD.sh $SYSIM_EX restore${normal}"
|
||||
echo "${bold}./rootAVD.sh $SYSIM_EX InstallKernelModules${normal}"
|
||||
echo "${bold}./rootAVD.sh $SYSIM_EX InstallPrebuiltKernelModules${normal}"
|
||||
echo "${bold}./rootAVD.sh $SYSIM_EX InstallPrebuiltKernelModules GetUSBHPmodZ PATCHFSTAB DEBUG${normal}"
|
||||
fi
|
||||
|
||||
|
||||
cd $HOME > /dev/null
|
||||
for SI in $(find -s $SYSIM_DIR -type f -iname ramdisk.img); do
|
||||
if ( "$ListAllAVDs" ); then
|
||||
SYSIM_EX+=" ~/$SI"
|
||||
else
|
||||
SYSIM_EX="~/$SI"
|
||||
fi
|
||||
done
|
||||
cd - > /dev/null
|
||||
|
||||
echo "${bold}./rootAVD.sh${normal}"
|
||||
echo "${bold}./rootAVD.sh ListAllAVDs${normal}"
|
||||
echo "${bold}./rootAVD.sh EnvFixTask${normal}"
|
||||
echo "${bold}./rootAVD.sh InstallApps${normal}"
|
||||
echo ""
|
||||
|
||||
for SYSIM in $SYSIM_EX;do
|
||||
if [[ ! $SYSIM == "" ]]; then
|
||||
echo "${bold}./rootAVD.sh $SYSIM${normal}"
|
||||
echo "${bold}./rootAVD.sh $SYSIM DEBUG PATCHFSTAB GetUSBHPmodZ${normal}"
|
||||
echo "${bold}./rootAVD.sh $SYSIM restore${normal}"
|
||||
echo "${bold}./rootAVD.sh $SYSIM InstallKernelModules${normal}"
|
||||
echo "${bold}./rootAVD.sh $SYSIM InstallPrebuiltKernelModules${normal}"
|
||||
echo "${bold}./rootAVD.sh $SYSIM InstallPrebuiltKernelModules GetUSBHPmodZ PATCHFSTAB DEBUG${normal}"
|
||||
echo ""
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
ShowHelpText() {
|
||||
@@ -1084,16 +1104,21 @@ normal=$(tput sgr0)
|
||||
echo "${bold}rootAVD A Script to root AVD by NewBit XDA${normal}"
|
||||
echo ""
|
||||
echo "Usage: ${bold}rootAVD [DIR/ramdisk.img] [OPTIONS] | [EXTRA_CMDS]${normal}"
|
||||
echo "or: ${bold}rootAVD EnvFixTask${normal}"
|
||||
echo "or: ${bold}rootAVD [ARGUMENTS]${normal}"
|
||||
echo ""
|
||||
echo "Requires Additional Setup fix:"
|
||||
echo " ${bold}EnvFixTask${normal} construct Magisk Environment manual"
|
||||
echo "Arguments:"
|
||||
echo " ${bold}ListAllAVDs${normal} Lists Command Examples for ALL installed AVDs"
|
||||
echo ""
|
||||
echo " ${bold}EnvFixTask${normal} Requires Additional Setup fix"
|
||||
echo " - construct Magisk Environment manual"
|
||||
echo " - only works with an already Magisk patched ramdisk.img"
|
||||
echo " - without [DIR/ramdisk.img] [OPTIONS] [PATCHFSTAB]"
|
||||
echo " - needed since Android 12 (S) rev.1"
|
||||
echo " - Grant Shell Su Permissions will pop up a few times"
|
||||
echo " - the AVD will reboot automatically"
|
||||
echo " "
|
||||
echo ""
|
||||
echo " ${bold}InstallApps${normal} Just install all APKs placed in the Apps folder"
|
||||
echo ""
|
||||
echo "Main operation mode:"
|
||||
echo " ${bold}DIR${normal} a path to an AVD system-image"
|
||||
echo " - must always be the ${bold}1st${normal} Argument after rootAVD"
|
||||
@@ -1146,7 +1171,6 @@ echo "- install all APKs placed in the Apps folder"
|
||||
echo " "
|
||||
echo "${bold}Command Examples:${normal}"
|
||||
FindSystemImages
|
||||
echo " "
|
||||
exit
|
||||
}
|
||||
|
||||
@@ -1159,6 +1183,8 @@ ProcessArguments() {
|
||||
restore=false
|
||||
InstallKernelModules=false
|
||||
InstallPrebuiltKernelModules=false
|
||||
ListAllAVDs=false
|
||||
InstallApps=false
|
||||
|
||||
# While debugging and developing you can turn this flag on
|
||||
if [[ "$@" == *"DEBUG"* ]]; then
|
||||
@@ -1177,6 +1203,16 @@ ProcessArguments() {
|
||||
GetUSBHPmodZ=true
|
||||
fi
|
||||
|
||||
# Call rootAVD with ListAllAVDs to show all AVDs with command examples
|
||||
if [[ "$@" == *"ListAllAVDs"* ]]; then
|
||||
ListAllAVDs=true
|
||||
fi
|
||||
|
||||
# Call rootAVD with InstallApps to just install all APKs placed in the Apps folder
|
||||
if [[ "$@" == *"InstallApps"* ]]; then
|
||||
InstallApps=true
|
||||
fi
|
||||
|
||||
case $1 in
|
||||
"EnvFixTask" ) # AVD requires additional setup
|
||||
ENVFIXTASK=true
|
||||
@@ -1209,6 +1245,8 @@ ProcessArguments() {
|
||||
export restore
|
||||
export InstallKernelModules
|
||||
export InstallPrebuiltKernelModules
|
||||
export ListAllAVDs
|
||||
export InstallApps
|
||||
}
|
||||
|
||||
# Script Entry Point
|
||||
@@ -1232,7 +1270,7 @@ if ( "$DEBUG" ); then
|
||||
echo "[!] We are in Debug Mode"
|
||||
fi
|
||||
|
||||
if ( ! "$ENVFIXTASK" ); then
|
||||
if ( ! "$ENVFIXTASK" && ! "$InstallApps"); then
|
||||
# If there is no file to work with, abort the script
|
||||
if (checkfile "$1" -eq 0); then
|
||||
ShowHelpText
|
||||
|
||||
Reference in New Issue
Block a user