mirror of
https://github.com/MustardChef/WSABuilds.git
synced 2025-01-24 17:01:10 +01:00
parent
dcc6dcd9be
commit
1fc795b7fe
@ -148,6 +148,12 @@ ROOT_SOL_MAP=(
|
||||
"magisk"
|
||||
"none"
|
||||
)
|
||||
|
||||
COMPRESS_FORMAT_MAP=(
|
||||
"7z"
|
||||
"xz"
|
||||
)
|
||||
|
||||
ARR_TO_STR() {
|
||||
local arr=("$@")
|
||||
local joined
|
||||
@ -190,9 +196,15 @@ usage() {
|
||||
Possible values: $(ARR_TO_STR "${ROOT_SOL_MAP[@]}")
|
||||
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:
|
||||
--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
|
||||
--magisk-custom Install custom Magisk
|
||||
--debug Debug build mode
|
||||
@ -213,6 +225,7 @@ ARGUMENT_LIST=(
|
||||
"gapps-brand:"
|
||||
"gapps-variant:"
|
||||
"root-sol:"
|
||||
"compress-format:"
|
||||
"remove-amazon"
|
||||
"compress"
|
||||
"offline"
|
||||
@ -240,6 +253,7 @@ while [[ $# -gt 0 ]]; do
|
||||
--gapps-brand ) GAPPS_BRAND="$2"; shift 2 ;;
|
||||
--gapps-variant ) GAPPS_VARIANT="$2"; shift 2 ;;
|
||||
--root-sol ) ROOT_SOL="$2"; shift 2 ;;
|
||||
--compress-format ) COMPRESS_FORMAT="$2"; shift 2 ;;
|
||||
--remove-amazon ) REMOVE_AMAZON="remove"; shift ;;
|
||||
--compress ) COMPRESS_OUTPUT="yes"; shift ;;
|
||||
--offline ) OFFLINE="on"; shift ;;
|
||||
@ -252,6 +266,7 @@ done
|
||||
|
||||
check_list() {
|
||||
local input=$1
|
||||
if [ -n "$input" ]; then
|
||||
local name=$2
|
||||
shift
|
||||
local arr=("$@")
|
||||
@ -266,6 +281,7 @@ check_list() {
|
||||
exit_with_message "Invalid $name: $input"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
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_VARIANT" "GApps Variant" "${GAPPS_VARIANT_MAP[@]}"
|
||||
check_list "$ROOT_SOL" "Root Solution" "${ROOT_SOL_MAP[@]}"
|
||||
check_list "$COMPRESS_FORMAT" "Compress Format" "${COMPRESS_FORMAT_MAP[@]}"
|
||||
|
||||
if [ "$DEBUG" ]; then
|
||||
set -x
|
||||
@ -836,10 +853,20 @@ fi
|
||||
if [ ! -d "$OUTPUT_DIR" ]; then
|
||||
mkdir -p "$OUTPUT_DIR"
|
||||
fi
|
||||
if [ "$COMPRESS_OUTPUT" ]; then
|
||||
rm -f "${OUTPUT_DIR:?}"/"$artifact_name.7z" || abort
|
||||
if [ "$COMPRESS_OUTPUT" ] || [ -n "$COMPRESS_FORMAT" ]; then
|
||||
mv "$WORK_DIR/wsa/$ARCH" "$WORK_DIR/wsa/$artifact_name"
|
||||
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
|
||||
rm -rf "${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 7z > /dev/null 2>&1 || NEED_INSTALL+=("p7zip-full")
|
||||
command -v setfattr > /dev/null 2>&1 || NEED_INSTALL+=("attr")
|
||||
command -v xz > /dev/null 2>&1 || NEED_INSTALL+=("xz-utils")
|
||||
}
|
||||
check_dependencies
|
||||
osrel=$(sed -n '/^ID_LIKE=/s/^.*=//p' /etc/os-release);
|
||||
@ -103,8 +104,12 @@ if [ -n "${NEED_INSTALL[*]}" ]; then
|
||||
else
|
||||
if [ "$PM" = "zypper" ]; then
|
||||
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]';
|
||||
elif [ "$PM" = "apk" ]; then
|
||||
NEED_INSTALL_FIX=${NEED_INSTALL[*]}
|
||||
@ -223,7 +228,15 @@ if (YesNoBox '([title]="Compress output" [text]="Do you want to compress the out
|
||||
else
|
||||
COMPRESS_OUTPUT=""
|
||||
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
|
||||
# OFFLINE="--offline"
|
||||
# else
|
||||
@ -232,6 +245,6 @@ fi
|
||||
# OFFLINE="--offline"
|
||||
clear
|
||||
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[*]}"
|
||||
./build.sh "${COMMAND_LINE[@]}"
|
||||
|
Loading…
x
Reference in New Issue
Block a user