Page MenuHomeFreeBSD

D34755.id104520.diff
No OneTemporary

D34755.id104520.diff

diff --git a/usr.sbin/bsdconfig/bsdconfig.8 b/usr.sbin/bsdconfig/bsdconfig.8
--- a/usr.sbin/bsdconfig/bsdconfig.8
+++ b/usr.sbin/bsdconfig/bsdconfig.8
@@ -25,7 +25,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd April 12, 2020
+.Dd April 1, 2022
.Dt BSDCONFIG 8
.Os
.Sh NAME
@@ -254,3 +254,5 @@
The docsinstall and diskmgmt modules call bsdinstall.
Bugs found in these modules should be considered those of bsdinstall, not
.Nm .
+If bsddialog is used like frontend a menu could hide the backtitle and the
+behavior with unicode characters is undefined.
diff --git a/usr.sbin/bsdconfig/networking/share/device.subr b/usr.sbin/bsdconfig/networking/share/device.subr
--- a/usr.sbin/bsdconfig/networking/share/device.subr
+++ b/usr.sbin/bsdconfig/networking/share/device.subr
@@ -248,6 +248,12 @@
local retval=$?
f_dialog_data_sanitize tag
+ # tag is not got via f_dialog_menutag_store() or
+ # f_dialog_menutag_fetch() so check here for bsddialog
+ if [ $DIALOG = "bsddialog" ]; then
+ tag="`echo $tag | tr -d '\"'`"
+ fi
+
if [ $retval -eq $DIALOG_HELP ]; then
f_show_help "$TCP_HELPFILE"
continue
diff --git a/usr.sbin/bsdconfig/networking/share/resolv.subr b/usr.sbin/bsdconfig/networking/share/resolv.subr
--- a/usr.sbin/bsdconfig/networking/share/resolv.subr
+++ b/usr.sbin/bsdconfig/networking/share/resolv.subr
@@ -472,6 +472,12 @@
local retval=$?
f_dialog_data_sanitize tag
+ # tag is not got via f_dialog_menutag_store() or
+ # f_dialog_menutag_fetch() so check here for bsddialog
+ if [ $DIALOG = "bsddialog" ]; then
+ tag="`echo $tag | tr -d '\"'`"
+ fi
+
# Return if "Cancel" was chosen (-1) or ESC was pressed (255)
if [ $retval -ne $DIALOG_OK ]; then
return $retval
diff --git a/usr.sbin/bsdconfig/share/dialog.subr b/usr.sbin/bsdconfig/share/dialog.subr
--- a/usr.sbin/bsdconfig/share/dialog.subr
+++ b/usr.sbin/bsdconfig/share/dialog.subr
@@ -51,8 +51,18 @@
#
# Default name of dialog(1) utility
# NOTE: This is changed to "Xdialog" by the optional `-X' argument
+# TUI_UTLITY is used to allow some bsdinstall to use dialog, delete after the
+# replacement process.
#
-DIALOG="dialog"
+# DIALOG="bsddialog"
+DIALOG=${TUI_UTILITY:-bsddialog}
+
+#
+# bsddialog does not provide --keep-tite dialog(1) and Xdialog could use it
+#
+if [ ! $DIALOG = "bsddialog" ]; then
+ WITH_KEEP_TITE=1
+fi
#
# Default dialog(1) title and backtitle text
@@ -74,15 +84,29 @@
unset XDIALOG_INFOBOX_TIMEOUT
#
-# Exit codes for [X]dialog(1)
+# Exit codes
#
+BSDDIALOG_OK=0
+BSDDIALOG_CANCEL=1
+BSDDIALOG_HELP=2
+BSDDIALOG_EXTRA=3
+BSDDIALOG_ESC=5
+BSDDIALOG_ERROR=255
+
DIALOG_OK=${SUCCESS:-0}
DIALOG_CANCEL=${FAILURE:-1}
DIALOG_HELP=2
DIALOG_EXTRA=3
-DIALOG_ITEM_HELP=4
-export DIALOG_ERROR=254 # sh(1) can't handle the default of `-1'
-DIALOG_ESC=255
+
+if [ $DIALOG = "bsddialog" ]; then
+ DIALOG_ITEM_HELP=${BSDDIALOG_HELP} # unused by bsddialog
+ DIALOG_ERROR=${BSDDIALOG_ERROR}
+ DIALOG_ESC=${BSDDIALOG_ESC}
+else
+ DIALOG_ITEM_HELP=4
+ export DIALOG_ERROR=254 # sh(1) can't handle the default of `-1'
+ DIALOG_ESC=255
+fi
#
# Default behavior is to call f_dialog_init() automatically when loaded.
@@ -309,6 +333,11 @@
# usually "MaxSize: 24, 80"
__max_size="${__max_size#*: }"
f_replaceall "$__max_size" "," "" __max_size
+ if [ $DIALOG = "bsddialog" ] ; then
+ f_replaceall "$__max_size" "(" "" __max_size
+ f_replaceall "$__max_size" "-" "" __max_size
+ f_replaceall "$__max_size" ")" "" __max_size
+ fi
else
f_eval_catch -dk __max_size $funcname stty \
'stty size' || __max_size=
@@ -892,6 +921,14 @@
local __title="$4" __btitle="$5" __prompt="$6" __hline="$7"
shift 7 # var_height/var_width/var_rows/title/btitle/prompt/hline
+ if [ "$DIALOG" = "bsddialog" ]; then
+ # libbsddialog handles autosize with a prompt
+ setvar "$__var_height" 0
+ setvar "$__var_width" 0
+ setvar "$__var_rows" 0
+ return
+ fi
+
# Return unless at least one size aspect has been requested
[ "$__var_height" -o "$__var_width" -o "$__var_rows" ] ||
return $FAILURE
@@ -985,6 +1022,14 @@
local __title="$4" __btitle="$5" __prompt="$6" __hline="$7"
shift 7 # var_height/var_width/var_rows/title/btitle/prompt/hline
+ if [ "$DIALOG" = "bsddialog" ]; then
+ # libbsddialog handles autosize with a prompt
+ setvar "$__var_height" 0
+ setvar "$__var_width" 0
+ setvar "$__var_rows" 0
+ return
+ fi
+
# Return unless at least one size aspect has been requested
[ "$__var_height" -o "$__var_width" -o "$__var_rows" ] ||
return $FAILURE
@@ -1090,6 +1135,14 @@
local __title="$4" __btitle="$5" __prompt="$6" __hline="$7"
shift 7 # var_height/var_width/var_rows/title/btitle/prompt/hline
+ if [ "$DIALOG" = "bsddialog" ]; then
+ # libbsddialog handles autosize with a prompt
+ setvar "$__var_height" 0
+ setvar "$__var_width" 0
+ setvar "$__var_rows" 0
+ return
+ fi
+
# Return unless at least one size aspect has been requested
[ "$__var_height" -o "$__var_width" -o "$__var_rows" ] ||
return $FAILURE
@@ -1211,6 +1264,14 @@
local __title="$4" __btitle="$5" __prompt="$6" __hline="$7"
shift 7 # var_height/var_width/var_rows/title/btitle/prompt/hline
+ if [ "$DIALOG" = "bsddialog" ]; then
+ # libbsddialog handles autosize with a prompt
+ setvar "$__var_height" 0
+ setvar "$__var_width" 0
+ setvar "$__var_rows" 0
+ return
+ fi
+
# Return unless at least one size aspect has been requested
[ "$__var_height" -o "$__var_width" -o "$__var_rows" ] ||
return $FAILURE
@@ -1877,6 +1938,12 @@
# Sanitize the menutag before storing it if desired
[ "$sanitize" ] && f_dialog_data_sanitize text
+ # bsddialog quote the itema name if it has a space inside
+ if [ $DIALOG = "bsddialog" ]; then
+ # Actually we need only to delete first and last double quote
+ text="`echo $text | tr -d '\"'`"
+ fi
+
setvar DIALOG_MENU_$$ "$text"
}
@@ -1891,6 +1958,12 @@
{
local __var_to_set="$1" __cp
+ # bsddialog quote the itema name if it has a space inside
+ if [ $DIALOG = "bsddialog" ]; then
+ # Actually we need only to delete first and last double quote
+ __var_to_set="`echo $__var_to_set | tr -d '\"'`"
+ fi
+
debug= f_getvar DIALOG_MENU_$$ "${__var_to_set:-__cp}" # get the data
setvar DIALOG_MENU_$$ "" # scrub memory in case data was sensitive
@@ -2230,7 +2303,8 @@
if ! f_have $DIALOG; then
unset USE_XDIALOG
local failed_dialog="$DIALOG"
- DIALOG=dialog
+ #DIALOG=bsddialog
+ DIALOG=${TUI_UTILITY:-bsddialog}
f_die 1 "$msg_no_such_file_or_directory" "$pgm" "$failed_dialog"
fi
@@ -2262,7 +2336,8 @@
if ! f_have xauth; then
# Die gracefully, as we [likely] can't use Xdialog(1)
unset USE_XDIALOG
- DIALOG=dialog
+ #DIALOG=bsddialog
+ DIALOG=${TUI_UTILITY:-bsddialog}
f_die 1 "$msg_no_such_file_or_directory" "$pgm" "xauth"
fi
HOSTNAME=$( hostname )
diff --git a/usr.sbin/bsdconfig/share/media/any.subr b/usr.sbin/bsdconfig/share/media/any.subr
--- a/usr.sbin/bsdconfig/share/media/any.subr
+++ b/usr.sbin/bsdconfig/share/media/any.subr
@@ -111,6 +111,11 @@
)
local retval=$?
f_dialog_data_sanitize mtag
+ # mtag is not got via f_dialog_menutag_store() or
+ # f_dialog_menutag_fetch() so check here for bsddialog
+ if [ $DIALOG = "bsddialog" ]; then
+ mtag="`echo $mtag | tr -d '\"'`"
+ fi
f_dprintf "retval=%s mtag=[%s]" $retval "$mtag"
if [ $retval -eq $DIALOG_HELP ]; then
diff --git a/usr.sbin/bsdconfig/share/media/wlan.subr b/usr.sbin/bsdconfig/share/media/wlan.subr
--- a/usr.sbin/bsdconfig/share/media/wlan.subr
+++ b/usr.sbin/bsdconfig/share/media/wlan.subr
@@ -1320,6 +1320,13 @@
2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD
) || break
f_dialog_data_sanitize menu_choice
+
+ # menu_choice is not got via f_dialog_menutag_store() or
+ # f_dialog_menutag_fetch() so check here for bsddialog
+ if [ $DIALOG = "bsddialog" ]; then
+ menu_choice="`echo $menu_choice | tr -d '\"'`"
+ fi
+
defaultitem="$menu_choice"
case "$menu_choice" in
diff --git a/usr.sbin/bsdconfig/share/packages/packages.subr b/usr.sbin/bsdconfig/share/packages/packages.subr
--- a/usr.sbin/bsdconfig/share/packages/packages.subr
+++ b/usr.sbin/bsdconfig/share/packages/packages.subr
@@ -489,7 +489,7 @@
--title \"\$DIALOG_TITLE\" \
--backtitle \"\$DIALOG_BACKTITLE\" \
--hline \"\$hline\" \
- --keep-tite \
+ ${WITH_KEEP_TITE:+--keep-tite} \
--ok-label \"$msg_select\" \
--cancel-label \"$msg_back\" \
${SHOW_DESC:+--item-help} \
diff --git a/usr.sbin/bsdconfig/startup/rcdelete b/usr.sbin/bsdconfig/startup/rcdelete
--- a/usr.sbin/bsdconfig/startup/rcdelete
+++ b/usr.sbin/bsdconfig/startup/rcdelete
@@ -215,7 +215,7 @@
--title \"\$DIALOG_TITLE\" \
--backtitle \"\$DIALOG_BACKTITLE\" \
--hline \"\$hline\" \
- --keep-tite \
+ ${WITH_KEEP_TITE:+--keep-tite} \
--ok-label \"\$msg_ok\" \
--cancel-label \"\$msg_cancel\" \
--help-button \
diff --git a/usr.sbin/bsdconfig/startup/rcvar b/usr.sbin/bsdconfig/startup/rcvar
--- a/usr.sbin/bsdconfig/startup/rcvar
+++ b/usr.sbin/bsdconfig/startup/rcvar
@@ -143,7 +143,7 @@
--title \"\$DIALOG_TITLE\" \
--backtitle \"\$DIALOG_BACKTITLE\" \
--hline \"\$hline\" \
- --keep-tite \
+ ${WITH_KEEP_TITE:+--keep-tite} \
--ok-label \"\$msg_ok\" \
--cancel-label \"\$msg_cancel\" \
${SHOW_DESC:+--item-help} \
diff --git a/usr.sbin/bsdconfig/usermgmt/share/user_input.subr b/usr.sbin/bsdconfig/usermgmt/share/user_input.subr
--- a/usr.sbin/bsdconfig/usermgmt/share/user_input.subr
+++ b/usr.sbin/bsdconfig/usermgmt/share/user_input.subr
@@ -1086,7 +1086,7 @@
--ok-label \"\$msg_ok\" \
--cancel-label \"\$msg_cancel\" \
--default-item \"\$defaultitem\" \
- --keep-tite \
+ ${WITH_KEEP_TITE:+--keep-tite} \
--menu \"\$prompt\" \
$height $width $rows \
$menu_list \
@@ -1208,7 +1208,7 @@
--ok-label \"\$msg_ok\" \
--cancel-label \"\$msg_cancel\" \
--default-item \"\$defaultitem\" \
- --keep-tite \
+ ${WITH_KEEP_TITE:+--keep-tite} \
--menu \"\$prompt\" \
$height $width $rows \
$menu_list \
@@ -1322,7 +1322,7 @@
--ok-label \"\$msg_ok\" \
--cancel-label \"\$msg_cancel\" \
--default-item \"\$defaultitem\" \
- --keep-tite \
+ ${WITH_KEEP_TITE:+--keep-tite} \
--menu \"\$prompt\" \
$height $width $rows \
$menu_list \
diff --git a/usr.sbin/bsdinstall/scripts/auto b/usr.sbin/bsdinstall/scripts/auto
--- a/usr.sbin/bsdinstall/scripts/auto
+++ b/usr.sbin/bsdinstall/scripts/auto
@@ -29,6 +29,7 @@
#
############################################################ INCLUDES
+TUI_UTILITY=dialog
BSDCFG_SHARE="/usr/share/bsdconfig"
. $BSDCFG_SHARE/common.subr || exit 1
f_include $BSDCFG_SHARE/dialog.subr
diff --git a/usr.sbin/bsdinstall/scripts/bootconfig b/usr.sbin/bsdinstall/scripts/bootconfig
--- a/usr.sbin/bsdinstall/scripts/bootconfig
+++ b/usr.sbin/bsdinstall/scripts/bootconfig
@@ -30,6 +30,7 @@
FREEBSD_BOOTLABEL="FreeBSD"
+TUI_UTILITY=dialog
BSDCFG_SHARE="/usr/share/bsdconfig"
. $BSDCFG_SHARE/common.subr || exit 1
f_dprintf "%s: loading_includes..." "$0"
diff --git a/usr.sbin/bsdinstall/scripts/docsinstall b/usr.sbin/bsdinstall/scripts/docsinstall
--- a/usr.sbin/bsdinstall/scripts/docsinstall
+++ b/usr.sbin/bsdinstall/scripts/docsinstall
@@ -29,6 +29,7 @@
#
############################################################ INCLUDES
+TUI_UTILITY=dialog
BSDCFG_SHARE="/usr/share/bsdconfig"
. $BSDCFG_SHARE/common.subr || exit 1
f_dprintf "%s: loading includes..." "$0"
diff --git a/usr.sbin/bsdinstall/scripts/hostname b/usr.sbin/bsdinstall/scripts/hostname
--- a/usr.sbin/bsdinstall/scripts/hostname
+++ b/usr.sbin/bsdinstall/scripts/hostname
@@ -29,6 +29,7 @@
#
############################################################ INCLUDES
+TUI_UTILITY=dialog
BSDCFG_SHARE="/usr/share/bsdconfig"
. $BSDCFG_SHARE/common.subr || exit 1
f_dprintf "%s: loading_includes..." "$0"
diff --git a/usr.sbin/bsdinstall/scripts/jail b/usr.sbin/bsdinstall/scripts/jail
--- a/usr.sbin/bsdinstall/scripts/jail
+++ b/usr.sbin/bsdinstall/scripts/jail
@@ -29,6 +29,7 @@
#
############################################################ INCLUDES
+TUI_UTILITY=dialog
BSDCFG_SHARE="/usr/share/bsdconfig"
. $BSDCFG_SHARE/common.subr || exit 1
diff --git a/usr.sbin/bsdinstall/scripts/keymap b/usr.sbin/bsdinstall/scripts/keymap
--- a/usr.sbin/bsdinstall/scripts/keymap
+++ b/usr.sbin/bsdinstall/scripts/keymap
@@ -29,6 +29,7 @@
#
############################################################ INCLUDES
+TUI_UTILITY=dialog
BSDCFG_SHARE="/usr/share/bsdconfig"
. $BSDCFG_SHARE/common.subr || exit 1
f_dprintf "%s: loading includes..." "$0"
diff --git a/usr.sbin/bsdinstall/scripts/netconfig_ipv4 b/usr.sbin/bsdinstall/scripts/netconfig_ipv4
--- a/usr.sbin/bsdinstall/scripts/netconfig_ipv4
+++ b/usr.sbin/bsdinstall/scripts/netconfig_ipv4
@@ -29,6 +29,7 @@
#
############################################################ INCLUDES
+TUI_UTILITY=dialog
BSDCFG_SHARE="/usr/share/bsdconfig"
. $BSDCFG_SHARE/common.subr || exit 1
f_dprintf "%s: loading includes..." "$0"
diff --git a/usr.sbin/bsdinstall/scripts/netconfig_ipv6 b/usr.sbin/bsdinstall/scripts/netconfig_ipv6
--- a/usr.sbin/bsdinstall/scripts/netconfig_ipv6
+++ b/usr.sbin/bsdinstall/scripts/netconfig_ipv6
@@ -33,6 +33,7 @@
#
############################################################ INCLUDES
+TUI_UTILITY=dialog
BSDCFG_SHARE="/usr/share/bsdconfig"
. $BSDCFG_SHARE/common.subr || exit 1
f_dprintf "%s: loading includes..." "$0"
diff --git a/usr.sbin/bsdinstall/scripts/script b/usr.sbin/bsdinstall/scripts/script
--- a/usr.sbin/bsdinstall/scripts/script
+++ b/usr.sbin/bsdinstall/scripts/script
@@ -29,6 +29,7 @@
#
############################################################ INCLUDES
+TUI_UTILITY=dialog
BSDCFG_SHARE="/usr/share/bsdconfig"
. $BSDCFG_SHARE/common.subr || exit 1
f_dprintf "%s: loading includes..." "$0"
diff --git a/usr.sbin/bsdinstall/scripts/wlanconfig b/usr.sbin/bsdinstall/scripts/wlanconfig
--- a/usr.sbin/bsdinstall/scripts/wlanconfig
+++ b/usr.sbin/bsdinstall/scripts/wlanconfig
@@ -29,6 +29,7 @@
#
############################################################ INCLUDES
+TUI_UTILITY=dialog
BSDCFG_SHARE="/usr/share/bsdconfig"
. $BSDCFG_SHARE/common.subr || exit 1
f_include $BSDCFG_SHARE/dialog.subr
diff --git a/usr.sbin/bsdinstall/scripts/zfsboot b/usr.sbin/bsdinstall/scripts/zfsboot
--- a/usr.sbin/bsdinstall/scripts/zfsboot
+++ b/usr.sbin/bsdinstall/scripts/zfsboot
@@ -29,6 +29,7 @@
#
############################################################ INCLUDES
+TUI_UTILITY=dialog
BSDCFG_SHARE="/usr/share/bsdconfig"
. $BSDCFG_SHARE/common.subr || exit 1
f_dprintf "%s: loading includes..." "$0"

File Metadata

Mime Type
text/plain
Expires
Fri, Oct 24, 11:29 AM (14 h, 5 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
24130340
Default Alt Text
D34755.id104520.diff (14 KB)

Event Timeline