diff --git a/README.md b/README.md index bc96f91..b3aec5f 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ 5. Move the newly extracted folder to a suitable location (Documents folder is a good choice), as you will need to keep the folder on your PC to use MagiskOnWSA > Note: If you're updating WSA, merge the folders and replace the files for all items when asked -6. Open the WSA folder and right-click `Install.ps1`, then select `Run with PowerShell` +6. Open the WSA folder and double-click `Run.bat` 7. Once the installation process completes, WSA will launch (if this is a first-time install, a window asking for consent to diagnositic information will be shown instead. Sometimes two identical windows will show, this is fine and nothing bad happens if you click OK in both windows) 8. Click on the PowerShell window, then press any key on the keyboard, the PowerShell window should close 9. Close File Explorer @@ -58,7 +58,7 @@ Can I pass SafetyNet/Play Integrity? What is virtualization? -- Virtualization is required to run virtual machines like WSA. `Install.ps1` helps you enable it. After rebooting, re-run `Install.ps1` to install WSA. If it's still not working, you have to enable virtualization in your BIOS/UEFI. Instructions vary by PC vendor, look for help online +- Virtualization is required to run virtual machines like WSA. `Run.bat` helps you enable it. After rebooting, re-run `Run.bat` to install WSA. If it's still not working, you have to enable virtualization in your BIOS/UEFI. Instructions vary by PC vendor, look for help online Can I remount system partition as read-write? diff --git a/scripts/build.sh b/scripts/build.sh index 7db0b89..48bc2e8 100644 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -275,6 +275,12 @@ if [ "$DEBUG" ]; then set -x fi +require_su() { + if [ "$(sudo whoami)" != "root" ]; then + sudo echo "sudo is required to run this script" + fi +} + declare -A RELEASE_NAME_MAP=(["retail"]="Retail" ["RP"]="Release Preview" ["WIS"]="Insider Slow" ["WIF"]="Insider Fast") RELEASE_NAME=${RELEASE_NAME_MAP[$RELEASE_TYPE]} || abort @@ -295,11 +301,10 @@ if [ "$GAPPS_BRAND" = "OpenGApps" ]; then else GAPPS_PATH="$DOWNLOAD_DIR"/MindTheGapps-"$ARCH".zip fi -if [ "$(sudo whoami)" != "root" ]; then - sudo echo "sudo is required to run this script" -fi + if [ -z "${OFFLINE+x}" ]; then trap 'rm -f -- "${DOWNLOAD_DIR:?}/${DOWNLOAD_CONF_NAME}"' EXIT + require_su echo "Generate Download Links" python3 generateWSALinks.py "$ARCH" "$RELEASE_TYPE" "$DOWNLOAD_DIR" "$DOWNLOAD_CONF_NAME" || abort if [ -z "${CUSTOM_MAGISK+x}" ]; then @@ -332,12 +337,14 @@ else echo "Offline mode: Some files are missing, please disable offline mode." exit 1 fi + require_su fi echo "Extract WSA" if [ -f "$WSA_ZIP_PATH" ]; then WSA_WORK_ENV="${WORK_DIR:?}"/ENV if [ -f "$WSA_WORK_ENV" ]; then rm -f "${WSA_WORK_ENV:?}"; fi + touch "$WSA_WORK_ENV" export WSA_WORK_ENV if ! python3 extractWSA.py "$ARCH" "$WSA_ZIP_PATH" "$WORK_DIR"; then echo "Unzip WSA failed, is the download incomplete?" @@ -351,8 +358,8 @@ else echo "The WSA zip package does not exist, is the download incomplete?" exit 1 fi -echo "Extract Magisk" +echo "Extract Magisk" if [ -f "$MAGISK_PATH" ]; then if ! python3 extractMagisk.py "$ARCH" "$MAGISK_PATH" "$WORK_DIR"; then echo "Unzip Magisk failed, is the download incomplete?" @@ -658,7 +665,7 @@ sudo rm -rf "${WORK_DIR:?}"/wsa/"$ARCH"/\[Content_Types\].xml "$WORK_DIR"/wsa/"$ cp "$vclibs_PATH" "$xaml_PATH" "$WORK_DIR"/wsa/"$ARCH" || abort tee "$WORK_DIR"/wsa/"$ARCH"/Install.ps1 <