Refine menu (#427)

Close #426
This commit is contained in:
Howard Wu 2023-03-19 19:34:31 +08:00 committed by GitHub
parent 960760f07c
commit 81d59ad9dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -48,7 +48,6 @@ function YesNoBox {
ARCH=$( ARCH=$(
Radiolist '([title]="Build arch" Radiolist '([title]="Build arch"
[default]="x64")' \ [default]="x64")' \
\
'x64' "X86_64" 'on' \ 'x64' "X86_64" 'on' \
'arm64' "AArch64" 'off' 'arm64' "AArch64" 'off'
) )
@ -56,34 +55,42 @@ ARCH=$(
RELEASE_TYPE=$( RELEASE_TYPE=$(
Radiolist '([title]="WSA release type" Radiolist '([title]="WSA release type"
[default]="retail")' \ [default]="retail")' \
\
'retail' "Stable Channel" 'on' \ 'retail' "Stable Channel" 'on' \
'release preview' "Release Preview Channel" 'off' \ 'release preview' "Release Preview Channel" 'off' \
'insider slow' "Beta Channel" 'off' \ 'insider slow' "Beta Channel" 'off' \
'insider fast' "Dev Channel" 'off' 'insider fast' "Dev Channel" 'off'
) )
if [ -z "${CUSTOM_MAGISK+x}" ]; then if (YesNoBox '([title]="Root" [text]="Do you want to Root WSA?")'); then
ROOT_SOL=$(
Radiolist '([title]="Root solution"
[default]="magisk")' \
'magisk' "Magisk" 'on' \
'kernelsu' "KernelSU" 'off'
)
else
ROOT_SOL="none"
fi
if [ "$ROOT_SOL" = "magisk" ]; then
MAGISK_VER=$( MAGISK_VER=$(
Radiolist '([title]="Magisk version" Radiolist '([title]="Magisk version"
[default]="stable")' \ [default]="stable")' \
\
'stable' "Stable Channel" 'on' \ 'stable' "Stable Channel" 'on' \
'beta' "Beta Channel" 'off' \ 'beta' "Beta Channel" 'off' \
'canary' "Canary Channel" 'off' \ 'canary' "Canary Channel" 'off' \
'debug' "Canary Channel Debug Build" 'off' 'debug' "Canary Channel Debug Build" 'off'
) )
else else
MAGISK_VER=debug MAGISK_VER=stable
fi fi
if (YesNoBox '([title]="Install GApps" [text]="Do you want to install GApps?")'); then if (YesNoBox '([title]="Install GApps" [text]="Do you want to install GApps?")'); then
GAPPS_BRAND=$( GAPPS_BRAND=$(
Radiolist '([title]="Which GApps do you want to install?" Radiolist '([title]="Which GApps do you want to install?"
[default]="MindTheGapps")' \ [default]="MindTheGapps")' \
\ 'MindTheGapps' "Recommend" 'on' \
'OpenGApps' "This flavor may cause startup failure" 'off' \ 'OpenGApps' "This flavor may cause startup failure" 'off'
'MindTheGapps' "Recommend" 'on'
) )
else else
GAPPS_BRAND="none" GAPPS_BRAND="none"
@ -91,20 +98,19 @@ fi
if [ "$GAPPS_BRAND" = "OpenGApps" ]; then if [ "$GAPPS_BRAND" = "OpenGApps" ]; then
# TODO: Keep it pico since other variants of opengapps are unable to boot successfully # TODO: Keep it pico since other variants of opengapps are unable to boot successfully
if [ "$DEBUG" = "1" ]; then if [ "$DEBUG" = "1" ]; then
GAPPS_VARIANT=$( GAPPS_VARIANT=$(
Radiolist '([title]="Variants of GApps" Radiolist '([title]="Variants of GApps"
[default]="pico")' \ [default]="pico")' \
\ 'super' "" 'off' \
'super' "" 'off' \ 'stock' "" 'off' \
'stock' "" 'off' \ 'full' "" 'off' \
'full' "" 'off' \ 'mini' "" 'off' \
'mini' "" 'off' \ 'micro' "" 'off' \
'micro' "" 'off' \ 'nano' "" 'off' \
'nano' "" 'off' \ 'pico' "" 'on' \
'pico' "" 'on' \ 'tvstock' "" 'off' \
'tvstock' "" 'off' \ 'tvmini' "" 'off'
'tvmini' "" 'off' )
)
else else
GAPPS_VARIANT=pico GAPPS_VARIANT=pico
fi fi
@ -118,15 +124,6 @@ else
REMOVE_AMAZON="--remove-amazon" REMOVE_AMAZON="--remove-amazon"
fi fi
ROOT_SOL=$(
Radiolist '([title]="Root solution"
[default]="magisk")' \
\
'magisk' "Magisk" 'on' \
'kernelsu' "KernelSU" 'off' \
'none' "Without root" 'off'
)
if (YesNoBox '([title]="Compress output" [text]="Do you want to compress the output?")'); then if (YesNoBox '([title]="Compress output" [text]="Do you want to compress the output?")'); then
COMPRESS_OUTPUT="--compress" COMPRESS_OUTPUT="--compress"
else else
@ -135,19 +132,13 @@ fi
if [ "$COMPRESS_OUTPUT" = "--compress" ]; then if [ "$COMPRESS_OUTPUT" = "--compress" ]; then
COMPRESS_FORMAT=$( COMPRESS_FORMAT=$(
Radiolist '([title]="Compress format" Radiolist '([title]="Compress format"
[default]="7z")' \ [default]="7z")' \
\
'zip' "Zip" 'off' \ 'zip' "Zip" 'off' \
'7z' "7-Zip" 'on' \ '7z' "7-Zip" 'on' \
'xz' "tar.xz" 'off' 'xz' "tar.xz" 'off'
) )
fi fi
# if (YesNoBox '([title]="Off line mode" [text]="Do you want to enable off line mode?")'); then
# OFFLINE="--offline"
# else
# OFFLINE=""
# fi
# 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" --compress-format "$COMPRESS_FORMAT") 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")