From 81d59ad9dda197c13515bf80da727845d0d8646e Mon Sep 17 00:00:00 2001 From: Howard Wu Date: Sun, 19 Mar 2023 19:34:31 +0800 Subject: [PATCH] Refine menu (#427) Close #426 --- scripts/run.sh | 75 ++++++++++++++++++++++---------------------------- 1 file changed, 33 insertions(+), 42 deletions(-) diff --git a/scripts/run.sh b/scripts/run.sh index 59b090b..8e9103f 100755 --- a/scripts/run.sh +++ b/scripts/run.sh @@ -48,7 +48,6 @@ function YesNoBox { ARCH=$( Radiolist '([title]="Build arch" [default]="x64")' \ - \ 'x64' "X86_64" 'on' \ 'arm64' "AArch64" 'off' ) @@ -56,34 +55,42 @@ ARCH=$( RELEASE_TYPE=$( Radiolist '([title]="WSA release type" [default]="retail")' \ - \ 'retail' "Stable Channel" 'on' \ 'release preview' "Release Preview Channel" 'off' \ 'insider slow' "Beta 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=$( Radiolist '([title]="Magisk version" - [default]="stable")' \ - \ + [default]="stable")' \ 'stable' "Stable Channel" 'on' \ 'beta' "Beta Channel" 'off' \ 'canary' "Canary Channel" 'off' \ 'debug' "Canary Channel Debug Build" 'off' ) else - MAGISK_VER=debug + MAGISK_VER=stable fi if (YesNoBox '([title]="Install GApps" [text]="Do you want to install GApps?")'); then GAPPS_BRAND=$( Radiolist '([title]="Which GApps do you want to install?" - [default]="MindTheGapps")' \ - \ - 'OpenGApps' "This flavor may cause startup failure" 'off' \ - 'MindTheGapps' "Recommend" 'on' + [default]="MindTheGapps")' \ + 'MindTheGapps' "Recommend" 'on' \ + 'OpenGApps' "This flavor may cause startup failure" 'off' ) else GAPPS_BRAND="none" @@ -91,20 +98,19 @@ fi if [ "$GAPPS_BRAND" = "OpenGApps" ]; then # TODO: Keep it pico since other variants of opengapps are unable to boot successfully if [ "$DEBUG" = "1" ]; then - GAPPS_VARIANT=$( - Radiolist '([title]="Variants of GApps" - [default]="pico")' \ - \ - 'super' "" 'off' \ - 'stock' "" 'off' \ - 'full' "" 'off' \ - 'mini' "" 'off' \ - 'micro' "" 'off' \ - 'nano' "" 'off' \ - 'pico' "" 'on' \ - 'tvstock' "" 'off' \ - 'tvmini' "" 'off' - ) + GAPPS_VARIANT=$( + Radiolist '([title]="Variants of GApps" + [default]="pico")' \ + 'super' "" 'off' \ + 'stock' "" 'off' \ + 'full' "" 'off' \ + 'mini' "" 'off' \ + 'micro' "" 'off' \ + 'nano' "" 'off' \ + 'pico' "" 'on' \ + 'tvstock' "" 'off' \ + 'tvmini' "" 'off' + ) else GAPPS_VARIANT=pico fi @@ -118,15 +124,6 @@ else REMOVE_AMAZON="--remove-amazon" 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 COMPRESS_OUTPUT="--compress" else @@ -135,19 +132,13 @@ fi if [ "$COMPRESS_OUTPUT" = "--compress" ]; then COMPRESS_FORMAT=$( Radiolist '([title]="Compress format" - [default]="7z")' \ - \ + [default]="7z")' \ 'zip' "Zip" 'off' \ '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 -# OFFLINE="" -# 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" --compress-format "$COMPRESS_FORMAT")