mirror of
https://github.com/MustardChef/WSABuilds.git
synced 2024-11-23 11:49:16 +01:00
Formatting codes
This commit is contained in:
parent
bc48faf17a
commit
70bb0fdb8f
@ -3,7 +3,7 @@
|
|||||||
## Pre-request
|
## Pre-request
|
||||||
|
|
||||||
- Ubuntu (you can use WSL2)
|
- Ubuntu (you can use WSL2)
|
||||||
- [Search page](https://apps.microsoft.com/store/search?publisher=Canonical%20Group%20Limited)
|
- [Search page](https://apps.microsoft.com/store/search?publisher=Canonical%20Group%20Limited)
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
|
@ -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
|
||||||
@ -77,11 +77,10 @@ abort() {
|
|||||||
trap abort INT TERM
|
trap abort INT TERM
|
||||||
|
|
||||||
function Gen_Rand_Str {
|
function Gen_Rand_Str {
|
||||||
tr -dc 'a-zA-Z0-9' < /dev/urandom | fold -w "$1" | head -n 1
|
tr -dc 'a-zA-Z0-9' </dev/urandom | fold -w "$1" | head -n 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default() {
|
||||||
default(){
|
|
||||||
ARCH=x64
|
ARCH=x64
|
||||||
RELEASE_TYPE=retail
|
RELEASE_TYPE=retail
|
||||||
MAGISK_VER=stable
|
MAGISK_VER=stable
|
||||||
@ -90,7 +89,7 @@ default(){
|
|||||||
ROOT_SOL=magisk
|
ROOT_SOL=magisk
|
||||||
}
|
}
|
||||||
|
|
||||||
exit_with_message(){
|
exit_with_message() {
|
||||||
echo "ERROR: $1"
|
echo "ERROR: $1"
|
||||||
usage
|
usage
|
||||||
exit 1
|
exit 1
|
||||||
@ -137,13 +136,13 @@ ROOT_SOL_MAP=(
|
|||||||
"magisk"
|
"magisk"
|
||||||
"none"
|
"none"
|
||||||
)
|
)
|
||||||
ARR_TO_STR(){
|
ARR_TO_STR() {
|
||||||
local arr=("$@")
|
local arr=("$@")
|
||||||
local joined
|
local joined
|
||||||
printf -v joined "%s, " "${arr[@]}";
|
printf -v joined "%s, " "${arr[@]}"
|
||||||
echo "${joined%, }"
|
echo "${joined%, }"
|
||||||
}
|
}
|
||||||
usage(){
|
usage() {
|
||||||
default
|
default
|
||||||
echo "Usage:
|
echo "Usage:
|
||||||
--arch Architecture of WSA.
|
--arch Architecture of WSA.
|
||||||
@ -187,36 +186,37 @@ Additional Options:
|
|||||||
--debug Debug build mode
|
--debug Debug build mode
|
||||||
--help Show this help message and exit
|
--help Show this help message and exit
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
./build.sh --release-type RP --magisk-ver beta --gapps-variant pico --remove-amazon
|
./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 --arch arm64 --release-type WIF --gapps-brand MindTheGapps
|
||||||
./build.sh --release-type WIS --gapps-brand none
|
./build.sh --release-type WIS --gapps-brand none
|
||||||
./build.sh --offline --gapps-variant pico --magisk-custom
|
./build.sh --offline --gapps-variant pico --magisk-custom
|
||||||
"
|
"
|
||||||
}
|
}
|
||||||
|
|
||||||
ARGUMENT_LIST=(
|
ARGUMENT_LIST=(
|
||||||
"arch:"
|
"arch:"
|
||||||
"release-type:"
|
"release-type:"
|
||||||
"magisk-ver:"
|
"magisk-ver:"
|
||||||
"gapps-brand:"
|
"gapps-brand:"
|
||||||
"gapps-variant:"
|
"gapps-variant:"
|
||||||
"root-sol:"
|
"root-sol:"
|
||||||
"remove-amazon"
|
"remove-amazon"
|
||||||
"compress"
|
"compress"
|
||||||
"offline"
|
"offline"
|
||||||
"magisk-custom"
|
"magisk-custom"
|
||||||
"debug"
|
"debug"
|
||||||
"help"
|
"help"
|
||||||
)
|
)
|
||||||
|
|
||||||
default
|
default
|
||||||
|
|
||||||
opts=$(getopt \
|
opts=$(
|
||||||
--longoptions "$(printf "%s," "${ARGUMENT_LIST[@]}")" \
|
getopt \
|
||||||
--name "$(basename "$0")" \
|
--longoptions "$(printf "%s," "${ARGUMENT_LIST[@]}")" \
|
||||||
--options "" \
|
--name "$(basename "$0")" \
|
||||||
-- "$@"
|
--options "" \
|
||||||
|
-- "$@"
|
||||||
) || exit_with_message "Failed to parse options, please check your input"
|
) || exit_with_message "Failed to parse options, please check your input"
|
||||||
|
|
||||||
eval set --"$opts"
|
eval set --"$opts"
|
||||||
@ -238,7 +238,7 @@ while [[ $# -gt 0 ]]; do
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
check_list(){
|
check_list() {
|
||||||
local input=$1
|
local input=$1
|
||||||
local name=$2
|
local name=$2
|
||||||
shift
|
shift
|
||||||
@ -250,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
|
||||||
@ -533,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"
|
||||||
@ -578,7 +578,7 @@ if [ "$GAPPS_BRAND" != 'none' ]; then
|
|||||||
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
|
||||||
@ -609,7 +609,7 @@ if [ "$GAPPS_BRAND" != 'none' ]; then
|
|||||||
|
|
||||||
sudo chcon --reference="$MOUNT_DIR"/product/lib64/libjni_eglfence.so "$MOUNT_DIR"/product/lib
|
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/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/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/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 {} \;
|
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 {} \;
|
||||||
|
@ -23,13 +23,13 @@
|
|||||||
|
|
||||||
DOWNLOAD_DIR=../download
|
DOWNLOAD_DIR=../download
|
||||||
|
|
||||||
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
|
||||||
cd "$(dirname "$0")" || exit 1
|
cd "$(dirname "$0")" || exit 1
|
||||||
|
|
||||||
abort(){
|
abort() {
|
||||||
echo "Dependencies: an error has occurred, exit"
|
echo "Dependencies: an error has occurred, exit"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user