Update build.func
This commit is contained in:
parent
23c037bfd0
commit
ac729f3848
@ -1090,17 +1090,23 @@ select_distribution() {
|
|||||||
[[ "$var_os" == "alpine" ]] && return 0
|
[[ "$var_os" == "alpine" ]] && return 0
|
||||||
|
|
||||||
local default result exitcode
|
local default result exitcode
|
||||||
default="${var_os}"
|
default="${var_os:-debian}"
|
||||||
var_os=""
|
var_os=""
|
||||||
|
|
||||||
|
local debian_flag ubuntu_flag
|
||||||
|
[[ "$default" == "debian" ]] && debian_flag="on" || debian_flag="off"
|
||||||
|
[[ "$default" == "ubuntu" ]] && ubuntu_flag="on" || ubuntu_flag="off"
|
||||||
|
|
||||||
|
printf "DEBUG: default=%s | debian_flag=%s | ubuntu_flag=%s\n" "$default" "$debian_flag" "$ubuntu_flag"
|
||||||
|
|
||||||
while [[ -z "$var_os" ]]; do
|
while [[ -z "$var_os" ]]; do
|
||||||
exec 3>&1
|
exec 3>&1
|
||||||
result=$(dialog --clear \
|
result=$(dialog --clear \
|
||||||
--backtitle "[dev] Proxmox VE Helper Scripts" \
|
--backtitle "[dev] Proxmox VE Helper Scripts" \
|
||||||
--title "DISTRIBUTION" \
|
--title "DISTRIBUTION" \
|
||||||
--radiolist "Choose Distribution:" 15 60 4 \
|
--radiolist "Choose Distribution:" 15 60 4 \
|
||||||
"debian" "" $([[ "$default" == "debian" ]] && printf "on" || printf "off") \
|
"debian" "" "$debian_flag" \
|
||||||
"ubuntu" "" $([[ "$default" == "ubuntu" ]] && printf "on" || printf "off") \
|
"ubuntu" "" "$ubuntu_flag" \
|
||||||
--ok-label "Next" \
|
--ok-label "Next" \
|
||||||
--cancel-label "Exit" \
|
--cancel-label "Exit" \
|
||||||
--extra-button \
|
--extra-button \
|
||||||
@ -1109,18 +1115,28 @@ select_distribution() {
|
|||||||
exitcode=$?
|
exitcode=$?
|
||||||
exec 3>&-
|
exec 3>&-
|
||||||
|
|
||||||
|
printf "DEBUG: exitcode=%s | result=%s\n" "$exitcode" "$result"
|
||||||
|
|
||||||
case "$exitcode" in
|
case "$exitcode" in
|
||||||
0)
|
0)
|
||||||
if [[ "$result" =~ ^(debian|ubuntu)$ ]]; then
|
if [[ "$result" =~ ^(debian|ubuntu)$ ]]; then
|
||||||
var_os="$result"
|
var_os="$result"
|
||||||
printf "%bOperating System: %b%s%b\n" "$OS$BOLD$DGN" "$BGN" "$var_os" "$CL"
|
printf "%bOperating System: %b%s%b\n" "$OS$BOLD$DGN" "$BGN" "$var_os" "$CL"
|
||||||
return 0
|
return 0
|
||||||
|
else
|
||||||
|
printf "DEBUG: Invalid result on OK: '%s'\n" "$result"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
3)
|
3)
|
||||||
|
printf "DEBUG: User pressed Back (exitcode 3)\n"
|
||||||
return 2
|
return 2
|
||||||
;;
|
;;
|
||||||
1 | 255)
|
1 | 255)
|
||||||
|
printf "DEBUG: User pressed Cancel or ESC (exitcode: %s)\n" "$exitcode"
|
||||||
|
return 1
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
printf "DEBUG: Unknown exitcode: %s\n" "$exitcode"
|
||||||
return 1
|
return 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
Loading…
x
Reference in New Issue
Block a user