Skip to content

Commit aa1255d

Browse files
committed
refact+fix: dialogs
1 parent 2ae9a21 commit aa1255d

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

‎system/cuos/dialog-edit-network.sh‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ source "${SCRIPT_DIR}/utils.sh"
88
source "${SCRIPT_DIR}/lib-dialog.sh"
99

1010
CONFIG_PATH="${CONFIG_PATH:-"/system.json"}"
11-
if [[ -n "${TEST}" ]]; then
11+
if [[ -n "${TEST:-}" ]]; then
1212
CONFIG_PATH="system.json"
1313
fi
1414

@@ -124,7 +124,7 @@ fi
124124
# Save to new config
125125
echo "${CONFIG_JSON}" >"${CONFIG_PATH}" || exit 1
126126

127-
if [[ -n "${TEST}" ]]; then exit; fi
127+
if [[ -n "${TEST:-}" ]]; then exit; fi
128128

129129
if mode_hostname; then
130130
"${SCRIPT_DIR}/init.sh" --reinit set_hostname

‎system/cuos/lib-dialog.sh‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ cuos_dialog() {
4444

4545
change_vt() {
4646
#alternative: TERM=linux setsid -w openvt -s -e -w -- dialog --clear --yesno Hi 6 40
47-
if [[ -z "${TEST:-}" && -z "${DIALOG_SUB}" ]]; then
47+
if [[ -z "${TEST:-}" && -z "${DIALOG_SUB:-}" ]]; then
4848
export DIALOG_SUB=1
4949

5050
VT_OLD="$(fgconsole)"
@@ -112,7 +112,11 @@ api_stream_size() {
112112
prgbox "$*" "$title" "$h" "$w"
113113
}
114114

115-
yesno() { dialog --backtitle "$BACKTITLE" --title "${2:-Confirm}" --yesno "$1" ${3:-9} ${4:-70}; }
115+
yesno() {
116+
term cuos_dialog \
117+
--title "${2:-Confirm}" \
118+
--yesno "$1" "${3:-9}" "${4:-70}"
119+
}
116120

117121
valid_hostname() {
118122
local h="$1"

0 commit comments

Comments
 (0)