1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-11-26 07:55:01 +00:00

bsdconfig: Restore bsddialog

Readd bsddialog(1) to bsdconfig(8).

This can be considered an increment not a replacement: `$DIALOG=dialog'
restores dialog(1), no change for Xdialog(1). An exception is if an
error occurs, bsddialog(1) replaces dialog.
This commit is contained in:
Alfonso S. Siciliano 2023-10-23 16:11:54 +02:00
parent 0f8b2ba6c6
commit c36b3dbc99
No known key found for this signature in database
GPG Key ID: 3F9EEFACFD371E37
2 changed files with 18 additions and 9 deletions

View File

@ -369,7 +369,7 @@ f_show_info()
if f_have f_dialog_info; then if f_have f_dialog_info; then
f_dialog_info "$msg" f_dialog_info "$msg"
else else
dialog --infobox "$msg" 0 0 bsddialog --infobox "$msg" 0 0
fi fi
} }
@ -390,7 +390,7 @@ f_show_msg()
if f_have f_dialog_msgbox; then if f_have f_dialog_msgbox; then
f_dialog_msgbox "$msg" f_dialog_msgbox "$msg"
else else
dialog --msgbox "$msg" 0 0 bsddialog --msgbox "$msg" 0 0
fi fi
} }
@ -433,7 +433,7 @@ f_yesno()
if f_have f_dialog_yesno; then if f_have f_dialog_yesno; then
f_dialog_yesno "$msg" f_dialog_yesno "$msg"
else else
dialog --yesno "$msg" 0 0 bsddialog --yesno "$msg" 0 0
fi fi
} }
@ -455,7 +455,7 @@ f_noyes()
if f_have f_dialog_noyes; then if f_have f_dialog_noyes; then
f_dialog_noyes "$msg" f_dialog_noyes "$msg"
else else
dialog --defaultno --yesno "$msg" 0 0 bsddialog --defaultno --yesno "$msg" 0 0
fi fi
} }
@ -486,7 +486,7 @@ f_show_help()
if f_have f_dialog_textbox; then if f_have f_dialog_textbox; then
f_dialog_textbox "$file" f_dialog_textbox "$file"
else else
dialog --msgbox "$( cat "$file" 2>&1 )" 0 0 bsddialog --msgbox "$( cat "$file" 2>&1 )" 0 0
fi fi
} }

View File

@ -51,7 +51,7 @@ f_include_lang $BSDCFG_LIBE/include/messages.subr
# Default name of dialog(1) utility # Default name of dialog(1) utility
# NOTE: This is changed to "Xdialog" by the optional `-X' argument # NOTE: This is changed to "Xdialog" by the optional `-X' argument
# #
DIALOG="dialog" DIALOG="bsddialog"
# #
# Default dialog(1) title and backtitle text # Default dialog(1) title and backtitle text
@ -83,6 +83,15 @@ DIALOG_ITEM_HELP=4
export DIALOG_ERROR=254 # sh(1) can't handle the default of `-1' export DIALOG_ERROR=254 # sh(1) can't handle the default of `-1'
DIALOG_ESC=255 DIALOG_ESC=255
#
# Set bsddialog(1) compatibility with dialog(1): exit codes and use_shadow
#
export BSDDIALOG_TIMEOUT=0
export BSDDIALOG_ITEM_HELP=4
export BSDDIALOG_ERROR=254
export BSDDIALOG_ESC=255
export BSDDIALOG_COMPATRC=".dialogrc"
# #
# Default behavior is to call f_dialog_init() automatically when loaded. # Default behavior is to call f_dialog_init() automatically when loaded.
# #
@ -2229,7 +2238,7 @@ f_dialog_init()
if ! f_have $DIALOG; then if ! f_have $DIALOG; then
unset USE_XDIALOG unset USE_XDIALOG
local failed_dialog="$DIALOG" local failed_dialog="$DIALOG"
DIALOG=dialog DIALOG=bsddialog
f_die 1 "$msg_no_such_file_or_directory" "$pgm" "$failed_dialog" f_die 1 "$msg_no_such_file_or_directory" "$pgm" "$failed_dialog"
fi fi
@ -2261,7 +2270,7 @@ f_dialog_init()
if ! f_have xauth; then if ! f_have xauth; then
# Die gracefully, as we [likely] can't use Xdialog(1) # Die gracefully, as we [likely] can't use Xdialog(1)
unset USE_XDIALOG unset USE_XDIALOG
DIALOG=dialog DIALOG=bsddialog
f_die 1 "$msg_no_such_file_or_directory" "$pgm" "xauth" f_die 1 "$msg_no_such_file_or_directory" "$pgm" "xauth"
fi fi
HOSTNAME=$( hostname ) HOSTNAME=$( hostname )
@ -2288,7 +2297,7 @@ f_dialog_init()
local height width local height width
f_dialog_buttonbox_size height width \ f_dialog_buttonbox_size height width \
"$DIALOG_TITLE" "$DIALOG_BACKTITLE" "$maxsize" "$DIALOG_TITLE" "$DIALOG_BACKTITLE" "$maxsize"
dialog \ bsddialog \
--title "$DIALOG_TITLE" \ --title "$DIALOG_TITLE" \
--backtitle "$DIALOG_BACKTITLE" \ --backtitle "$DIALOG_BACKTITLE" \
--ok-label "$msg_ok" \ --ok-label "$msg_ok" \