mirror of
https://github.com/MustardChef/WSABuilds.git
synced 2024-11-13 07:05:10 +01:00
Merge branch 'main' of https://github.com/LSPosed/MagiskOnWSALocal
This commit is contained in:
commit
bde50303cd
131
.github/workflows/build.yaml
vendored
131
.github/workflows/build.yaml
vendored
@ -9,7 +9,7 @@ on:
|
||||
type: choice
|
||||
options:
|
||||
- x86_64
|
||||
- AArch64
|
||||
- ARM64
|
||||
release_type:
|
||||
description: "WSA Release Channel"
|
||||
required: true
|
||||
@ -31,7 +31,7 @@ on:
|
||||
- Beta
|
||||
- Canary
|
||||
- Debug
|
||||
- Custom (URL)
|
||||
- Custom
|
||||
magisk_url:
|
||||
description: "Custom Magisk APK/ZIP URL"
|
||||
required: false
|
||||
@ -43,11 +43,12 @@ on:
|
||||
type: choice
|
||||
options:
|
||||
- None
|
||||
- Pico
|
||||
- Full
|
||||
- MindTheGapps (URL)
|
||||
mindthegapps_url:
|
||||
description: "MindTheGapps ZIP URL"
|
||||
- Pico (OpenGApps)
|
||||
- Full (OpenGApps)
|
||||
- Custom (OpenGApps)
|
||||
- Custom (MindTheGapps)
|
||||
gapps_url:
|
||||
description: "Custom GApps ZIP URL"
|
||||
required: false
|
||||
type: string
|
||||
remove_amazon:
|
||||
@ -55,11 +56,6 @@ on:
|
||||
required: false
|
||||
default: true
|
||||
type: boolean
|
||||
offline_mode:
|
||||
description: "Offline Mode"
|
||||
required: false
|
||||
default: false
|
||||
type: boolean
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
@ -83,7 +79,7 @@ jobs:
|
||||
DOWNLOAD_DIR=../download
|
||||
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 }}]}"
|
||||
|
||||
@ -91,16 +87,16 @@ jobs:
|
||||
|
||||
if [ "${{inputs.magisk_ver }}" != "None" ]; then
|
||||
ROOT_SOL="magisk"
|
||||
if [ "${{ inputs.magisk_ver }}" != "Custom (URL)" ]; then
|
||||
if [ "${{ inputs.magisk_ver }}" != "Custom" ]; then
|
||||
MAGISK_VER="${opts[MAGISK_VER,${{ inputs.magisk_ver }}]}"
|
||||
else
|
||||
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
|
||||
echo "Custom Magisk download error!"
|
||||
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 "Magisk download error!"
|
||||
exit 1
|
||||
fi
|
||||
CUSTOM_MAGISK="1"
|
||||
CUSTOM_MAGISK="${opts[MAGISK_VER,Custom]}"
|
||||
MAGISK_VER="${opts[MAGISK_VER,Debug]}"
|
||||
fi
|
||||
else
|
||||
@ -108,25 +104,73 @@ jobs:
|
||||
MAGISK_VER="${opts[MAGISK_VER,Stable]}"
|
||||
fi
|
||||
|
||||
if [ "$ARCH" != "arm64" ]; then
|
||||
if [ "$ARCH" == "x86_64" ]; then
|
||||
GAPPS_VAR="${opts[GAPPS_VAR,${{ inputs.gapps_var }}]}"
|
||||
else
|
||||
# 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
|
||||
if [ "${{ inputs.gapps_var }}" == "Full" ]; then
|
||||
GAPPS_VAR="pico"
|
||||
if [ "${{ inputs.gapps_var }}" == "Full (OpenGApps)" ]; then
|
||||
GAPPS_VAR="${opts[GAPPS_VAR,Pico (OpenGApps)]}"
|
||||
else
|
||||
GAPPS_VAR="${opts[GAPPS_VAR,${{ inputs.gapps_var }}]}"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "${{inputs.gapps_var }}" != "None" ]; then
|
||||
if [ "${{ inputs.gapps_var }}" != "MindTheGapps (URL)" ]; then
|
||||
if [ "${{ inputs.gapps_var }}" != "Custom (MindTheGapps)" ]; then
|
||||
GAPPS_BRAND="OpenGApps"
|
||||
else
|
||||
echo "${{ inputs.mindthegapps_url }}" > -i"$DOWNLOAD_DIR"/"$DOWNLOAD_CONF_NAME"
|
||||
if [ "${{ inputs.gapps_var }}" == "Custom (OpenGApps)" ]; then
|
||||
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!"
|
||||
exit 1
|
||||
fi
|
||||
@ -138,9 +182,22 @@ jobs:
|
||||
|
||||
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[*]}"
|
||||
|
||||
chmod +x ./build.sh
|
||||
@ -151,25 +208,27 @@ jobs:
|
||||
declare -A magisk_vers=( ["Stable"]="stable" ["Beta"]="beta" ["Canary"]="canary" ["Debug"]="debug" )
|
||||
|
||||
if [[ "${{ inputs.magisk_ver }}" == "None" ]]; then
|
||||
magiskVer=""
|
||||
elif [[ "${{ inputs.magisk_ver }}" == "Custom (URL)" ]]; then
|
||||
magiskVer="_Magisk-Custom"
|
||||
magiskVer=""
|
||||
elif [[ "${{ inputs.magisk_ver }}" == "Custom" ]]; then
|
||||
magiskVer="_Magisk-Custom"
|
||||
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")"
|
||||
fi
|
||||
|
||||
if [[ "${{ inputs.gapps_var }}" == "None" ]]; then
|
||||
gappsVar=""
|
||||
elif [[ "${{ inputs.gapps_var }}" == "MindTheGapps (URL)" ]]; then
|
||||
gappsVar="_MindTheGapps"
|
||||
gappsVar=""
|
||||
elif [[ "${{ inputs.gapps_var }}" == "Custom (MindTheGapps)" ]]; then
|
||||
gappsVar="_MindTheGapps"
|
||||
elif [[ "${{ inputs.gapps_var }}" == "Custom (OpenGApps)" ]]; then
|
||||
gappsVar="_${{ env.opengapps_var }}-OpenGApps"
|
||||
else
|
||||
gappsVar="_${{ inputs.gapps_var }}-OpenGApps"
|
||||
gappsVar="_${{ inputs.gapps_var }}-OpenGApps"
|
||||
fi
|
||||
|
||||
if [[ "${{ inputs.remove_amazon }}" == "true" ]]; then
|
||||
amazon=""
|
||||
amazon=""
|
||||
else
|
||||
amazon="_Amazon-AppStore"
|
||||
amazon="_Amazon-AppStore"
|
||||
fi
|
||||
echo "release_asset_name=WSA_${{ env.WSA_VER }}$magiskVer$gappsVar${amazon}_${{ inputs.arch }}" >> $GITHUB_ENV
|
||||
- name: Compress Asset
|
||||
|
28
README.md
28
README.md
@ -42,7 +42,7 @@
|
||||
|
||||
## Help
|
||||
|
||||
How can I get a logcat?
|
||||
How do I get a logcat?
|
||||
|
||||
- `adb logcat`
|
||||
|
||||
@ -50,7 +50,7 @@ or
|
||||
|
||||
- `%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
|
||||
|
||||
@ -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>
|
||||
|
||||
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
|
||||
|
||||
@ -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
|
||||
|
||||
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)
|
||||
|
||||
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
|
||||
|
||||
- [StoreLib](https://github.com/StoreDev/StoreLib): API for downloading WSA
|
||||
|
211
scripts/build.sh
211
scripts/build.sh
@ -18,7 +18,7 @@
|
||||
# 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
|
||||
exit 1
|
||||
fi
|
||||
@ -34,7 +34,7 @@ DOWNLOAD_DIR=../download
|
||||
DOWNLOAD_CONF_NAME=download.list
|
||||
OUTPUT_DIR=../output
|
||||
MOUNT_DIR="$WORK_DIR"/system
|
||||
umount_clean(){
|
||||
umount_clean() {
|
||||
if [ -d "$MOUNT_DIR" ]; then
|
||||
echo "Cleanup Work Directory"
|
||||
if [ -d "$MOUNT_DIR/vendor" ]; then
|
||||
@ -52,7 +52,7 @@ umount_clean(){
|
||||
rm -rf "${WORK_DIR:?}"
|
||||
fi
|
||||
}
|
||||
clean_download(){
|
||||
clean_download() {
|
||||
if [ -d "$DOWNLOAD_DIR" ]; then
|
||||
echo "Cleanup Download Directory"
|
||||
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"
|
||||
}
|
||||
|
||||
|
||||
default(){
|
||||
default() {
|
||||
ARCH=x64
|
||||
RELEASE_TYPE=retail
|
||||
MAGISK_VER=stable
|
||||
@ -90,78 +89,12 @@ default(){
|
||||
ROOT_SOL=magisk
|
||||
}
|
||||
|
||||
exit_with_message(){
|
||||
exit_with_message() {
|
||||
echo "ERROR: $1"
|
||||
usage
|
||||
abort
|
||||
exit 1
|
||||
}
|
||||
|
||||
usage(){
|
||||
default
|
||||
echo "Usage:
|
||||
--arch Architecture of WSA, x64 or arm64, default: $ARCH
|
||||
--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
|
||||
--gapps-brand GApps brand, OpenGApps or MindTheGApps, default: $GAPPS_BRAND
|
||||
--gapps-variant GApps variant, pico or full, etc...., default: $GAPPS_VARIANT
|
||||
--root-sol Root solution, magisk or none, default: $ROOT_SOL
|
||||
--remove-amazon Remove Amazon from the system, default: false
|
||||
--compress Compress the WSA, default: false
|
||||
--offline Build WSA offline, default: false
|
||||
--magisk-custom Install custom Magisk, default: false
|
||||
--debug Debug build mode, default: false
|
||||
--help Show this help message and exit
|
||||
|
||||
Example:
|
||||
./build.sh --arch x64 --release-type retail --magisk-ver stable --gapps-brand OpenGApps --gapps-variant pico --remove-amazon
|
||||
./build.sh --arch x64 --release-type retail --remove-amazon --magisk-custom --offline
|
||||
./build.sh --release-type RP
|
||||
"
|
||||
}
|
||||
|
||||
ARGUMENT_LIST=(
|
||||
"arch:"
|
||||
"release-type:"
|
||||
"magisk-ver:"
|
||||
"gapps-brand:"
|
||||
"gapps-variant:"
|
||||
"root-sol:"
|
||||
"remove-amazon"
|
||||
"compress"
|
||||
"offline"
|
||||
"magisk-custom"
|
||||
"debug"
|
||||
"help"
|
||||
)
|
||||
|
||||
default
|
||||
|
||||
opts=$(getopt \
|
||||
--longoptions "$(printf "%s," "${ARGUMENT_LIST[@]}")" \
|
||||
--name "$(basename "$0")" \
|
||||
--options "" \
|
||||
-- "$@"
|
||||
) || exit_with_message "Failed to parse options, please check your input"
|
||||
|
||||
eval set --"$opts"
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--arch ) ARCH="$2"; shift 2 ;;
|
||||
--release-type ) RELEASE_TYPE="$2"; shift 2 ;;
|
||||
--magisk-ver ) MAGISK_VER="$2"; shift 2 ;;
|
||||
--gapps-brand ) GAPPS_BRAND="$2"; shift 2 ;;
|
||||
--gapps-variant ) GAPPS_VARIANT="$2"; shift 2 ;;
|
||||
--root-sol ) ROOT_SOL="$2"; shift 2 ;;
|
||||
--remove-amazon ) REMOVE_AMAZON="remove"; shift ;;
|
||||
--compress ) COMPRESS_OUTPUT="yes"; shift ;;
|
||||
--offline ) OFFLINE="on"; shift ;;
|
||||
--magisk-custom ) CUSTOM_MAGISK="debug"; MAGISK_VER=$CUSTOM_MAGISK; shift ;;
|
||||
--debug ) DEBUG="on"; shift ;;
|
||||
--help ) usage; exit 0 ;;
|
||||
-- ) shift; break;;
|
||||
esac
|
||||
done
|
||||
|
||||
ARCH_MAP=(
|
||||
"x64"
|
||||
"arm64"
|
||||
@ -183,7 +116,7 @@ MAGISK_VER_MAP=(
|
||||
|
||||
GAPPS_BRAND_MAP=(
|
||||
"OpenGApps"
|
||||
"MindTheGApps"
|
||||
"MindTheGapps"
|
||||
"none"
|
||||
)
|
||||
|
||||
@ -197,15 +130,115 @@ GAPPS_VARIANT_MAP=(
|
||||
"pico"
|
||||
"tvstock"
|
||||
"tvmini"
|
||||
"none"
|
||||
)
|
||||
|
||||
ROOT_SOL_MAP=(
|
||||
"magisk"
|
||||
"none"
|
||||
)
|
||||
ARR_TO_STR() {
|
||||
local arr=("$@")
|
||||
local joined
|
||||
printf -v joined "%s, " "${arr[@]}"
|
||||
echo "${joined%, }"
|
||||
}
|
||||
usage() {
|
||||
default
|
||||
echo "Usage:
|
||||
--arch Architecture of WSA.
|
||||
|
||||
check_list(){
|
||||
Possible values: $(ARR_TO_STR "${ARCH_MAP[@]}")
|
||||
Default: $ARCH
|
||||
|
||||
--release-type Release type of WSA.
|
||||
RP means Release Preview, WIS means Insider Slow, WIF means Insider Fast.
|
||||
|
||||
Possible values: $(ARR_TO_STR "${RELEASE_TYPE_MAP[@]}")
|
||||
Default: $RELEASE_TYPE
|
||||
|
||||
--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
|
||||
|
||||
Example:
|
||||
./build.sh --release-type RP --magisk-ver beta --gapps-variant pico --remove-amazon
|
||||
./build.sh --arch arm64 --release-type WIF --gapps-brand MindTheGapps
|
||||
./build.sh --release-type WIS --gapps-brand none
|
||||
./build.sh --offline --gapps-variant pico --magisk-custom
|
||||
"
|
||||
}
|
||||
|
||||
ARGUMENT_LIST=(
|
||||
"arch:"
|
||||
"release-type:"
|
||||
"magisk-ver:"
|
||||
"gapps-brand:"
|
||||
"gapps-variant:"
|
||||
"root-sol:"
|
||||
"remove-amazon"
|
||||
"compress"
|
||||
"offline"
|
||||
"magisk-custom"
|
||||
"debug"
|
||||
"help"
|
||||
)
|
||||
|
||||
default
|
||||
|
||||
opts=$(
|
||||
getopt \
|
||||
--longoptions "$(printf "%s," "${ARGUMENT_LIST[@]}")" \
|
||||
--name "$(basename "$0")" \
|
||||
--options "" \
|
||||
-- "$@"
|
||||
) || exit_with_message "Failed to parse options, please check your input"
|
||||
|
||||
eval set --"$opts"
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--arch ) ARCH="$2"; shift 2 ;;
|
||||
--release-type ) RELEASE_TYPE="$2"; shift 2 ;;
|
||||
--magisk-ver ) MAGISK_VER="$2"; shift 2 ;;
|
||||
--gapps-brand ) GAPPS_BRAND="$2"; shift 2 ;;
|
||||
--gapps-variant ) GAPPS_VARIANT="$2"; shift 2 ;;
|
||||
--root-sol ) ROOT_SOL="$2"; shift 2 ;;
|
||||
--remove-amazon ) REMOVE_AMAZON="remove"; shift ;;
|
||||
--compress ) COMPRESS_OUTPUT="yes"; shift ;;
|
||||
--offline ) OFFLINE="on"; shift ;;
|
||||
--magisk-custom ) CUSTOM_MAGISK="debug"; MAGISK_VER=$CUSTOM_MAGISK; shift ;;
|
||||
--debug ) DEBUG="on"; shift ;;
|
||||
--help ) usage; exit 0 ;;
|
||||
-- ) shift; break;;
|
||||
esac
|
||||
done
|
||||
|
||||
check_list() {
|
||||
local input=$1
|
||||
local name=$2
|
||||
shift
|
||||
@ -217,7 +250,7 @@ check_list(){
|
||||
break
|
||||
fi
|
||||
((list_count--))
|
||||
if (( "$list_count" <= 0 )); then
|
||||
if (("$list_count" <= 0)); then
|
||||
exit_with_message "Invalid $name: $input"
|
||||
fi
|
||||
done
|
||||
@ -264,14 +297,12 @@ if [ -z "${OFFLINE+x}" ]; then
|
||||
if [ -z "${CUSTOM_MAGISK+x}" ]; then
|
||||
python3 generateMagiskLink.py "$MAGISK_VER" "$DOWNLOAD_DIR" "$DOWNLOAD_CONF_NAME" || abort
|
||||
fi
|
||||
if [ "$GAPPS_VARIANT" != 'none' ] && [ "$GAPPS_VARIANT" != '' ]; then
|
||||
if [ "$GAPPS_BRAND" = "OpenGApps" ]; then
|
||||
python3 generateGappsLink.py "$ARCH" "$GAPPS_VARIANT" "$DOWNLOAD_DIR" "$DOWNLOAD_CONF_NAME" || abort
|
||||
fi
|
||||
if [ "$GAPPS_BRAND" = "OpenGApps" ]; then
|
||||
python3 generateGappsLink.py "$ARCH" "$GAPPS_VARIANT" "$DOWNLOAD_DIR" "$DOWNLOAD_CONF_NAME" || abort
|
||||
fi
|
||||
|
||||
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."
|
||||
exit 1
|
||||
fi
|
||||
@ -283,7 +314,7 @@ else
|
||||
OFFLINE_ERR="1"
|
||||
fi
|
||||
done
|
||||
if [ "$GAPPS_VARIANT" != 'none' ] && [ "$GAPPS_VARIANT" != '' ] && [ "$GAPPS_BRAND" != 'none' ]; then
|
||||
if [ "$GAPPS_BRAND" != 'none' ]; then
|
||||
if [ ! -f "$GAPPS_PATH" ]; then
|
||||
echo "Offline mode: missing [$GAPPS_PATH]."
|
||||
OFFLINE_ERR="1"
|
||||
@ -329,7 +360,7 @@ else
|
||||
fi
|
||||
echo -e "done\n"
|
||||
|
||||
if [ "$GAPPS_VARIANT" != 'none' ] && [ "$GAPPS_VARIANT" != '' ] && [ "$GAPPS_BRAND" != 'none' ]; then
|
||||
if [ "$GAPPS_BRAND" != 'none' ]; then
|
||||
echo "Extract GApps"
|
||||
mkdir -p "$WORK_DIR"/gapps || abort
|
||||
if [ -f "$GAPPS_PATH" ]; then
|
||||
@ -502,7 +533,7 @@ service $SERVER_NAME4 /dev/$TMP_PATH/magisk --boot-complete
|
||||
seclabel u:r:magisk:s0
|
||||
oneshot
|
||||
EOF
|
||||
echo -e "Integrate Magisk done\n"
|
||||
echo -e "Integrate Magisk done\n"
|
||||
fi
|
||||
|
||||
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 {} \;
|
||||
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"
|
||||
|
||||
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
|
||||
elif [ "$GAPPS_BRAND" = "MindTheGapps" ]; then
|
||||
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"
|
||||
fi
|
||||
fi
|
||||
@ -578,7 +609,7 @@ if [ "$GAPPS_VARIANT" != 'none' ] && [ "$GAPPS_VARIANT" != '' ] && [ "$GAPPS_BRA
|
||||
|
||||
sudo chcon --reference="$MOUNT_DIR"/product/lib64/libjni_eglfence.so "$MOUNT_DIR"/product/lib
|
||||
find "$WORK_DIR"/gapps/product/lib/ -maxdepth 1 -mindepth 1 -printf '%P\n' | xargs -I file sudo find "$MOUNT_DIR"/product/lib/file -exec chcon --reference="$MOUNT_DIR"/product/lib64/libjni_eglfence.so {} \;
|
||||
find "$WORK_DIR"/gapps/product/lib64/ -maxdepth 1 -mindepth 1 -printf '%P\n' | xargs -I file sudo find "$MOUNT_DIR"/product/lib64/file -type f -exec chcon --reference="$MOUNT_DIR"/product/lib64/libjni_eglfence.so {} \;
|
||||
find "$WORK_DIR"/gapps/product/lib64/ -maxdepth 1 -mindepth 1 -printf '%P\n' | xargs -I file sudo find "$MOUNT_DIR"/product/lib64/file -type f -exec chcon --reference="$MOUNT_DIR"/product/lib64/libjni_eglfence.so {} \;
|
||||
find "$WORK_DIR"/gapps/system_ext/priv-app/ -maxdepth 1 -mindepth 1 -printf '%P\n' | xargs -I dir sudo find "$MOUNT_DIR"/system_ext/priv-app/dir -type d -exec chcon --reference="$MOUNT_DIR"/system_ext/priv-app {} \;
|
||||
find "$WORK_DIR"/gapps/system_ext/etc/ -maxdepth 1 -mindepth 1 -printf '%P\n' | xargs -I dir sudo find "$MOUNT_DIR"/system_ext/etc/dir -type d -exec chcon --reference="$MOUNT_DIR"/system_ext/etc {} \;
|
||||
find "$WORK_DIR"/gapps/system_ext/priv-app/ -maxdepth 1 -mindepth 1 -printf '%P\n' | xargs -I dir sudo find "$MOUNT_DIR"/system_ext/priv-app/dir -type f -exec chcon --reference="$MOUNT_DIR"/system_ext/priv-app/Settings/Settings.apk {} \;
|
||||
@ -593,7 +624,7 @@ if [ "$GAPPS_VARIANT" != 'none' ] && [ "$GAPPS_VARIANT" != '' ] && [ "$GAPPS_BRA
|
||||
echo -e "Integrate GApps done\n"
|
||||
fi
|
||||
|
||||
if [ "$GAPPS_VARIANT" != 'none' ] && [ "$GAPPS_VARIANT" != '' ] && [ "$GAPPS_BRAND" != 'none' ]; then
|
||||
if [ "$GAPPS_BRAND" != 'none' ]; then
|
||||
echo "Fix GApps prop"
|
||||
sudo python3 fixGappsProp.py "$MOUNT_DIR" || abort
|
||||
echo -e "done\n"
|
||||
@ -724,7 +755,7 @@ elif [[ "$ROOT_SOL" = "" ]]; then
|
||||
else
|
||||
name1="-with-$ROOT_SOL-$MAGISK_VER"
|
||||
fi
|
||||
if [[ "$GAPPS_VARIANT" = "none" || "$GAPPS_VARIANT" = "" || "$GAPPS_BRAND" = "none" ]]; then
|
||||
if [ "$GAPPS_BRAND" = "none" ]; then
|
||||
name2="-NoGApps"
|
||||
else
|
||||
if [ "$GAPPS_BRAND" = "OpenGApps" ]; then
|
||||
|
Loading…
Reference in New Issue
Block a user