mirror of
https://github.com/MustardChef/WSABuilds.git
synced 2024-11-10 21:55:11 +01:00
parent
dcc6dcd9be
commit
1fc795b7fe
@ -148,6 +148,12 @@ ROOT_SOL_MAP=(
|
|||||||
"magisk"
|
"magisk"
|
||||||
"none"
|
"none"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
COMPRESS_FORMAT_MAP=(
|
||||||
|
"7z"
|
||||||
|
"xz"
|
||||||
|
)
|
||||||
|
|
||||||
ARR_TO_STR() {
|
ARR_TO_STR() {
|
||||||
local arr=("$@")
|
local arr=("$@")
|
||||||
local joined
|
local joined
|
||||||
@ -190,9 +196,15 @@ usage() {
|
|||||||
Possible values: $(ARR_TO_STR "${ROOT_SOL_MAP[@]}")
|
Possible values: $(ARR_TO_STR "${ROOT_SOL_MAP[@]}")
|
||||||
Default: $ROOT_SOL
|
Default: $ROOT_SOL
|
||||||
|
|
||||||
|
--compress-format
|
||||||
|
Compress format of output file.
|
||||||
|
If this option is not specified and --compress is not specified, the generated file will not be compressed
|
||||||
|
|
||||||
|
Possible values: $(ARR_TO_STR "${COMPRESS_FORMAT_MAP[@]}")
|
||||||
|
|
||||||
Additional Options:
|
Additional Options:
|
||||||
--remove-amazon Remove Amazon Appstore from the system
|
--remove-amazon Remove Amazon Appstore from the system
|
||||||
--compress Compress the WSA
|
--compress Compress the WSA, The default format is 7z, you can use the format specified by --compress-format
|
||||||
--offline Build WSA offline
|
--offline Build WSA offline
|
||||||
--magisk-custom Install custom Magisk
|
--magisk-custom Install custom Magisk
|
||||||
--debug Debug build mode
|
--debug Debug build mode
|
||||||
@ -213,6 +225,7 @@ ARGUMENT_LIST=(
|
|||||||
"gapps-brand:"
|
"gapps-brand:"
|
||||||
"gapps-variant:"
|
"gapps-variant:"
|
||||||
"root-sol:"
|
"root-sol:"
|
||||||
|
"compress-format:"
|
||||||
"remove-amazon"
|
"remove-amazon"
|
||||||
"compress"
|
"compress"
|
||||||
"offline"
|
"offline"
|
||||||
@ -240,6 +253,7 @@ while [[ $# -gt 0 ]]; do
|
|||||||
--gapps-brand ) GAPPS_BRAND="$2"; shift 2 ;;
|
--gapps-brand ) GAPPS_BRAND="$2"; shift 2 ;;
|
||||||
--gapps-variant ) GAPPS_VARIANT="$2"; shift 2 ;;
|
--gapps-variant ) GAPPS_VARIANT="$2"; shift 2 ;;
|
||||||
--root-sol ) ROOT_SOL="$2"; shift 2 ;;
|
--root-sol ) ROOT_SOL="$2"; shift 2 ;;
|
||||||
|
--compress-format ) COMPRESS_FORMAT="$2"; shift 2 ;;
|
||||||
--remove-amazon ) REMOVE_AMAZON="remove"; shift ;;
|
--remove-amazon ) REMOVE_AMAZON="remove"; shift ;;
|
||||||
--compress ) COMPRESS_OUTPUT="yes"; shift ;;
|
--compress ) COMPRESS_OUTPUT="yes"; shift ;;
|
||||||
--offline ) OFFLINE="on"; shift ;;
|
--offline ) OFFLINE="on"; shift ;;
|
||||||
@ -252,20 +266,22 @@ done
|
|||||||
|
|
||||||
check_list() {
|
check_list() {
|
||||||
local input=$1
|
local input=$1
|
||||||
local name=$2
|
if [ -n "$input" ]; then
|
||||||
shift
|
local name=$2
|
||||||
local arr=("$@")
|
shift
|
||||||
local list_count=${#arr[@]}
|
local arr=("$@")
|
||||||
for i in "${arr[@]}"; do
|
local list_count=${#arr[@]}
|
||||||
if [ "$input" == "$i" ]; then
|
for i in "${arr[@]}"; do
|
||||||
echo "INFO: $name: $input"
|
if [ "$input" == "$i" ]; then
|
||||||
break
|
echo "INFO: $name: $input"
|
||||||
fi
|
break
|
||||||
((list_count--))
|
fi
|
||||||
if (("$list_count" <= 0)); then
|
((list_count--))
|
||||||
exit_with_message "Invalid $name: $input"
|
if (("$list_count" <= 0)); then
|
||||||
fi
|
exit_with_message "Invalid $name: $input"
|
||||||
done
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
check_list "$ARCH" "Architecture" "${ARCH_MAP[@]}"
|
check_list "$ARCH" "Architecture" "${ARCH_MAP[@]}"
|
||||||
@ -274,6 +290,7 @@ check_list "$MAGISK_VER" "Magisk Version" "${MAGISK_VER_MAP[@]}"
|
|||||||
check_list "$GAPPS_BRAND" "GApps Brand" "${GAPPS_BRAND_MAP[@]}"
|
check_list "$GAPPS_BRAND" "GApps Brand" "${GAPPS_BRAND_MAP[@]}"
|
||||||
check_list "$GAPPS_VARIANT" "GApps Variant" "${GAPPS_VARIANT_MAP[@]}"
|
check_list "$GAPPS_VARIANT" "GApps Variant" "${GAPPS_VARIANT_MAP[@]}"
|
||||||
check_list "$ROOT_SOL" "Root Solution" "${ROOT_SOL_MAP[@]}"
|
check_list "$ROOT_SOL" "Root Solution" "${ROOT_SOL_MAP[@]}"
|
||||||
|
check_list "$COMPRESS_FORMAT" "Compress Format" "${COMPRESS_FORMAT_MAP[@]}"
|
||||||
|
|
||||||
if [ "$DEBUG" ]; then
|
if [ "$DEBUG" ]; then
|
||||||
set -x
|
set -x
|
||||||
@ -836,10 +853,20 @@ fi
|
|||||||
if [ ! -d "$OUTPUT_DIR" ]; then
|
if [ ! -d "$OUTPUT_DIR" ]; then
|
||||||
mkdir -p "$OUTPUT_DIR"
|
mkdir -p "$OUTPUT_DIR"
|
||||||
fi
|
fi
|
||||||
if [ "$COMPRESS_OUTPUT" ]; then
|
if [ "$COMPRESS_OUTPUT" ] || [ -n "$COMPRESS_FORMAT" ]; then
|
||||||
rm -f "${OUTPUT_DIR:?}"/"$artifact_name.7z" || abort
|
|
||||||
mv "$WORK_DIR/wsa/$ARCH" "$WORK_DIR/wsa/$artifact_name"
|
mv "$WORK_DIR/wsa/$ARCH" "$WORK_DIR/wsa/$artifact_name"
|
||||||
7z a "$OUTPUT_DIR"/"$artifact_name.7z" "$WORK_DIR/wsa/$artifact_name" || abort
|
if [ "$COMPRESS_FORMAT" = "7z" ]; then
|
||||||
|
rm -f "${OUTPUT_DIR:?}"/"$artifact_name.7z" || abort
|
||||||
|
echo "Compressing with 7z"
|
||||||
|
7z a "$OUTPUT_DIR"/"$artifact_name.7z" "$WORK_DIR/wsa/$artifact_name" || abort
|
||||||
|
elif [ "$COMPRESS_FORMAT" = "xz" ]; then
|
||||||
|
rm -f "${OUTPUT_DIR:?}"/"$artifact_name.tar.xz" || abort
|
||||||
|
echo "Compressing with tar xz"
|
||||||
|
if ! (tar -cP -I 'xz -9 -T0' -f "$OUTPUT_DIR"/"$artifact_name.tar.xz" "$WORK_DIR/wsa/$artifact_name"); then
|
||||||
|
echo "Out of memory? Trying again with single threads..."
|
||||||
|
tar -cPJvf "$OUTPUT_DIR"/"$artifact_name.tar.xz" "$WORK_DIR/wsa/$artifact_name" || abort
|
||||||
|
fi
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
rm -rf "${OUTPUT_DIR:?}/${artifact_name}" || abort
|
rm -rf "${OUTPUT_DIR:?}/${artifact_name}" || abort
|
||||||
cp -r "$WORK_DIR"/wsa/"$ARCH" "$OUTPUT_DIR/$artifact_name" || abort
|
cp -r "$WORK_DIR"/wsa/"$ARCH" "$OUTPUT_DIR/$artifact_name" || abort
|
||||||
|
@ -52,6 +52,7 @@ check_dependencies() {
|
|||||||
command -v aria2c >/dev/null 2>&1 || NEED_INSTALL+=("aria2")
|
command -v aria2c >/dev/null 2>&1 || NEED_INSTALL+=("aria2")
|
||||||
command -v 7z > /dev/null 2>&1 || NEED_INSTALL+=("p7zip-full")
|
command -v 7z > /dev/null 2>&1 || NEED_INSTALL+=("p7zip-full")
|
||||||
command -v setfattr > /dev/null 2>&1 || NEED_INSTALL+=("attr")
|
command -v setfattr > /dev/null 2>&1 || NEED_INSTALL+=("attr")
|
||||||
|
command -v xz > /dev/null 2>&1 || NEED_INSTALL+=("xz-utils")
|
||||||
}
|
}
|
||||||
check_dependencies
|
check_dependencies
|
||||||
osrel=$(sed -n '/^ID_LIKE=/s/^.*=//p' /etc/os-release);
|
osrel=$(sed -n '/^ID_LIKE=/s/^.*=//p' /etc/os-release);
|
||||||
@ -103,8 +104,12 @@ if [ -n "${NEED_INSTALL[*]}" ]; then
|
|||||||
else
|
else
|
||||||
if [ "$PM" = "zypper" ]; then
|
if [ "$PM" = "zypper" ]; then
|
||||||
NEED_INSTALL_FIX=${NEED_INSTALL[*]}
|
NEED_INSTALL_FIX=${NEED_INSTALL[*]}
|
||||||
NEED_INSTALL_FIX=${NEED_INSTALL_FIX//setools/setools-console} >> /dev/null 2>&1
|
{
|
||||||
NEED_INSTALL_FIX=${NEED_INSTALL_FIX//whiptail/dialog} >> /dev/null 2>&1
|
NEED_INSTALL_FIX=${NEED_INSTALL_FIX//setools/setools-console} 2>&1
|
||||||
|
NEED_INSTALL_FIX=${NEED_INSTALL_FIX//whiptail/dialog} 2>&1
|
||||||
|
NEED_INSTALL_FIX=${NEED_INSTALL_FIX//xz-utils/xz} 2>&1
|
||||||
|
} >> /dev/null
|
||||||
|
|
||||||
readarray -td ' ' NEED_INSTALL <<<"$NEED_INSTALL_FIX "; unset 'NEED_INSTALL[-1]';
|
readarray -td ' ' NEED_INSTALL <<<"$NEED_INSTALL_FIX "; unset 'NEED_INSTALL[-1]';
|
||||||
elif [ "$PM" = "apk" ]; then
|
elif [ "$PM" = "apk" ]; then
|
||||||
NEED_INSTALL_FIX=${NEED_INSTALL[*]}
|
NEED_INSTALL_FIX=${NEED_INSTALL[*]}
|
||||||
@ -223,7 +228,15 @@ if (YesNoBox '([title]="Compress output" [text]="Do you want to compress the out
|
|||||||
else
|
else
|
||||||
COMPRESS_OUTPUT=""
|
COMPRESS_OUTPUT=""
|
||||||
fi
|
fi
|
||||||
|
if [ "$COMPRESS_OUTPUT" = "--compress" ]; then
|
||||||
|
COMPRESS_FORMAT=$(
|
||||||
|
Radiolist '([title]="Compress format"
|
||||||
|
[default]="7z")' \
|
||||||
|
\
|
||||||
|
'7z' "7-Zip" 'on' \
|
||||||
|
'xz' "tar.xz" 'off'
|
||||||
|
)
|
||||||
|
fi
|
||||||
# if ! (YesNoBox '([title]="Off line mode" [text]="Do you want to enable off line mode?")'); then
|
# if ! (YesNoBox '([title]="Off line mode" [text]="Do you want to enable off line mode?")'); then
|
||||||
# OFFLINE="--offline"
|
# OFFLINE="--offline"
|
||||||
# else
|
# else
|
||||||
@ -232,6 +245,6 @@ fi
|
|||||||
# OFFLINE="--offline"
|
# OFFLINE="--offline"
|
||||||
clear
|
clear
|
||||||
declare -A RELEASE_TYPE_MAP=(["retail"]="retail" ["release preview"]="RP" ["insider slow"]="WIS" ["insider fast"]="WIF")
|
declare -A RELEASE_TYPE_MAP=(["retail"]="retail" ["release preview"]="RP" ["insider slow"]="WIS" ["insider fast"]="WIF")
|
||||||
COMMAND_LINE=(--arch "$ARCH" --release-type "${RELEASE_TYPE_MAP[$RELEASE_TYPE]}" --magisk-ver "$MAGISK_VER" --gapps-brand "$GAPPS_BRAND" --gapps-variant "$GAPPS_VARIANT" "$REMOVE_AMAZON" --root-sol "$ROOT_SOL" "$COMPRESS_OUTPUT" "$OFFLINE" "$DEBUG" "$CUSTOM_MAGISK")
|
COMMAND_LINE=(--arch "$ARCH" --release-type "${RELEASE_TYPE_MAP[$RELEASE_TYPE]}" --magisk-ver "$MAGISK_VER" --gapps-brand "$GAPPS_BRAND" --gapps-variant "$GAPPS_VARIANT" "$REMOVE_AMAZON" --root-sol "$ROOT_SOL" "$COMPRESS_OUTPUT" "$OFFLINE" "$DEBUG" "$CUSTOM_MAGISK" --compress-format "$COMPRESS_FORMAT")
|
||||||
echo "COMMAND_LINE=${COMMAND_LINE[*]}"
|
echo "COMMAND_LINE=${COMMAND_LINE[*]}"
|
||||||
./build.sh "${COMMAND_LINE[@]}"
|
./build.sh "${COMMAND_LINE[@]}"
|
||||||
|
Loading…
Reference in New Issue
Block a user