mirror of
https://github.com/MustardChef/WSABuilds.git
synced 2024-11-14 15:45:06 +01:00
Merge branch 'main' of https://github.com/LSPosed/MagiskOnWSALocal
This commit is contained in:
commit
bde50303cd
115
.github/workflows/build.yaml
vendored
115
.github/workflows/build.yaml
vendored
@ -9,7 +9,7 @@ on:
|
|||||||
type: choice
|
type: choice
|
||||||
options:
|
options:
|
||||||
- x86_64
|
- x86_64
|
||||||
- AArch64
|
- ARM64
|
||||||
release_type:
|
release_type:
|
||||||
description: "WSA Release Channel"
|
description: "WSA Release Channel"
|
||||||
required: true
|
required: true
|
||||||
@ -31,7 +31,7 @@ on:
|
|||||||
- Beta
|
- Beta
|
||||||
- Canary
|
- Canary
|
||||||
- Debug
|
- Debug
|
||||||
- Custom (URL)
|
- Custom
|
||||||
magisk_url:
|
magisk_url:
|
||||||
description: "Custom Magisk APK/ZIP URL"
|
description: "Custom Magisk APK/ZIP URL"
|
||||||
required: false
|
required: false
|
||||||
@ -43,11 +43,12 @@ on:
|
|||||||
type: choice
|
type: choice
|
||||||
options:
|
options:
|
||||||
- None
|
- None
|
||||||
- Pico
|
- Pico (OpenGApps)
|
||||||
- Full
|
- Full (OpenGApps)
|
||||||
- MindTheGapps (URL)
|
- Custom (OpenGApps)
|
||||||
mindthegapps_url:
|
- Custom (MindTheGapps)
|
||||||
description: "MindTheGapps ZIP URL"
|
gapps_url:
|
||||||
|
description: "Custom GApps ZIP URL"
|
||||||
required: false
|
required: false
|
||||||
type: string
|
type: string
|
||||||
remove_amazon:
|
remove_amazon:
|
||||||
@ -55,11 +56,6 @@ on:
|
|||||||
required: false
|
required: false
|
||||||
default: true
|
default: true
|
||||||
type: boolean
|
type: boolean
|
||||||
offline_mode:
|
|
||||||
description: "Offline Mode"
|
|
||||||
required: false
|
|
||||||
default: false
|
|
||||||
type: boolean
|
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
@ -83,7 +79,7 @@ jobs:
|
|||||||
DOWNLOAD_DIR=../download
|
DOWNLOAD_DIR=../download
|
||||||
DOWNLOAD_CONF_NAME=download.list
|
DOWNLOAD_CONF_NAME=download.list
|
||||||
|
|
||||||
declare -A opts=( ["ARCH,x86_64"]="x64" ["ARCH,AArch64"]="arm64" ["RELEASE_TYPE,General Availability Channel"]="retail" ["RELEASE_TYPE,Release Preview Channel"]="RP" ["RELEASE_TYPE,Beta Channel"]="WIS" ["RELEASE_TYPE,Dev Channel"]="WIF" ["MAGISK_VER,Stable"]="stable" ["MAGISK_VER,Beta"]="beta" ["MAGISK_VER,Canary"]="canary" ["MAGISK_VER,Debug"]="debug" ["GAPPS_VAR,None"]="none" ["GAPPS_VAR,Pico"]="pico" ["GAPPS_VAR,Full"]="full" ["GAPPS_VAR,MindTheGapps (URL)"]="MindTheGapps" ["REMOVE_AMAZON,true"]="--remove-amazon" ["REMOVE_AMAZON,false"]="" ["OFFLINE_MODE,true"]="--offline" ["OFFLINE_MODE,false"]="" )
|
declare -A opts=( ["ARCH,x86_64"]="x64" ["ARCH,ARM64"]="arm64" ["RELEASE_TYPE,General Availability Channel"]="retail" ["RELEASE_TYPE,Release Preview Channel"]="RP" ["RELEASE_TYPE,Beta Channel"]="WIS" ["RELEASE_TYPE,Dev Channel"]="WIF" ["MAGISK_VER,Stable"]="stable" ["MAGISK_VER,Beta"]="beta" ["MAGISK_VER,Canary"]="canary" ["MAGISK_VER,Debug"]="debug" ["MAGISK_VER,Custom"]="--magisk-custom" ["GAPPS_VAR,None"]="none" ["GAPPS_VAR,Pico (OpenGApps)"]="pico" ["GAPPS_VAR,Full (OpenGApps)"]="full" ["REMOVE_AMAZON,true"]="--remove-amazon" ["REMOVE_AMAZON,false"]="" )
|
||||||
|
|
||||||
ARCH="${opts[ARCH,${{ inputs.arch }}]}"
|
ARCH="${opts[ARCH,${{ inputs.arch }}]}"
|
||||||
|
|
||||||
@ -91,16 +87,16 @@ jobs:
|
|||||||
|
|
||||||
if [ "${{inputs.magisk_ver }}" != "None" ]; then
|
if [ "${{inputs.magisk_ver }}" != "None" ]; then
|
||||||
ROOT_SOL="magisk"
|
ROOT_SOL="magisk"
|
||||||
if [ "${{ inputs.magisk_ver }}" != "Custom (URL)" ]; then
|
if [ "${{ inputs.magisk_ver }}" != "Custom" ]; then
|
||||||
MAGISK_VER="${opts[MAGISK_VER,${{ inputs.magisk_ver }}]}"
|
MAGISK_VER="${opts[MAGISK_VER,${{ inputs.magisk_ver }}]}"
|
||||||
else
|
else
|
||||||
echo "${{ inputs.magisk_url }}" > "$DOWNLOAD_DIR"/"$DOWNLOAD_CONF_NAME"
|
echo "${{ inputs.magisk_url }}" > "$DOWNLOAD_DIR"/"$DOWNLOAD_CONF_NAME"
|
||||||
|
|
||||||
if ! aria2c --no-conf --log-level=info --log="$DOWNLOAD_DIR/aria2_custom_magisk_download.log" -R --allow-overwrite -d"$DOWNLOAD_DIR" -o magisk-debug.zip -i"$DOWNLOAD_DIR"/"$DOWNLOAD_CONF_NAME"; then
|
if ! aria2c --no-conf --log-level=info --log="$DOWNLOAD_DIR/aria2_custom_magisk_download.log" -x16 -s16 -j5 -c -R -m0 --async-dns=false --check-integrity --continue --allow-overwrite --conditional-get -d"$DOWNLOAD_DIR" -o magisk-debug.zip -i"$DOWNLOAD_DIR"/"$DOWNLOAD_CONF_NAME"; then
|
||||||
echo "Custom Magisk download error!"
|
echo "Magisk download error!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
CUSTOM_MAGISK="1"
|
CUSTOM_MAGISK="${opts[MAGISK_VER,Custom]}"
|
||||||
MAGISK_VER="${opts[MAGISK_VER,Debug]}"
|
MAGISK_VER="${opts[MAGISK_VER,Debug]}"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
@ -108,25 +104,73 @@ jobs:
|
|||||||
MAGISK_VER="${opts[MAGISK_VER,Stable]}"
|
MAGISK_VER="${opts[MAGISK_VER,Stable]}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$ARCH" != "arm64" ]; then
|
if [ "$ARCH" == "x86_64" ]; then
|
||||||
GAPPS_VAR="${opts[GAPPS_VAR,${{ inputs.gapps_var }}]}"
|
GAPPS_VAR="${opts[GAPPS_VAR,${{ inputs.gapps_var }}]}"
|
||||||
else
|
else
|
||||||
# TODO: keep it 11.0 since official opengapps does not support 12+ yet
|
# TODO: keep it 11.0 since official opengapps does not support 12+ yet
|
||||||
# As soon as opengapps is available for 12+, we need to get the sdk/release from build.prop and download the corresponding version
|
# As soon as opengapps is available for 12+, we need to get the sdk/release from build.prop and download the corresponding version
|
||||||
if [ "${{ inputs.gapps_var }}" == "Full" ]; then
|
if [ "${{ inputs.gapps_var }}" == "Full (OpenGApps)" ]; then
|
||||||
GAPPS_VAR="pico"
|
GAPPS_VAR="${opts[GAPPS_VAR,Pico (OpenGApps)]}"
|
||||||
else
|
else
|
||||||
GAPPS_VAR="${opts[GAPPS_VAR,${{ inputs.gapps_var }}]}"
|
GAPPS_VAR="${opts[GAPPS_VAR,${{ inputs.gapps_var }}]}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${{inputs.gapps_var }}" != "None" ]; then
|
if [ "${{inputs.gapps_var }}" != "None" ]; then
|
||||||
if [ "${{ inputs.gapps_var }}" != "MindTheGapps (URL)" ]; then
|
if [ "${{ inputs.gapps_var }}" != "Custom (MindTheGapps)" ]; then
|
||||||
GAPPS_BRAND="OpenGApps"
|
GAPPS_BRAND="OpenGApps"
|
||||||
else
|
if [ "${{ inputs.gapps_var }}" == "Custom (OpenGApps)" ]; then
|
||||||
echo "${{ inputs.mindthegapps_url }}" > -i"$DOWNLOAD_DIR"/"$DOWNLOAD_CONF_NAME"
|
if [ -z "${${{ inputs.gapps_url }}+x}" ]; then
|
||||||
|
GAPPS_VARIANT_MAP=(
|
||||||
|
"super"
|
||||||
|
"stock"
|
||||||
|
"full"
|
||||||
|
"mini"
|
||||||
|
"micro"
|
||||||
|
"nano"
|
||||||
|
"pico"
|
||||||
|
"tvstock"
|
||||||
|
"tvmini"
|
||||||
|
)
|
||||||
|
|
||||||
if ! aria2c --no-conf --log-level=info --log="$DOWNLOAD_DIR/aria2_mindthegapps_download.log" -R --allow-overwrite -d"$DOWNLOAD_DIR" -o MindTheGapps-"$ARCH".zip -i"$DOWNLOAD_DIR"/"$DOWNLOAD_CONF_NAME"; then
|
for file in "$DOWNLOAD_DIR"/OpenGApps-"$ARCH"-*.zip; do
|
||||||
|
GAPPS_VAR=${file%%\.*}
|
||||||
|
GAPPS_VAR=${GAPPS_VAR##*-}
|
||||||
|
list_count=${#GAPPS_VARIANT_MAP[@]}
|
||||||
|
for i in "${GAPPS_VARIANT_MAP[@]}"; do
|
||||||
|
if [ "$GAPPS_VAR" == "$i" ]; then
|
||||||
|
echo "INFO: GApps Variant: $GAPPS_VAR"
|
||||||
|
valid_gapps_var="true"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
((list_count--))
|
||||||
|
if (("$list_count" <= 0)); then
|
||||||
|
echo "Invalid GApps Variant: $GAPPS_VAR"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if [[ "$valid_gapps_var" == "true" ]]; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if [[ "$valid_gapps_var" != "true" ]]; then
|
||||||
|
echo "Missing OpenGApps file!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "opengapps_var=${GAPPS_VAR^}" >> $GITHUB_ENV
|
||||||
|
else
|
||||||
|
GAPPS_VAR="pico"
|
||||||
|
echo "${{ inputs.gapps_url }}" > -i"$DOWNLOAD_DIR"/"$DOWNLOAD_CONF_NAME"
|
||||||
|
if ! aria2c --no-conf --log-level=info --log="$DOWNLOAD_DIR/aria2_gapps_download.log" -x16 -s16 -j5 -c -R -m0 --async-dns=false --check-integrity --continue --allow-overwrite --conditional-get -d"$DOWNLOAD_DIR" -o OpenGApps-"$ARCH"-"$GAPPS_VAR".zip -i"$DOWNLOAD_DIR"/"$DOWNLOAD_CONF_NAME"; then
|
||||||
|
echo "OpenGApps download error!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "opengapps_var=custom" >> $GITHUB_ENV
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "${{ inputs.gapps_url }}" > -i"$DOWNLOAD_DIR"/"$DOWNLOAD_CONF_NAME"
|
||||||
|
|
||||||
|
if ! aria2c --no-conf --log-level=info --log="$DOWNLOAD_DIR/aria2_gapps_download.log" -x16 -s16 -j5 -c -R -m0 --async-dns=false --check-integrity --continue --allow-overwrite --conditional-get -d"$DOWNLOAD_DIR" -o MindTheGapps-"$ARCH".zip -i"$DOWNLOAD_DIR"/"$DOWNLOAD_CONF_NAME"; then
|
||||||
echo "MindTheGapps download error!"
|
echo "MindTheGapps download error!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@ -138,9 +182,22 @@ jobs:
|
|||||||
|
|
||||||
REMOVE_AMAZON="${opts[REMOVE_AMAZON,${{ inputs.remove_amazon }}]}"
|
REMOVE_AMAZON="${opts[REMOVE_AMAZON,${{ inputs.remove_amazon }}]}"
|
||||||
|
|
||||||
OFFLINE_MODE="${opts[OFFLINE_MODE,${{ inputs.offline_mode }}]}"
|
if [ "${{ inputs.gapps_var }}" == "Custom (OpenGApps)" ]; then
|
||||||
|
echo "Generate Download Links"
|
||||||
|
python3 generateWSALinks.py "$ARCH" "$RELEASE_TYPE" "$DOWNLOAD_DIR" "$DOWNLOAD_CONF_NAME"
|
||||||
|
if [ "${{ inputs.magisk_ver }}" != "Custom" ]; then
|
||||||
|
python3 generateMagiskLink.py "$MAGISK_VER" "$DOWNLOAD_DIR" "$DOWNLOAD_CONF_NAME"
|
||||||
|
fi
|
||||||
|
|
||||||
COMMAND_LINE=(--arch "$ARCH" --release-type "$RELEASE_TYPE" --magisk-ver "$MAGISK_VER" --gapps-brand "$GAPPS_BRAND" --gapps-variant "$GAPPS_VAR" "$REMOVE_AMAZON" --root-sol "$ROOT_SOL" "$COMPRESS_OUTPUT" "$OFFLINE" "$DEBUG" "$CUSTOM_MAGISK")
|
echo "Download Artifacts"
|
||||||
|
if ! aria2c --no-conf --log-level=info --log="$DOWNLOAD_DIR/aria2_download.log" -x16 -s16 -j5 -c -R -m0 --async-dns=false --check-integrity --continue --allow-overwrite --conditional-get -d"$DOWNLOAD_DIR" -i"$DOWNLOAD_DIR"/"$DOWNLOAD_CONF_NAME"; then
|
||||||
|
echo "Artifact download error!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
OFFLINE="--offline"
|
||||||
|
fi
|
||||||
|
|
||||||
|
COMMAND_LINE=(--arch "$ARCH" --release-type "$RELEASE_TYPE" --magisk-ver "$MAGISK_VER" --gapps-brand "$GAPPS_BRAND" --gapps-variant "$GAPPS_VAR" "$REMOVE_AMAZON" --root-sol "$ROOT_SOL" "$CUSTOM_MAGISK" "$OFFLINE")
|
||||||
echo "COMMAND_LINE=${COMMAND_LINE[*]}"
|
echo "COMMAND_LINE=${COMMAND_LINE[*]}"
|
||||||
|
|
||||||
chmod +x ./build.sh
|
chmod +x ./build.sh
|
||||||
@ -152,7 +209,7 @@ jobs:
|
|||||||
|
|
||||||
if [[ "${{ inputs.magisk_ver }}" == "None" ]]; then
|
if [[ "${{ inputs.magisk_ver }}" == "None" ]]; then
|
||||||
magiskVer=""
|
magiskVer=""
|
||||||
elif [[ "${{ inputs.magisk_ver }}" == "Custom (URL)" ]]; then
|
elif [[ "${{ inputs.magisk_ver }}" == "Custom" ]]; then
|
||||||
magiskVer="_Magisk-Custom"
|
magiskVer="_Magisk-Custom"
|
||||||
else
|
else
|
||||||
magiskVer="_Magisk-$(curl -s https://raw.githubusercontent.com/topjohnwu/magisk-files/master/${magisk_vers[${{ inputs.magisk_ver }}]}.json | jq -r ".magisk.version")"
|
magiskVer="_Magisk-$(curl -s https://raw.githubusercontent.com/topjohnwu/magisk-files/master/${magisk_vers[${{ inputs.magisk_ver }}]}.json | jq -r ".magisk.version")"
|
||||||
@ -160,8 +217,10 @@ jobs:
|
|||||||
|
|
||||||
if [[ "${{ inputs.gapps_var }}" == "None" ]]; then
|
if [[ "${{ inputs.gapps_var }}" == "None" ]]; then
|
||||||
gappsVar=""
|
gappsVar=""
|
||||||
elif [[ "${{ inputs.gapps_var }}" == "MindTheGapps (URL)" ]]; then
|
elif [[ "${{ inputs.gapps_var }}" == "Custom (MindTheGapps)" ]]; then
|
||||||
gappsVar="_MindTheGapps"
|
gappsVar="_MindTheGapps"
|
||||||
|
elif [[ "${{ inputs.gapps_var }}" == "Custom (OpenGApps)" ]]; then
|
||||||
|
gappsVar="_${{ env.opengapps_var }}-OpenGApps"
|
||||||
else
|
else
|
||||||
gappsVar="_${{ inputs.gapps_var }}-OpenGApps"
|
gappsVar="_${{ inputs.gapps_var }}-OpenGApps"
|
||||||
fi
|
fi
|
||||||
|
28
README.md
28
README.md
@ -42,7 +42,7 @@
|
|||||||
|
|
||||||
## Help
|
## Help
|
||||||
|
|
||||||
How can I get a logcat?
|
How do I get a logcat?
|
||||||
|
|
||||||
- `adb logcat`
|
- `adb logcat`
|
||||||
|
|
||||||
@ -50,7 +50,7 @@ or
|
|||||||
|
|
||||||
- `%LOCALAPPDATA%\Packages\MicrosoftCorporationII.WindowsSubsystemForAndroid_8wekyb3d8bbwe\LocalState\diagnostics\logcat`
|
- `%LOCALAPPDATA%\Packages\MicrosoftCorporationII.WindowsSubsystemForAndroid_8wekyb3d8bbwe\LocalState\diagnostics\logcat`
|
||||||
|
|
||||||
How can I update Magisk?
|
How do I update Magisk?
|
||||||
|
|
||||||
- Wait for a new MagiskOnWSA release that includes the newer Magisk version, then follow the [Installation instructions](#installation) to update
|
- Wait for a new MagiskOnWSA release that includes the newer Magisk version, then follow the [Installation instructions](#installation) to update
|
||||||
|
|
||||||
@ -58,7 +58,7 @@ Can I pass SafetyNet/Play Integrity?
|
|||||||
|
|
||||||
- No. Virtual machines like WSA cannot pass these mechanisms on their own due to the lack of signing by Google. Passing requires more exotic (and untested) solutions: <https://github.com/kdrag0n/safetynet-fix/discussions/145#discussioncomment-2170917>
|
- No. Virtual machines like WSA cannot pass these mechanisms on their own due to the lack of signing by Google. Passing requires more exotic (and untested) solutions: <https://github.com/kdrag0n/safetynet-fix/discussions/145#discussioncomment-2170917>
|
||||||
|
|
||||||
Virtualization?
|
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. `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
|
||||||
|
|
||||||
@ -66,10 +66,30 @@ Can I remount system partition as read-write?
|
|||||||
|
|
||||||
- No. WSA is mounted as read-only by Hyper-V. You can, however, modify the system partition by creating a Magisk module, or by directly modifying the system.img file
|
- No. WSA is mounted as read-only by Hyper-V. You can, however, modify the system partition by creating a Magisk module, or by directly modifying the system.img file
|
||||||
|
|
||||||
How can I uninstall Magisk?
|
How do I uninstall Magisk?
|
||||||
|
|
||||||
- Download a WSA version that doesn't include Magisk from the [Releases page](https://github.com/PeterNjeim/MagiskOnWSA/releases). Then follow the [Installation instructions](#installation)
|
- Download a WSA version that doesn't include Magisk from the [Releases page](https://github.com/PeterNjeim/MagiskOnWSA/releases). Then follow the [Installation instructions](#installation)
|
||||||
|
|
||||||
|
How do I install custom Magisk or GApps?
|
||||||
|
|
||||||
|
1. Fork this repository
|
||||||
|
2. **A)** Magisk
|
||||||
|
1. **a)** Via local file:
|
||||||
|
1. Create a folder named `download in the root
|
||||||
|
2. Move your custom Magisk APK/ZIP file to the `download` folder and rename it to `magisk-debug.zip`
|
||||||
|
2. In GitHub Actions, click on `Build MagiskOnWSA`
|
||||||
|
3. Choose `Custom` in the `Magisk Version` field
|
||||||
|
4. **b)** Via URL:
|
||||||
|
1. Input the URL pointing to your custom Magisk APK/ZIP file in the `Custom Magisk APK/ZIP URL` field
|
||||||
|
3. **B)** GApps
|
||||||
|
1. **a)** Via local file:
|
||||||
|
1. Create a folder named `download in the root
|
||||||
|
2. Move your custom OpenGApps or MindTheGapps ZIP file to the `download` folder and rename it to `OpenGApps-{arch}-{variant}.zip` or `MindTheGapps-{arch}.zip` *(e.g. `OpenGApps-x64-pico.zip` or `MindTheGapps-arm64.zip`)*
|
||||||
|
2. In GitHub Actions, click on `Build MagiskOnWSA`
|
||||||
|
3. Choose `Custom (OpenGApps)` or `Custom (MindTheGapps)` in the `GApps Variant` field
|
||||||
|
4. **b)** Via URL:
|
||||||
|
1. Input the URL pointing to your custom OpenGApps or MindTheGapps ZIP file in the `Custom GApps ZIP URL` field
|
||||||
|
|
||||||
## Credits
|
## Credits
|
||||||
|
|
||||||
- [StoreLib](https://github.com/StoreDev/StoreLib): API for downloading WSA
|
- [StoreLib](https://github.com/StoreDev/StoreLib): API for downloading WSA
|
||||||
|
189
scripts/build.sh
189
scripts/build.sh
@ -18,7 +18,7 @@
|
|||||||
# Copyright (C) 2022 LSPosed Contributors
|
# Copyright (C) 2022 LSPosed Contributors
|
||||||
#
|
#
|
||||||
|
|
||||||
if [ ! "$BASH_VERSION" ] ; then
|
if [ ! "$BASH_VERSION" ]; then
|
||||||
echo "Please do not use sh to run this script, just execute it directly" 1>&2
|
echo "Please do not use sh to run this script, just execute it directly" 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@ -34,7 +34,7 @@ DOWNLOAD_DIR=../download
|
|||||||
DOWNLOAD_CONF_NAME=download.list
|
DOWNLOAD_CONF_NAME=download.list
|
||||||
OUTPUT_DIR=../output
|
OUTPUT_DIR=../output
|
||||||
MOUNT_DIR="$WORK_DIR"/system
|
MOUNT_DIR="$WORK_DIR"/system
|
||||||
umount_clean(){
|
umount_clean() {
|
||||||
if [ -d "$MOUNT_DIR" ]; then
|
if [ -d "$MOUNT_DIR" ]; then
|
||||||
echo "Cleanup Work Directory"
|
echo "Cleanup Work Directory"
|
||||||
if [ -d "$MOUNT_DIR/vendor" ]; then
|
if [ -d "$MOUNT_DIR/vendor" ]; then
|
||||||
@ -52,7 +52,7 @@ umount_clean(){
|
|||||||
rm -rf "${WORK_DIR:?}"
|
rm -rf "${WORK_DIR:?}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
clean_download(){
|
clean_download() {
|
||||||
if [ -d "$DOWNLOAD_DIR" ]; then
|
if [ -d "$DOWNLOAD_DIR" ]; then
|
||||||
echo "Cleanup Download Directory"
|
echo "Cleanup Download Directory"
|
||||||
if [ "$CLEAN_DOWNLOAD_WSA" ]; then
|
if [ "$CLEAN_DOWNLOAD_WSA" ]; then
|
||||||
@ -80,8 +80,7 @@ function Gen_Rand_Str {
|
|||||||
head /dev/urandom | tr -dc A-Za-z0-9 | head -c"$1"
|
head /dev/urandom | tr -dc A-Za-z0-9 | head -c"$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default() {
|
||||||
default(){
|
|
||||||
ARCH=x64
|
ARCH=x64
|
||||||
RELEASE_TYPE=retail
|
RELEASE_TYPE=retail
|
||||||
MAGISK_VER=stable
|
MAGISK_VER=stable
|
||||||
@ -90,32 +89,108 @@ default(){
|
|||||||
ROOT_SOL=magisk
|
ROOT_SOL=magisk
|
||||||
}
|
}
|
||||||
|
|
||||||
exit_with_message(){
|
exit_with_message() {
|
||||||
echo "ERROR: $1"
|
echo "ERROR: $1"
|
||||||
usage
|
usage
|
||||||
abort
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
usage(){
|
ARCH_MAP=(
|
||||||
|
"x64"
|
||||||
|
"arm64"
|
||||||
|
)
|
||||||
|
|
||||||
|
RELEASE_TYPE_MAP=(
|
||||||
|
"retail"
|
||||||
|
"RP"
|
||||||
|
"WIS"
|
||||||
|
"WIF"
|
||||||
|
)
|
||||||
|
|
||||||
|
MAGISK_VER_MAP=(
|
||||||
|
"stable"
|
||||||
|
"beta"
|
||||||
|
"canary"
|
||||||
|
"debug"
|
||||||
|
)
|
||||||
|
|
||||||
|
GAPPS_BRAND_MAP=(
|
||||||
|
"OpenGApps"
|
||||||
|
"MindTheGapps"
|
||||||
|
"none"
|
||||||
|
)
|
||||||
|
|
||||||
|
GAPPS_VARIANT_MAP=(
|
||||||
|
"super"
|
||||||
|
"stock"
|
||||||
|
"full"
|
||||||
|
"mini"
|
||||||
|
"micro"
|
||||||
|
"nano"
|
||||||
|
"pico"
|
||||||
|
"tvstock"
|
||||||
|
"tvmini"
|
||||||
|
)
|
||||||
|
|
||||||
|
ROOT_SOL_MAP=(
|
||||||
|
"magisk"
|
||||||
|
"none"
|
||||||
|
)
|
||||||
|
ARR_TO_STR() {
|
||||||
|
local arr=("$@")
|
||||||
|
local joined
|
||||||
|
printf -v joined "%s, " "${arr[@]}"
|
||||||
|
echo "${joined%, }"
|
||||||
|
}
|
||||||
|
usage() {
|
||||||
default
|
default
|
||||||
echo "Usage:
|
echo "Usage:
|
||||||
--arch Architecture of WSA, x64 or arm64, default: $ARCH
|
--arch Architecture of WSA.
|
||||||
--release-type Release type of WSA, retail, RP (Release Preview), WIS (Insider Slow) or WIF (Insider Fast), default: $RELEASE_TYPE
|
|
||||||
--magisk-ver Magisk version, stable or canary, default: $MAGISK_VER
|
Possible values: $(ARR_TO_STR "${ARCH_MAP[@]}")
|
||||||
--gapps-brand GApps brand, OpenGApps or MindTheGApps, default: $GAPPS_BRAND
|
Default: $ARCH
|
||||||
--gapps-variant GApps variant, pico or full, etc...., default: $GAPPS_VARIANT
|
|
||||||
--root-sol Root solution, magisk or none, default: $ROOT_SOL
|
--release-type Release type of WSA.
|
||||||
--remove-amazon Remove Amazon from the system, default: false
|
RP means Release Preview, WIS means Insider Slow, WIF means Insider Fast.
|
||||||
--compress Compress the WSA, default: false
|
|
||||||
--offline Build WSA offline, default: false
|
Possible values: $(ARR_TO_STR "${RELEASE_TYPE_MAP[@]}")
|
||||||
--magisk-custom Install custom Magisk, default: false
|
Default: $RELEASE_TYPE
|
||||||
--debug Debug build mode, default: false
|
|
||||||
|
--magisk-ver Magisk version.
|
||||||
|
|
||||||
|
Possible values: $(ARR_TO_STR "${MAGISK_VER_MAP[@]}")
|
||||||
|
Default: $MAGISK_VER
|
||||||
|
|
||||||
|
--gapps-brand GApps brand.
|
||||||
|
\"none\" for no integration of GApps
|
||||||
|
|
||||||
|
Possible values: $(ARR_TO_STR "${GAPPS_BRAND_MAP[@]}")
|
||||||
|
Default: $GAPPS_BRAND
|
||||||
|
|
||||||
|
--gapps-variant GApps variant.
|
||||||
|
|
||||||
|
Possible values: $(ARR_TO_STR "${GAPPS_VARIANT_MAP[@]}")
|
||||||
|
Default: $GAPPS_VARIANT
|
||||||
|
|
||||||
|
--root-sol Root solution.
|
||||||
|
\"none\" means no root.
|
||||||
|
|
||||||
|
Possible values: $(ARR_TO_STR "${ROOT_SOL_MAP[@]}")
|
||||||
|
Default: $ROOT_SOL
|
||||||
|
|
||||||
|
Additional Options:
|
||||||
|
--remove-amazon Remove Amazon Appstore from the system
|
||||||
|
--compress Compress the WSA
|
||||||
|
--offline Build WSA offline
|
||||||
|
--magisk-custom Install custom Magisk
|
||||||
|
--debug Debug build mode
|
||||||
--help Show this help message and exit
|
--help Show this help message and exit
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
./build.sh --arch x64 --release-type retail --magisk-ver stable --gapps-brand OpenGApps --gapps-variant pico --remove-amazon
|
./build.sh --release-type RP --magisk-ver beta --gapps-variant pico --remove-amazon
|
||||||
./build.sh --arch x64 --release-type retail --remove-amazon --magisk-custom --offline
|
./build.sh --arch arm64 --release-type WIF --gapps-brand MindTheGapps
|
||||||
./build.sh --release-type RP
|
./build.sh --release-type WIS --gapps-brand none
|
||||||
|
./build.sh --offline --gapps-variant pico --magisk-custom
|
||||||
"
|
"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -136,7 +211,8 @@ ARGUMENT_LIST=(
|
|||||||
|
|
||||||
default
|
default
|
||||||
|
|
||||||
opts=$(getopt \
|
opts=$(
|
||||||
|
getopt \
|
||||||
--longoptions "$(printf "%s," "${ARGUMENT_LIST[@]}")" \
|
--longoptions "$(printf "%s," "${ARGUMENT_LIST[@]}")" \
|
||||||
--name "$(basename "$0")" \
|
--name "$(basename "$0")" \
|
||||||
--options "" \
|
--options "" \
|
||||||
@ -162,50 +238,7 @@ while [[ $# -gt 0 ]]; do
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
ARCH_MAP=(
|
check_list() {
|
||||||
"x64"
|
|
||||||
"arm64"
|
|
||||||
)
|
|
||||||
|
|
||||||
RELEASE_TYPE_MAP=(
|
|
||||||
"retail"
|
|
||||||
"RP"
|
|
||||||
"WIS"
|
|
||||||
"WIF"
|
|
||||||
)
|
|
||||||
|
|
||||||
MAGISK_VER_MAP=(
|
|
||||||
"stable"
|
|
||||||
"beta"
|
|
||||||
"canary"
|
|
||||||
"debug"
|
|
||||||
)
|
|
||||||
|
|
||||||
GAPPS_BRAND_MAP=(
|
|
||||||
"OpenGApps"
|
|
||||||
"MindTheGApps"
|
|
||||||
"none"
|
|
||||||
)
|
|
||||||
|
|
||||||
GAPPS_VARIANT_MAP=(
|
|
||||||
"super"
|
|
||||||
"stock"
|
|
||||||
"full"
|
|
||||||
"mini"
|
|
||||||
"micro"
|
|
||||||
"nano"
|
|
||||||
"pico"
|
|
||||||
"tvstock"
|
|
||||||
"tvmini"
|
|
||||||
"none"
|
|
||||||
)
|
|
||||||
|
|
||||||
ROOT_SOL_MAP=(
|
|
||||||
"magisk"
|
|
||||||
"none"
|
|
||||||
)
|
|
||||||
|
|
||||||
check_list(){
|
|
||||||
local input=$1
|
local input=$1
|
||||||
local name=$2
|
local name=$2
|
||||||
shift
|
shift
|
||||||
@ -217,7 +250,7 @@ check_list(){
|
|||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
((list_count--))
|
((list_count--))
|
||||||
if (( "$list_count" <= 0 )); then
|
if (("$list_count" <= 0)); then
|
||||||
exit_with_message "Invalid $name: $input"
|
exit_with_message "Invalid $name: $input"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@ -264,14 +297,12 @@ if [ -z "${OFFLINE+x}" ]; then
|
|||||||
if [ -z "${CUSTOM_MAGISK+x}" ]; then
|
if [ -z "${CUSTOM_MAGISK+x}" ]; then
|
||||||
python3 generateMagiskLink.py "$MAGISK_VER" "$DOWNLOAD_DIR" "$DOWNLOAD_CONF_NAME" || abort
|
python3 generateMagiskLink.py "$MAGISK_VER" "$DOWNLOAD_DIR" "$DOWNLOAD_CONF_NAME" || abort
|
||||||
fi
|
fi
|
||||||
if [ "$GAPPS_VARIANT" != 'none' ] && [ "$GAPPS_VARIANT" != '' ]; then
|
|
||||||
if [ "$GAPPS_BRAND" = "OpenGApps" ]; then
|
if [ "$GAPPS_BRAND" = "OpenGApps" ]; then
|
||||||
python3 generateGappsLink.py "$ARCH" "$GAPPS_VARIANT" "$DOWNLOAD_DIR" "$DOWNLOAD_CONF_NAME" || abort
|
python3 generateGappsLink.py "$ARCH" "$GAPPS_VARIANT" "$DOWNLOAD_DIR" "$DOWNLOAD_CONF_NAME" || abort
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Download Artifacts"
|
echo "Download Artifacts"
|
||||||
if ! aria2c --no-conf --log-level=info --log="$DOWNLOAD_DIR/aria2_download.log" -x16 -s16 -j5 -c -R -m0 --allow-overwrite=true --conditional-get=true -d"$DOWNLOAD_DIR" -i"$DOWNLOAD_DIR"/"$DOWNLOAD_CONF_NAME"; then
|
if ! aria2c --no-conf --log-level=info --log="$DOWNLOAD_DIR/aria2_download.log" -x16 -s16 -j5 -c -R -m0 --async-dns=false --check-integrity=true --continue=true --allow-overwrite=true --conditional-get=true -d"$DOWNLOAD_DIR" -i"$DOWNLOAD_DIR"/"$DOWNLOAD_CONF_NAME"; then
|
||||||
echo "We have encountered an error while downloading files."
|
echo "We have encountered an error while downloading files."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@ -283,7 +314,7 @@ else
|
|||||||
OFFLINE_ERR="1"
|
OFFLINE_ERR="1"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
if [ "$GAPPS_VARIANT" != 'none' ] && [ "$GAPPS_VARIANT" != '' ] && [ "$GAPPS_BRAND" != 'none' ]; then
|
if [ "$GAPPS_BRAND" != 'none' ]; then
|
||||||
if [ ! -f "$GAPPS_PATH" ]; then
|
if [ ! -f "$GAPPS_PATH" ]; then
|
||||||
echo "Offline mode: missing [$GAPPS_PATH]."
|
echo "Offline mode: missing [$GAPPS_PATH]."
|
||||||
OFFLINE_ERR="1"
|
OFFLINE_ERR="1"
|
||||||
@ -329,7 +360,7 @@ else
|
|||||||
fi
|
fi
|
||||||
echo -e "done\n"
|
echo -e "done\n"
|
||||||
|
|
||||||
if [ "$GAPPS_VARIANT" != 'none' ] && [ "$GAPPS_VARIANT" != '' ] && [ "$GAPPS_BRAND" != 'none' ]; then
|
if [ "$GAPPS_BRAND" != 'none' ]; then
|
||||||
echo "Extract GApps"
|
echo "Extract GApps"
|
||||||
mkdir -p "$WORK_DIR"/gapps || abort
|
mkdir -p "$WORK_DIR"/gapps || abort
|
||||||
if [ -f "$GAPPS_PATH" ]; then
|
if [ -f "$GAPPS_PATH" ]; then
|
||||||
@ -502,7 +533,7 @@ service $SERVER_NAME4 /dev/$TMP_PATH/magisk --boot-complete
|
|||||||
seclabel u:r:magisk:s0
|
seclabel u:r:magisk:s0
|
||||||
oneshot
|
oneshot
|
||||||
EOF
|
EOF
|
||||||
echo -e "Integrate Magisk done\n"
|
echo -e "Integrate Magisk done\n"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Merge Language Resources"
|
echo "Merge Language Resources"
|
||||||
@ -532,7 +563,7 @@ find ../"$ARCH"/system/system/etc/permissions/ -maxdepth 1 -mindepth 1 -printf '
|
|||||||
find ../"$ARCH"/system/system/etc/permissions/ -maxdepth 1 -mindepth 1 -printf '%P\n' | xargs -I file sudo find "$MOUNT_DIR"/system/etc/permissions/file -type f -exec chcon --reference="$MOUNT_DIR"/system/etc/permissions/platform.xml {} \;
|
find ../"$ARCH"/system/system/etc/permissions/ -maxdepth 1 -mindepth 1 -printf '%P\n' | xargs -I file sudo find "$MOUNT_DIR"/system/etc/permissions/file -type f -exec chcon --reference="$MOUNT_DIR"/system/etc/permissions/platform.xml {} \;
|
||||||
echo -e "Add extra packages done\n"
|
echo -e "Add extra packages done\n"
|
||||||
|
|
||||||
if [ "$GAPPS_VARIANT" != 'none' ] && [ "$GAPPS_VARIANT" != '' ] && [ "$GAPPS_BRAND" != 'none' ]; then
|
if [ "$GAPPS_BRAND" != 'none' ]; then
|
||||||
echo "Integrate GApps"
|
echo "Integrate GApps"
|
||||||
|
|
||||||
find "$WORK_DIR/gapps/" -mindepth 1 -type d -exec sudo chmod 0755 {} \;
|
find "$WORK_DIR/gapps/" -mindepth 1 -type d -exec sudo chmod 0755 {} \;
|
||||||
@ -547,7 +578,7 @@ if [ "$GAPPS_VARIANT" != 'none' ] && [ "$GAPPS_VARIANT" != '' ] && [ "$GAPPS_BRA
|
|||||||
find "$WORK_DIR"/gapps/ -maxdepth 1 -mindepth 1 -type d -not -path '*product' -exec sudo cp --preserve=all -r {} "$MOUNT_DIR"/system \; || abort
|
find "$WORK_DIR"/gapps/ -maxdepth 1 -mindepth 1 -type d -not -path '*product' -exec sudo cp --preserve=all -r {} "$MOUNT_DIR"/system \; || abort
|
||||||
elif [ "$GAPPS_BRAND" = "MindTheGapps" ]; then
|
elif [ "$GAPPS_BRAND" = "MindTheGapps" ]; then
|
||||||
sudo cp --preserve=all -r "$WORK_DIR"/gapps/system_ext/* "$MOUNT_DIR"/system_ext/ || abort
|
sudo cp --preserve=all -r "$WORK_DIR"/gapps/system_ext/* "$MOUNT_DIR"/system_ext/ || abort
|
||||||
if [ -e "$MOUNT_DIR"/system_ext/priv-app/SetupWizard ] ; then
|
if [ -e "$MOUNT_DIR"/system_ext/priv-app/SetupWizard ]; then
|
||||||
rm -rf "${MOUNT_DIR:?}/system_ext/priv-app/Provision"
|
rm -rf "${MOUNT_DIR:?}/system_ext/priv-app/Provision"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@ -593,7 +624,7 @@ if [ "$GAPPS_VARIANT" != 'none' ] && [ "$GAPPS_VARIANT" != '' ] && [ "$GAPPS_BRA
|
|||||||
echo -e "Integrate GApps done\n"
|
echo -e "Integrate GApps done\n"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$GAPPS_VARIANT" != 'none' ] && [ "$GAPPS_VARIANT" != '' ] && [ "$GAPPS_BRAND" != 'none' ]; then
|
if [ "$GAPPS_BRAND" != 'none' ]; then
|
||||||
echo "Fix GApps prop"
|
echo "Fix GApps prop"
|
||||||
sudo python3 fixGappsProp.py "$MOUNT_DIR" || abort
|
sudo python3 fixGappsProp.py "$MOUNT_DIR" || abort
|
||||||
echo -e "done\n"
|
echo -e "done\n"
|
||||||
@ -724,7 +755,7 @@ elif [[ "$ROOT_SOL" = "" ]]; then
|
|||||||
else
|
else
|
||||||
name1="-with-$ROOT_SOL-$MAGISK_VER"
|
name1="-with-$ROOT_SOL-$MAGISK_VER"
|
||||||
fi
|
fi
|
||||||
if [[ "$GAPPS_VARIANT" = "none" || "$GAPPS_VARIANT" = "" || "$GAPPS_BRAND" = "none" ]]; then
|
if [ "$GAPPS_BRAND" = "none" ]; then
|
||||||
name2="-NoGApps"
|
name2="-NoGApps"
|
||||||
else
|
else
|
||||||
if [ "$GAPPS_BRAND" = "OpenGApps" ]; then
|
if [ "$GAPPS_BRAND" = "OpenGApps" ]; then
|
||||||
|
Loading…
Reference in New Issue
Block a user