From f628c47944e7370c8d8c16cdcc6f98871a48be02 Mon Sep 17 00:00:00 2001 From: dteske Date: Thu, 20 Sep 2012 23:44:13 +0000 Subject: [PATCH] Change all invocations of dialog(1) to no-longer require temporary files. This allows bsdconfig to -- like bsdinstall -- operate from read-only media. Reviewed by: adrian (co-mentor) Approved by: adrian (co-mentor) --- usr.sbin/bsdconfig/bsdconfig | 9 +- usr.sbin/bsdconfig/console/console | 9 +- usr.sbin/bsdconfig/console/font | 9 +- usr.sbin/bsdconfig/console/keymap | 9 +- usr.sbin/bsdconfig/console/repeat | 9 +- usr.sbin/bsdconfig/console/saver | 15 +- usr.sbin/bsdconfig/console/screenmap | 9 +- usr.sbin/bsdconfig/console/ttys | 9 +- usr.sbin/bsdconfig/mouse/flags | 6 +- usr.sbin/bsdconfig/mouse/mouse | 9 +- usr.sbin/bsdconfig/mouse/port | 9 +- usr.sbin/bsdconfig/mouse/type | 9 +- usr.sbin/bsdconfig/networking/networking | 9 +- .../bsdconfig/networking/share/device.subr | 16 +- .../bsdconfig/networking/share/hostname.subr | 7 +- .../bsdconfig/networking/share/ipaddr.subr | 7 +- .../bsdconfig/networking/share/media.subr | 14 +- .../bsdconfig/networking/share/netmask.subr | 7 +- .../bsdconfig/networking/share/resolv.subr | 14 +- .../bsdconfig/networking/share/routing.subr | 7 +- .../bsdconfig/password/share/password.subr | 13 +- usr.sbin/bsdconfig/security/kern_securelevel | 9 +- usr.sbin/bsdconfig/security/security | 9 +- usr.sbin/bsdconfig/share/dialog.subr | 52 ++----- usr.sbin/bsdconfig/share/mustberoot.subr | 7 +- usr.sbin/bsdconfig/startup/misc | 16 +- usr.sbin/bsdconfig/startup/rcadd | 9 +- usr.sbin/bsdconfig/startup/rcconf | 9 +- usr.sbin/bsdconfig/startup/rcdelete | 18 ++- usr.sbin/bsdconfig/startup/rcvar | 9 +- usr.sbin/bsdconfig/startup/share/rcconf.subr | 23 ++- usr.sbin/bsdconfig/startup/share/rcedit.subr | 7 +- usr.sbin/bsdconfig/startup/startup | 9 +- usr.sbin/bsdconfig/timezone/timezone | 21 ++- usr.sbin/bsdconfig/usermgmt/groupinput | 6 +- .../bsdconfig/usermgmt/share/group_input.subr | 57 +++++-- .../bsdconfig/usermgmt/share/user_input.subr | 147 +++++++++++++----- usr.sbin/bsdconfig/usermgmt/userinput | 7 +- usr.sbin/bsdconfig/usermgmt/usermgmt | 9 +- 39 files changed, 441 insertions(+), 188 deletions(-) diff --git a/usr.sbin/bsdconfig/bsdconfig b/usr.sbin/bsdconfig/bsdconfig index f3e385b82e3f..ea72d3cf164e 100755 --- a/usr.sbin/bsdconfig/bsdconfig +++ b/usr.sbin/bsdconfig/bsdconfig @@ -177,7 +177,8 @@ dialog_menu_main() \"\" \ $menu_list ) - eval $DIALOG \ + local dialog_menu + dialog_menu=$( eval $DIALOG \ --clear \ --title \"\$title\" \ --backtitle \"\$btitle\" \ @@ -185,7 +186,11 @@ dialog_menu_main() --ok-label \"\$msg_ok\" \ --cancel-label \"\$msg_exit_bsdconfig\" \ --menu \"\$prompt\" $size $menu_list \ - 2> "$DIALOG_TMPDIR/dialog.menu.$$" + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) + local retval=$? + setvar DIALOG_MENU_$$ "$dialog_menu" + return $retval } ############################################################ MAIN diff --git a/usr.sbin/bsdconfig/console/console b/usr.sbin/bsdconfig/console/console index eec65691ca47..73d9f5b186f3 100755 --- a/usr.sbin/bsdconfig/console/console +++ b/usr.sbin/bsdconfig/console/console @@ -68,7 +68,8 @@ dialog_menu_main() \"\$hline\" \ $menu_list ) - eval $DIALOG \ + local dialog_menu + dialog_menu=$( eval $DIALOG \ --clear --title \"\$DIALOG_TITLE\" \ --backtitle \"\$DIALOG_BACKTITLE\" \ --hline \"\$hline\" \ @@ -76,7 +77,11 @@ dialog_menu_main() --cancel-label \"\$msg_cancel\" \ --menu \"\$prompt\" $size \ $menu_list \ - 2> "$DIALOG_TMPDIR/dialog.menu.$$" + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) + local retval=$? + setvar DIALOG_MENU_$$ "$dialog_menu" + return $retval } ############################################################ MAIN diff --git a/usr.sbin/bsdconfig/console/font b/usr.sbin/bsdconfig/console/font index 074f025a2d33..2fe46110bd8a 100755 --- a/usr.sbin/bsdconfig/console/font +++ b/usr.sbin/bsdconfig/console/font @@ -76,7 +76,8 @@ dialog_menu_main() \"\$hline\" \ $menu_list ) - eval $DIALOG \ + local dialog_menu + dialog_menu=$( eval $DIALOG \ --clear --title \"\$DIALOG_TITLE\" \ --backtitle \"\$DIALOG_BACKTITLE\" \ --hline \"\$hline\" \ @@ -84,7 +85,11 @@ dialog_menu_main() --cancel-label \"\$msg_cancel\" \ --menu \"\$prompt\" $size \ $menu_list \ - 2> "$DIALOG_TMPDIR/dialog.menu.$$" + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) + local retval=$? + setvar DIALOG_MENU_$$ "$dialog_menu" + return $retval } ############################################################ MAIN diff --git a/usr.sbin/bsdconfig/console/keymap b/usr.sbin/bsdconfig/console/keymap index ca0e92ec6026..ea1de2db919b 100755 --- a/usr.sbin/bsdconfig/console/keymap +++ b/usr.sbin/bsdconfig/console/keymap @@ -116,7 +116,8 @@ dialog_menu_main() \"\$hline\" \ $menu_list ) - eval $DIALOG \ + local dialog_menu + dialog_menu=$( eval $DIALOG \ --clear --title \"\$DIALOG_TITLE\" \ --backtitle \"\$DIALOG_BACKTITLE\" \ --hline \"\$hline\" \ @@ -124,7 +125,11 @@ dialog_menu_main() --cancel-label \"\$msg_cancel\" \ --menu \"\$prompt\" $size \ $menu_list \ - 2> "$DIALOG_TMPDIR/dialog.menu.$$" + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) + local retval=$? + setvar DIALOG_MENU_$$ "$dialog_menu" + return $retval } ############################################################ MAIN diff --git a/usr.sbin/bsdconfig/console/repeat b/usr.sbin/bsdconfig/console/repeat index 87f1e3c840b0..76d60d119105 100755 --- a/usr.sbin/bsdconfig/console/repeat +++ b/usr.sbin/bsdconfig/console/repeat @@ -66,7 +66,8 @@ dialog_menu_main() \"\$hline\" \ $menu_list ) - eval $DIALOG \ + local dialog_menu + dialog_menu=$( eval $DIALOG \ --clear --title \"\$DIALOG_TITLE\" \ --backtitle \"\$DIALOG_BACKTITLE\" \ --hline \"\$hline\" \ @@ -74,7 +75,11 @@ dialog_menu_main() --cancel-label \"\$msg_cancel\" \ --menu \"\$prompt\" $size \ $menu_list \ - 2> "$DIALOG_TMPDIR/dialog.menu.$$" + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) + local retval=$? + setvar DIALOG_MENU_$$ "$dialog_menu" + return $retval } ############################################################ MAIN diff --git a/usr.sbin/bsdconfig/console/saver b/usr.sbin/bsdconfig/console/saver index f90c837ef5f6..0ec332ca8790 100755 --- a/usr.sbin/bsdconfig/console/saver +++ b/usr.sbin/bsdconfig/console/saver @@ -76,7 +76,8 @@ dialog_menu_main() \"\$hline\" \ $menu_list ) - eval $DIALOG \ + local dialog_menu + dialog_menu=$( eval $DIALOG \ --clear --title \"\$DIALOG_TITLE\" \ --backtitle \"\$DIALOG_BACKTITLE\" \ --hline \"\$hline\" \ @@ -84,7 +85,11 @@ dialog_menu_main() --cancel-label \"\$msg_cancel\" \ --menu \"\$prompt\" $size \ $menu_list \ - 2> "$DIALOG_TMPDIR/dialog.menu.$$" + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) + local retval=$? + setvar DIALOG_MENU_$$ "$dialog_menu" + return $retval } ############################################################ MAIN @@ -174,7 +179,7 @@ while :; do "$prompt" \ "$blanktime" \ "$hline" ) - $DIALOG \ + dialog_inputbox=$( $DIALOG \ --title "$title" \ --backtitle "$btitle" \ --hline "$hline" \ @@ -182,8 +187,10 @@ while :; do --cancel-label "$msg_cancel" \ --inputbox "$prompt" $size \ "$blanktime" \ - 2> "$DIALOG_TMPDIR/dialog.inputbox.$$" + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) retval=$? + setvar DIALOG_INPUTBOX_$$ "$dialog_inputbox" blanktime=$( f_dialog_inputstr ) [ $retval -eq $SUCCESS ] && f_sysrc_set blanktime "$blanktime" diff --git a/usr.sbin/bsdconfig/console/screenmap b/usr.sbin/bsdconfig/console/screenmap index ddcaec82b1ea..bdabe6ada8e3 100755 --- a/usr.sbin/bsdconfig/console/screenmap +++ b/usr.sbin/bsdconfig/console/screenmap @@ -68,7 +68,8 @@ dialog_menu_main() \"\$hline\" \ $menu_list ) - eval $DIALOG \ + local dialog_menu + dialog_menu=$( eval $DIALOG \ --clear --title \"\$DIALOG_TITLE\" \ --backtitle \"\$DIALOG_BACKTITLE\" \ --hline \"\$hline\" \ @@ -76,7 +77,11 @@ dialog_menu_main() --cancel-label \"\$msg_cancel\" \ --menu \"\$prompt\" $size \ $menu_list \ - 2> "$DIALOG_TMPDIR/dialog.menu.$$" + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) + local retval=$? + setvar DIALOG_MENU_$$ "$dialog_menu" + return $retval } ############################################################ MAIN diff --git a/usr.sbin/bsdconfig/console/ttys b/usr.sbin/bsdconfig/console/ttys index e95d2b27806a..fcf45efe63b6 100755 --- a/usr.sbin/bsdconfig/console/ttys +++ b/usr.sbin/bsdconfig/console/ttys @@ -82,7 +82,8 @@ dialog_menu_main() \"\$hline\" \ $TTY_MENU_LIST ) - eval $DIALOG \ + local dialog_menu + dialog_menu=$( eval $DIALOG \ --clear --title \"\$DIALOG_TITLE\" \ --backtitle \"\$DIALOG_BACKTITLE\" \ --hline \"\$hline\" \ @@ -90,7 +91,11 @@ dialog_menu_main() --cancel-label \"\$msg_cancel\" \ --menu \"\$prompt\" $size \ $TTY_MENU_LIST \ - 2> "$DIALOG_TMPDIR/dialog.menu.$$" + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) + local retval=$? + setvar DIALOG_MENU_$$ "$dialog_menu" + return $retval } # ttys_set_type $consterm diff --git a/usr.sbin/bsdconfig/mouse/flags b/usr.sbin/bsdconfig/mouse/flags index d763a6d9b20c..c98904814279 100755 --- a/usr.sbin/bsdconfig/mouse/flags +++ b/usr.sbin/bsdconfig/mouse/flags @@ -90,7 +90,7 @@ size=$( f_dialog_inputbox_size \ "$prompt" \ "$flags" \ "$hline" ) -eval $DIALOG \ +dialog_inputbox=$( eval $DIALOG \ --title \"\$title\" \ --backtitle \"\$btitle\" \ --hline \"\$hline\" \ @@ -98,8 +98,10 @@ eval $DIALOG \ --cancel-label \"\$msg_cancel\" \ --inputbox \"\$prompt\" $size \ \"\$flags\" \ - 2> "$DIALOG_TMPDIR/dialog.inputbox.$$" + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD +) retval=$? +setvar MENU_INPUTBOX_$$ "$dialog_inputbox" flags=$( f_dialog_inputstr ) [ $retval -eq $SUCCESS ] || f_die diff --git a/usr.sbin/bsdconfig/mouse/mouse b/usr.sbin/bsdconfig/mouse/mouse index 4c5d903f55bc..911ea954ee56 100755 --- a/usr.sbin/bsdconfig/mouse/mouse +++ b/usr.sbin/bsdconfig/mouse/mouse @@ -67,7 +67,8 @@ dialog_menu_main() \"\$hline\" \ $menu_list ) - eval $DIALOG \ + local dialog_menu + dialog_menu=$( eval $DIALOG \ --clear --title \"\$DIALOG_TITLE\" \ --backtitle \"\$DIALOG_BACKTITLE\" \ --hline \"\$hline\" \ @@ -75,7 +76,11 @@ dialog_menu_main() --cancel-label \"\$msg_cancel\" \ --menu \"\$prompt\" $size \ $menu_list \ - 2> "$DIALOG_TMPDIR/dialog.menu.$$" + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) + local retval=$? + setvar DIALOG_MENU_$$ "$dialog_menu" + return $retval } ############################################################ MAIN diff --git a/usr.sbin/bsdconfig/mouse/port b/usr.sbin/bsdconfig/mouse/port index aed191700ac9..4ab54a7adecb 100755 --- a/usr.sbin/bsdconfig/mouse/port +++ b/usr.sbin/bsdconfig/mouse/port @@ -68,7 +68,8 @@ dialog_menu_main() \"\$hline\" \ $menu_list ) - eval $DIALOG \ + local dialog_menu + dialog_menu=$( eval $DIALOG \ --clear --title \"\$DIALOG_TITLE\" \ --backtitle \"\$DIALOG_BACKTITLE\" \ --hline \"\$hline\" \ @@ -76,7 +77,11 @@ dialog_menu_main() --cancel-label \"\$msg_cancel\" \ --menu \"\$prompt\" $size \ $menu_list \ - 2> "$DIALOG_TMPDIR/dialog.menu.$$" + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) + local retval=$? + setvar DIALOG_MENU_$$ "$dialog_menu" + return $retval } ############################################################ MAIN diff --git a/usr.sbin/bsdconfig/mouse/type b/usr.sbin/bsdconfig/mouse/type index 83a712212c39..f1e88fb49e6b 100755 --- a/usr.sbin/bsdconfig/mouse/type +++ b/usr.sbin/bsdconfig/mouse/type @@ -72,7 +72,8 @@ dialog_menu_main() \"\$hline\" \ $menu_list ) - eval $DIALOG \ + local dialog_menu + dialog_menu=$( eval $DIALOG \ --clear --title \"\$DIALOG_TITLE\" \ --backtitle \"\$DIALOG_BACKTITLE\" \ --hline \"\$hline\" \ @@ -80,7 +81,11 @@ dialog_menu_main() --cancel-label \"\$msg_cancel\" \ --menu \"\$prompt\" $size \ $menu_list \ - 2> "$DIALOG_TMPDIR/dialog.menu.$$" + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) + local retval=$? + setvar DIALOG_MENU_$$ "$dialog_menu" + return $retval } ############################################################ MAIN diff --git a/usr.sbin/bsdconfig/networking/networking b/usr.sbin/bsdconfig/networking/networking index bbaf2e5f3183..fe3ce1b2242c 100755 --- a/usr.sbin/bsdconfig/networking/networking +++ b/usr.sbin/bsdconfig/networking/networking @@ -65,14 +65,19 @@ dialog_menu_main() \"\$hline\" \ $menu_list ) - eval $DIALOG \ + local dialog_menu + dialog_menu=$( eval $DIALOG \ --clear --title \"\$DIALOG_TITLE\" \ --backtitle \"\$DIALOG_BACKTITLE\" \ --hline \"\$hline\" \ --ok-label \"\$msg_ok\" \ --cancel-label \"\$msg_cancel\" \ --menu \"\" $size $menu_list \ - 2> "$DIALOG_TMPDIR/dialog.menu.$$" + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) + local retval=$? + setvar DIALOG_MENU_$$ "$dialog_menu" + return $retval } ############################################################ MAIN diff --git a/usr.sbin/bsdconfig/networking/share/device.subr b/usr.sbin/bsdconfig/networking/share/device.subr index e74a57986307..17c7467bbae0 100644 --- a/usr.sbin/bsdconfig/networking/share/device.subr +++ b/usr.sbin/bsdconfig/networking/share/device.subr @@ -265,7 +265,8 @@ f_dialog_menu_netdev() \"\$prompt\" \ \"\$hline\" \ $interfaces ) - eval $DIALOG \ + local dialog_menu + dialog_menu=$( eval $DIALOG \ --clear --title \"\$DIALOG_TITLE\" \ --backtitle \"\$DIALOG_BACKTITLE\" \ --hline \"\$hline\" \ @@ -273,7 +274,11 @@ f_dialog_menu_netdev() --cancel-label \"\$msg_cancel\" \ --menu \"\$prompt\" $size \ $interfaces \ - 2> "$DIALOG_TMPDIR/dialog.menu.$$" + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) + local retval=$? + setvar DIALOG_MENU_$$ "$dialog_menu" + return $retval } # f_dialog_menu_netdev_edit $interface $ipaddr $netmask $options $dhcp @@ -330,7 +335,8 @@ f_dialog_menu_netdev_edit() \"\$prompt\" \ \"\$hline\" \ $menu_list ) - eval $DIALOG \ + local dialog_menu + dialog_menu=$( eval $DIALOG \ --clear --title \"\$DIALOG_TITLE\" \ --backtitle \"\$DIALOG_BACKTITLE\" \ --hline \"\$hline\" \ @@ -338,9 +344,11 @@ f_dialog_menu_netdev_edit() --cancel-label \"\$msg_cancel\" \ --menu \"\$prompt\" $size \ $menu_list \ - 2> "$DIALOG_TMPDIR/dialog.menu.$$" + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) local retval=$? + setvar DIALOG_MENU_$$ "$dialog_menu" local tag="$( f_dialog_menutag )" # Return if "Cancel" was chosen (-1) or ESC was pressed (255) diff --git a/usr.sbin/bsdconfig/networking/share/hostname.subr b/usr.sbin/bsdconfig/networking/share/hostname.subr index 54264439149c..fed8679269ea 100644 --- a/usr.sbin/bsdconfig/networking/share/hostname.subr +++ b/usr.sbin/bsdconfig/networking/share/hostname.subr @@ -146,7 +146,8 @@ f_dialog_input_hostname() "$msg" \ "$hostname" \ "$hline" ) - eval $DIALOG \ + local dialog_inputbox + dialog_inputbox=$( eval $DIALOG \ --title \"\$DIALOG_TITLE\" \ --backtitle \"\$DIALOG_BACKTITLE\" \ --hline \"\$hline\" \ @@ -154,9 +155,11 @@ f_dialog_input_hostname() --cancel-label \"\$msg_cancel\" \ --inputbox \"\$msg\" $size \ \"\$hostname\" \ - 2> "$DIALOG_TMPDIR/dialog.inputbox.$$" + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) local retval=$? + setvar DIALOG_INPUTBOX_$$ "$dialog_inputbox" hostname=$( f_dialog_inputstr ) [ $retval -eq $SUCCESS ] || return $retval diff --git a/usr.sbin/bsdconfig/networking/share/ipaddr.subr b/usr.sbin/bsdconfig/networking/share/ipaddr.subr index 06571ca0ae2b..7e858dc296a8 100644 --- a/usr.sbin/bsdconfig/networking/share/ipaddr.subr +++ b/usr.sbin/bsdconfig/networking/share/ipaddr.subr @@ -167,7 +167,8 @@ f_dialog_input_ipaddr() # Loop until the user provides taint-free input. # while :; do - eval $DIALOG \ + local dialog_inputbox + dialog_inputbox=$( eval $DIALOG \ --title \"\$DIALOG_TITLE\" \ --backtitle \"\$DIALOG_BACKTITLE\" \ --hline \"\$hline\" \ @@ -175,9 +176,11 @@ f_dialog_input_ipaddr() --cancel-label \"\$msg_cancel\" \ --inputbox \"\$msg\" $size \ \"\$_ipaddr\" \ - 2> "$DIALOG_TMPDIR/dialog.inputbox.$$" + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) local retval=$? + setvar DIALOG_INPUTBOX_$$ "$dialog_inputbox" _input=$( f_dialog_inputstr ) # diff --git a/usr.sbin/bsdconfig/networking/share/media.subr b/usr.sbin/bsdconfig/networking/share/media.subr index c546220365a2..e7da98ad3e3a 100644 --- a/usr.sbin/bsdconfig/networking/share/media.subr +++ b/usr.sbin/bsdconfig/networking/share/media.subr @@ -123,7 +123,8 @@ f_dialog_input_options() local msg="$( printf "$msg_please_enter_mediaopts" "$interface" )" local hline="$hline_alnum_punc_tab_enter" - $DIALOG \ + local dialog_inputbox + dialog_inputbox=$( $DIALOG \ --title "$DIALOG_TITLE" \ --backtitle "$DIALOG_BACKTITLE" \ --hline "$hline" \ @@ -131,9 +132,11 @@ f_dialog_input_options() --cancel-label "$msg_cancel" \ --inputbox "$msg" 9 70 \ "$options" \ - 2> "$DIALOG_TMPDIR/dialog.inputbox.$$" + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) local retval=$? + setvar DIALOG_INPUTBOX_$$ "$dialog_inputbox" local _options="$( f_dialog_inputstr )" [ $retval -eq $SUCCESS ] && options="$_options" @@ -205,7 +208,8 @@ f_dialog_menu_media_options() local hline="$hline_arrows_tab_enter" - eval $DIALOG \ + local dialog_menu + dialog_menu=$( eval $DIALOG \ --clear --title \"\$DIALOG_TITLE\" \ --backtitle \"\$DIALOG_BACKTITLE\" \ --hline \"\$hline\" \ @@ -213,9 +217,11 @@ f_dialog_menu_media_options() --cancel-label \"\$msg_cancel\" \ --menu \"\$msg\" 21 60 12 \ $supported_media \ - 2> "$DIALOG_TMPDIR/dialog.menu.$$" + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) local retval=$? + setvar DIALOG_MENU_$$ "$dialog_menu" if [ $retval -eq $SUCCESS ]; then local tag="$( f_dialog_menutag )" options=$( eval f_dialog_menutag2item \"\$tag\" \ diff --git a/usr.sbin/bsdconfig/networking/share/netmask.subr b/usr.sbin/bsdconfig/networking/share/netmask.subr index 4fa5be30e971..2f2b37853e68 100644 --- a/usr.sbin/bsdconfig/networking/share/netmask.subr +++ b/usr.sbin/bsdconfig/networking/share/netmask.subr @@ -177,7 +177,8 @@ f_dialog_input_netmask() # Loop until the user provides taint-free input. # while :; do - eval $DIALOG \ + local dialog_inputbox + dialog_inputbox=$( eval $DIALOG \ --title \"\$DIALOG_TITLE\" \ --backtitle \"\$DIALOG_BACKTITLE\" \ --hline \"\$hline\" \ @@ -185,9 +186,11 @@ f_dialog_input_netmask() --cancel-label \"\$msg_cancel\" \ --inputbox \"\$msg\" $size \ \"\$_netmask\" \ - 2> "$DIALOG_TMPDIR/dialog.inputbox.$$" + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) local retval=$? + setvar DIALOG_INPUTBOX_$$ "$dialog_inputbox" _input=$( f_dialog_inputstr ) # diff --git a/usr.sbin/bsdconfig/networking/share/resolv.subr b/usr.sbin/bsdconfig/networking/share/resolv.subr index b635cc1e2062..154748ba52e8 100644 --- a/usr.sbin/bsdconfig/networking/share/resolv.subr +++ b/usr.sbin/bsdconfig/networking/share/resolv.subr @@ -342,7 +342,8 @@ f_dialog_input_nameserver() # while :; do - eval $DIALOG \ + local dialog_inputbox + dialog_inputbox=$( eval $DIALOG \ --title \"\$DIALOG_TITLE\" \ --backtitle \"\$DIALOG_BACKTITLE\" \ --hline \"\$hline\" \ @@ -350,9 +351,11 @@ f_dialog_input_nameserver() --cancel-label \"\$msg_cancel\" \ --inputbox \"\$msg\" $size \ \"\$ns\" \ - 2> "$DIALOG_TMPDIR/dialog.inputbox.$$" + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) local retval=$? + setvar DIALOG_INPUTBOX_$$ "$dialog_inputbox" new_ns=$( f_dialog_inputstr ) [ $retval -eq $SUCCESS ] || return $retval @@ -476,7 +479,8 @@ f_dialog_menu_nameservers() \"\$prompt\" \ \"\$hline\" \ $menu_list ) - eval $DIALOG \ + local dialog_menu + dialog_menu=$( eval $DIALOG \ --clear --title \"\$DIALOG_TITLE\" \ --backtitle \"\$DIALOG_BACKTITLE\" \ --hline \"\$hline\" \ @@ -484,9 +488,11 @@ f_dialog_menu_nameservers() --cancel-label \"\$msg_cancel\" \ --menu \"\$prompt\" $size \ $menu_list \ - 2> "$DIALOG_TMPDIR/dialog.menu.$$" + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) local retval=$? + setvar DIALOG_MENU_$$ "$dialog_menu" local tag="$( f_dialog_menutag )" ns="" # Return if "Cancel" was chosen (-1) or ESC was pressed (255) diff --git a/usr.sbin/bsdconfig/networking/share/routing.subr b/usr.sbin/bsdconfig/networking/share/routing.subr index c6b6aedf9f39..b8ccdcd6f987 100644 --- a/usr.sbin/bsdconfig/networking/share/routing.subr +++ b/usr.sbin/bsdconfig/networking/share/routing.subr @@ -110,7 +110,8 @@ f_dialog_input_defaultrouter() # Loop until the user provides taint-free input. # while :; do - eval $DIALOG \ + local dialog_inputbox + dialog_inputbox=$( eval $DIALOG \ --title \"\$DIALOG_TITLE\" \ --backtitle \"\$DIALOG_BACKTITLE\" \ --hline \"\$hline\" \ @@ -118,9 +119,11 @@ f_dialog_input_defaultrouter() --cancel-label \"\$msg_cancel\" \ --inputbox \"\$msg\" $size \ \"\$defaultrouter\" \ - 2> "$DIALOG_TMPDIR/dialog.inputbox.$$" + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) local retval=$? + setvar DIALOG_INPUTBOX_$$ "$dialog_inputbox" defaultrouter=$( f_dialog_inputstr ) [ "$defaultrouter" ] || return $SUCCESS diff --git a/usr.sbin/bsdconfig/password/share/password.subr b/usr.sbin/bsdconfig/password/share/password.subr index 550d2aa7c656..a0d1c502a3d4 100644 --- a/usr.sbin/bsdconfig/password/share/password.subr +++ b/usr.sbin/bsdconfig/password/share/password.subr @@ -68,7 +68,8 @@ f_dialog_input_password() # local retval _password1 _password2 while :; do - eval $DIALOG \ + local dialog_inputbox + dialog_inputbox=$( eval $DIALOG \ --title \"\$DIALOG_TITLE\" \ --backtitle \"\$DIALOG_BACKTITLE\" \ --hline \"\$hline\" \ @@ -76,15 +77,17 @@ f_dialog_input_password() --cancel-label \"\$msg_cancel\" \ --insecure \ --passwordbox \"\$msg\" $size \ - 2> $DIALOG_TMPDIR/dialog.inputbox.$$ + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) retval=$? + setvar DIALOG_INPUTBOX_$$ "$dialog_inputbox" _password1=$( f_dialog_inputstr ) # Return if user has either pressed ESC or chosen Cancel/No [ $retval -eq $SUCCESS ] || return $retval - eval $DIALOG \ + dialog_inputbox=$( eval $DIALOG \ --title \"\$DIALOG_TITLE\" \ --backtitle \"\$DIALOG_BACKTITLE\" \ --hline \"\$hline\" \ @@ -92,9 +95,11 @@ f_dialog_input_password() --cancel-label \"\$msg_cancel\" \ --insecure \ --passwordbox \"\$rmsg\" $rsize \ - 2> $DIALOG_TMPDIR/dialog.inputbox.$$ + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) retval=$? + setvar DIALOG_INPUTBOX_$$ "$dialog_inputbox" _password2=$( f_dialog_inputstr ) # Return if user has either pressed ESC or chosen Cancel/No diff --git a/usr.sbin/bsdconfig/security/kern_securelevel b/usr.sbin/bsdconfig/security/kern_securelevel index b28459282280..c48691ecb586 100755 --- a/usr.sbin/bsdconfig/security/kern_securelevel +++ b/usr.sbin/bsdconfig/security/kern_securelevel @@ -67,7 +67,8 @@ dialog_menu_main() \"\$hline\" \ $menu_list ) - eval $DIALOG \ + local dialog_menu + dialog_menu=$( eval $DIALOG \ --clear --title \"\$DIALOG_TITLE\" \ --backtitle \"\$DIALOG_BACKTITLE\" \ --hline \"\$hline\" \ @@ -75,7 +76,11 @@ dialog_menu_main() --cancel-label \"\$msg_cancel\" \ --menu \"\$prompt\" $size \ $menu_list \ - 2> "$DIALOG_TMPDIR/dialog.menu.$$" + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) + local retval=$? + setvar DIALOG_MENU_$$ "$dialog_menu" + return $retval } ############################################################ MAIN diff --git a/usr.sbin/bsdconfig/security/security b/usr.sbin/bsdconfig/security/security index facdbea64535..3dd71c56119f 100755 --- a/usr.sbin/bsdconfig/security/security +++ b/usr.sbin/bsdconfig/security/security @@ -86,7 +86,8 @@ dialog_menu_main() \"\$hline\" \ $menu_list ) - eval $DIALOG \ + local dialog_menu + dialog_menu=$( eval $DIALOG \ --clear --title \"\$DIALOG_TITLE\" \ --backtitle \"\$DIALOG_BACKTITLE\" \ --hline \"\$hline\" \ @@ -94,7 +95,11 @@ dialog_menu_main() --cancel-label \"\$msg_cancel\" \ --menu \"\$prompt\" $size \ $menu_list \ - 2> "$DIALOG_TMPDIR/dialog.menu.$$" + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) + local retval=$? + setvar DIALOG_MENU_$$ "$dialog_menu" + return $retval } ############################################################ MAIN diff --git a/usr.sbin/bsdconfig/share/dialog.subr b/usr.sbin/bsdconfig/share/dialog.subr index cced388af2e0..d2ba529f323c 100644 --- a/usr.sbin/bsdconfig/share/dialog.subr +++ b/usr.sbin/bsdconfig/share/dialog.subr @@ -38,9 +38,11 @@ f_include_lang $BSDCFG_LIBE/include/messages.subr ############################################################ CONFIGURATION # -# Default directory to store dialog(1) temporary files +# Default file descriptor to link to stdout for dialog(1) passthru allowing +# execution of dialog from within a sub-shell (so-long as its standard output +# is explicitly redirected to this file descriptor). # -: ${DIALOG_TMPDIR:="/tmp"} +: ${DIALOG_TERMINAL_PASSTHRU_FD:=3} ############################################################ GLOBALS @@ -1108,12 +1110,8 @@ f_dialog_noyes() # f_dialog_inputstr() { - local tmpfile="$DIALOG_TMPDIR/dialog.inputbox.$$" - - [ -f "$tmpfile" ] || return $FAILURE - # Skip warnings and trim leading/trailing whitespace from user input - awk ' + eval echo \"\$DIALOG_INPUTBOX_$$\" | awk ' BEGIN { found = 0 } { if ( ! found ) @@ -1126,9 +1124,8 @@ f_dialog_inputstr() sub(/[[:space:]]*$/, "") print } - ' "$tmpfile" 2> /dev/null - f_quietly rm -f "$tmpfile" - + ' + setvar DIALOG_INPUTBOX_$$ "" # scrub memory in case data was sensitive return $SUCCESS } @@ -1141,11 +1138,8 @@ f_dialog_inputstr() # f_dialog_menutag() { - local tmpfile="$DIALOG_TMPDIR/dialog.menu.$$" - - [ -f "$tmpfile" ] || return $FAILURE - - awk ' + # Skip warnings + eval echo \"\$DIALOG_MENU_$$\" | awk ' BEGIN { found = 0 } { if ( found ) # ... just spew @@ -1158,9 +1152,8 @@ f_dialog_menutag() found = 1 print } - ' "$tmpfile" 2> /dev/null - f_quietly rm -f "$tmpfile" - + ' + setvar DIALOG_MENU_$$ "" # scrub memory in case data was sensitive return $SUCCESS } @@ -1319,6 +1312,11 @@ f_dialog_init() { DIALOG_SELF_INITIALIZE= + # + # Clone terminal stdout so we can redirect to it from within sub-shells + # + eval exec $DIALOG_TERMINAL_PASSTHRU_FD\>\&1 + # # Process stored command-line arguments # @@ -1422,22 +1420,4 @@ f_dialog_init() fi } -############################################################ CLEAN-UP FUNCTIONS - -# f_clean_up -# -# Clean-up routines (run when script exits or is killed). -# -f_clean_up() -{ - f_quietly rm -f "$DIALOG_TMPDIR"/dialog.*.$$ -} - -############################################################ MAIN - -# -# Trap signals so we can recover gracefully -# -trap 'f_clean_up' EXIT - fi # ! $_DIALOG_SUBR diff --git a/usr.sbin/bsdconfig/share/mustberoot.subr b/usr.sbin/bsdconfig/share/mustberoot.subr index ec3e16a3547f..c6514c0d4b1e 100644 --- a/usr.sbin/bsdconfig/share/mustberoot.subr +++ b/usr.sbin/bsdconfig/share/mustberoot.subr @@ -119,7 +119,8 @@ f_become_root_via_sudo() [ $retval -eq 255 ] && f_die $retval "$password" else - $DIALOG \ + local dialog_inputbox + dialog_inputbox=$( $DIALOG \ --title "$DIALOG_TITLE" \ --backtitle "$DIALOG_BACKTITLE" \ --hline "$hline" \ @@ -127,8 +128,10 @@ f_become_root_via_sudo() --cancel-label "$msg_cancel" \ --insecure \ --passwordbox "$msg" $size \ - 2> "$DIALOG_TMPDIR/dialog.inputbox.$$" + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) retval=$? + setvar DIALOG_INPUTBOX_$$ "$dialog_inputbox" password=$( f_dialog_inputstr ) fi diff --git a/usr.sbin/bsdconfig/startup/misc b/usr.sbin/bsdconfig/startup/misc index f4a0e1a9de8f..3879c5714679 100755 --- a/usr.sbin/bsdconfig/startup/misc +++ b/usr.sbin/bsdconfig/startup/misc @@ -230,7 +230,8 @@ dialog_menu_main() \"\$hline\" \ $menu_list ) - eval $DIALOG \ + local dialog_menu + dialog_menu=$( eval $DIALOG \ --clear --title \"\$DIALOG_TITLE\" \ --backtitle \"\$DIALOG_BACKTITLE\" \ --hline \"\$hline\" \ @@ -238,7 +239,11 @@ dialog_menu_main() --cancel-label \"\$msg_cancel\" \ --menu \"\$prompt\" $size \ $menu_list \ - 2> "$DIALOG_TMPDIR/dialog.menu.$$" + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) + local retval=$? + setvar DIALOG_MENU_$$ "$dialog_menu" + return $retval } # dialog_input_value [ $prompt [ $init ] ] @@ -260,7 +265,8 @@ dialog_input_value() "$_input" \ "$hline" ) - eval $DIALOG \ + local dialog_inputbox + dialog_inputbox=$( eval $DIALOG \ --title \"\$DIALOG_TITLE\" \ --backtitle \"\$DIALOG_BACKTITLE\" \ --hline \"\$hline\" \ @@ -268,9 +274,11 @@ dialog_input_value() --cancel-label \"\$msg_cancel\" \ --inputbox \"\$prompt\" $size \ \"\$_input\" \ - 2> $DIALOG_TMPDIR/dialog.inputbox.$$ + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) retval=$? + setvar DIALOG_INPUTBOX_$$ "$dialog_inputbox" _input=$( f_dialog_inputstr ) f_dialog_title_restore diff --git a/usr.sbin/bsdconfig/startup/rcadd b/usr.sbin/bsdconfig/startup/rcadd index 49138f546f14..d9d6a045353d 100755 --- a/usr.sbin/bsdconfig/startup/rcadd +++ b/usr.sbin/bsdconfig/startup/rcadd @@ -72,7 +72,8 @@ dialog_menu_main() \"\$hline\" \ $menu_list ) - eval $DIALOG \ + local dialog_menu + dialog_menu=$( eval $DIALOG \ --clear --title \"\$DIALOG_TITLE\" \ --backtitle \"\$DIALOG_BACKTITLE\" \ --hline \"\$hline\" \ @@ -80,7 +81,11 @@ dialog_menu_main() --cancel-label \"\$msg_cancel\" \ --menu \"\$prompt\" $size \ $menu_list \ - 2> "$DIALOG_TMPDIR/dialog.menu.$$" + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) + local retval=$? + setvar DIALOG_MENU_$$ "$dialog_menu" + return $retval } ############################################################ MAIN diff --git a/usr.sbin/bsdconfig/startup/rcconf b/usr.sbin/bsdconfig/startup/rcconf index 4deff5353db9..3f7c25049ea3 100755 --- a/usr.sbin/bsdconfig/startup/rcconf +++ b/usr.sbin/bsdconfig/startup/rcconf @@ -168,7 +168,8 @@ dialog_menu_main() \"\$hline\" \ $RCCONF_MENU_LIST ) - eval $DIALOG \ + local dialog_menu + dialog_menu=$( eval $DIALOG \ --clear --title \"\$DIALOG_TITLE\" \ --backtitle \"\$DIALOG_BACKTITLE\" \ --hline \"\$hline\" \ @@ -179,7 +180,11 @@ dialog_menu_main() ${SHOW_DESC:+--item-help} \ --menu \"\$prompt\" $size \ $RCCONF_MENU_LIST \ - 2> "$DIALOG_TMPDIR/dialog.menu.$$" + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) + local retval=$? + setvar DIALOG_MENU_$$ "$dialog_menu" + return $retval } ############################################################ MAIN diff --git a/usr.sbin/bsdconfig/startup/rcdelete b/usr.sbin/bsdconfig/startup/rcdelete index bef9651fdcd2..a97025838c08 100755 --- a/usr.sbin/bsdconfig/startup/rcdelete +++ b/usr.sbin/bsdconfig/startup/rcdelete @@ -175,7 +175,8 @@ dialog_menu_main() \"\$hline\" \ $RCCONF_MENU_LIST ) - eval $DIALOG \ + local dialog_menu + dialog_menu=$( eval $DIALOG \ --clear --title \"\$DIALOG_TITLE\" \ --backtitle \"\$DIALOG_BACKTITLE\" \ --hline \"\$hline\" \ @@ -186,7 +187,11 @@ dialog_menu_main() ${SHOW_DESC:+--item-help} \ --menu \"\$prompt\" $size \ $RCCONF_MENU_LIST \ - 2> "$DIALOG_TMPDIR/dialog.menu.$$" + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) + local retval=$? + setvar DIALOG_MENU_$$ "$dialog_menu" + return $retval } # dialog_menu_delete $var1 [$var2 ...] @@ -240,7 +245,8 @@ dialog_menu_delete() local defaultno="defaultno" [ "$USE_XDIALOG" ] && defaultno="default-no" - eval $DIALOG \ + local dialog_menu + dialog_menu=$( eval $DIALOG \ --clear --title \"\$DIALOG_TITLE\" \ --backtitle \"\$DIALOG_BACKTITLE\" \ --hline \"\$hline\" \ @@ -249,7 +255,11 @@ dialog_menu_delete() --cancel-label \"\$msg_cancel\" \ --menu \"\$prompt\" $size \ $menu_list \ - 2> "$DIALOG_TMPDIR/dialog.menu.$$" + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) + local retval=$? + setvar DIALOG_MENU_$$ "$dialog_menu" + return $retval } ############################################################ MAIN diff --git a/usr.sbin/bsdconfig/startup/rcvar b/usr.sbin/bsdconfig/startup/rcvar index 10e9baf71243..799dd3426b1b 100755 --- a/usr.sbin/bsdconfig/startup/rcvar +++ b/usr.sbin/bsdconfig/startup/rcvar @@ -132,7 +132,8 @@ dialog_menu_main() \"\$hline\" \ $RCVAR_MENU_LIST ) - eval $DIALOG \ + local dialog_menu + dialog_menu=$( eval $DIALOG \ --clear --title \"\$DIALOG_TITLE\" \ --backtitle \"\$DIALOG_BACKTITLE\" \ --hline \"\$hline\" \ @@ -141,7 +142,11 @@ dialog_menu_main() ${SHOW_DESC:+--item-help} \ --menu \"\$prompt\" $size \ $RCVAR_MENU_LIST \ - 2> "$DIALOG_TMPDIR/dialog.menu.$$" + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) + local retval=$? + setvar DIALOG_MENU_$$ "$dialog_menu" + return $retval } ############################################################ MAIN diff --git a/usr.sbin/bsdconfig/startup/share/rcconf.subr b/usr.sbin/bsdconfig/startup/share/rcconf.subr index 96659d05a0e9..25dec5478433 100644 --- a/usr.sbin/bsdconfig/startup/share/rcconf.subr +++ b/usr.sbin/bsdconfig/startup/share/rcconf.subr @@ -282,7 +282,8 @@ f_dialog_input_view_details() f_dialog_title "$msg_choose_view_details" - eval $DIALOG \ + local dialog_menu + dialog_menu=$( eval $DIALOG \ --title \"\$DIALOG_TITLE\" \ --backtitle \"\$DIALOG_BACKTITLE\" \ --hline \"\$hline\" \ @@ -290,9 +291,11 @@ f_dialog_input_view_details() --cancel-label \"\$msg_cancel\" \ --menu \"\$prompt\" $size \ $menu_list \ - 2> "$DIALOG_TMPDIR/dialog.menu.$$" + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) local retval=$? + setvar DIALOG_MENU_$$ "$dialog_menu" local mtag="$( f_dialog_menutag )" f_dialog_title_restore @@ -390,7 +393,8 @@ f_dialog_input_rclist() \"\$hline\" \ $menu_list ) - eval $DIALOG \ + local dialog_menu + dialog_menu=$( eval $DIALOG \ --title \"\$DIALOG_TITLE\" \ --backtitle \"\$DIALOG_BACKTITLE\" \ --hline \"\$hline\" \ @@ -399,7 +403,11 @@ f_dialog_input_rclist() ${SHOW_DESC:+--item-help} \ --menu \"\$prompt\" $size \ $menu_list \ - 2> "$DIALOG_TMPDIR/dialog.menu.$$" + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) + local retval=$? + setvar DIALOG_MENU_$$ "$dialog_menu" + return $retval } # f_dialog_input_rcvar [$init] @@ -425,7 +433,8 @@ f_dialog_input_rcvar() "$_input" \ "$hline" ) - eval $DIALOG \ + local dialog_inputbox + dialog_inputbox=$( eval $DIALOG \ --title \"\$DIALOG_TITLE\" \ --backtitle \"\$DIALOG_BACKTITLE\" \ --hline \"\$hline\" \ @@ -433,9 +442,11 @@ f_dialog_input_rcvar() --cancel-label \"\$msg_cancel\" \ --inputbox \"\$msg\" $size \ \"\$_input\" \ - 2> $DIALOG_TMPDIR/dialog.inputbox.$$ + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) retval=$? + setvar DIALOG_INPUTBOX_$$ "$dialog_inputbox" _input=$( f_dialog_inputstr ) # Return if user either pressed ESC or chosen Cancel/No diff --git a/usr.sbin/bsdconfig/startup/share/rcedit.subr b/usr.sbin/bsdconfig/startup/share/rcedit.subr index f0b5b59abe2e..909fef27324b 100644 --- a/usr.sbin/bsdconfig/startup/share/rcedit.subr +++ b/usr.sbin/bsdconfig/startup/share/rcedit.subr @@ -77,7 +77,8 @@ f_dialog_rcedit() local opterm="--" [ "$USE_XDIALOG" ] && opterm= - eval $DIALOG \ + local dialog_inputbox + dialog_inputbox=$( eval $DIALOG \ --title \"\$DIALOG_TITLE\" \ --backtitle \"\$DIALOG_BACKTITLE\" \ --hline \"\$hline\" \ @@ -85,9 +86,11 @@ f_dialog_rcedit() --cancel-label \"\$msg_cancel\" \ --inputbox \"\$msg\" $size \ $opterm \"\$_input\" \ - 2> $DIALOG_TMPDIR/dialog.inputbox.$$ + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) retval=$? + setvar DIALOG_INPUTBOX_$$ "$dialog_inputbox" _input=$( f_dialog_inputstr ) # Return if user has either pressed ESC or chosen Cancel/No diff --git a/usr.sbin/bsdconfig/startup/startup b/usr.sbin/bsdconfig/startup/startup index 7bb5d90aa005..c48176195d5f 100755 --- a/usr.sbin/bsdconfig/startup/startup +++ b/usr.sbin/bsdconfig/startup/startup @@ -65,7 +65,8 @@ dialog_menu_main() \"\$hline\" \ $menu_list ) - eval $DIALOG \ + local dialog_menu + dialog_menu=$( eval $DIALOG \ --clear --title \"\$DIALOG_TITLE\" \ --backtitle \"\$DIALOG_BACKTITLE\" \ --hline \"\$hline\" \ @@ -73,7 +74,11 @@ dialog_menu_main() --cancel-label \"\$msg_cancel\" \ --menu \"\$prompt\" $size \ $menu_list \ - 2> "$DIALOG_TMPDIR/dialog.menu.$$" + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) + local retval=$? + setvar DIALOG_MENU_$$ "$dialog_menu" + return $retval } ############################################################ MAIN diff --git a/usr.sbin/bsdconfig/timezone/timezone b/usr.sbin/bsdconfig/timezone/timezone index f785a75ef3f5..02626a6e5f94 100755 --- a/usr.sbin/bsdconfig/timezone/timezone +++ b/usr.sbin/bsdconfig/timezone/timezone @@ -91,14 +91,19 @@ dialog_menu_main() \"\" \ $continent_menu_list ) - eval $DIALOG \ + local dialog_menu + dialog_menu=$( eval $DIALOG \ --title \"\$title\" \ --backtitle \"\$btitle\" \ --ok-label \"\$msg_ok\" \ --cancel-label \"\$msg_cancel\" \ --menu \"\$prompt\" $size \ $continent_menu_list \ - 2> "$DIALOG_TMPDIR/dialog.menu.$$" + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) + local retval=$? + setvar DIALOG_MENU_$$ "$dialog_menu" + return $retval } ############################################################ MAIN @@ -354,15 +359,17 @@ while :; do # # Launch the country selection menu # - eval $DIALOG \ + dialog_menu=$( eval $DIALOG \ --title \"\$title\" \ --backtitle \"\$btitle\" \ --ok-label \"\$msg_ok\" \ --cancel-label \"\$msg_cancel\" \ --menu \"\$prompt\" $size \ $menu_list \ - 2> "$DIALOG_TMPDIR/dialog.menu.$$" + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) retval=$? + setvar DIALOG_MENU_$$ "$dialog_menu" tag=$( f_dialog_menutag ) if [ $retval -ne 0 ]; then @@ -409,15 +416,17 @@ while :; do # Launch the zone selection menu # NOTE: This is as deep as we go # - eval $DIALOG \ + dialog_menu=$( eval $DIALOG \ --title \"\$title\" \ --backtitle \"\$btitle\" \ --ok-label \"\$msg_ok\" \ --cancel-label \"\$msg_cancel\" \ --menu \"\$prompt\" $size \ $menu_list \ - 2> "$DIALOG_TMPDIR/dialog.menu.$$" + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) retval=$? + setvar DIALOG_MENU_$$ "$dialog_menu" n=$( f_dialog_menutag ) if [ $retval -ne 0 ]; then diff --git a/usr.sbin/bsdconfig/usermgmt/groupinput b/usr.sbin/bsdconfig/usermgmt/groupinput index e1df6140070d..2991d336240b 100755 --- a/usr.sbin/bsdconfig/usermgmt/groupinput +++ b/usr.sbin/bsdconfig/usermgmt/groupinput @@ -228,7 +228,7 @@ while :; do \"\$hline\" \ $menu_items ) - eval $DIALOG \ + dialog_menu=$( eval $DIALOG \ --title \"\$DIALOG_TITLE\" \ --backtitle \"\$DIALOG_BACKTITLE\" \ --hline \"\$hline\" \ @@ -236,9 +236,11 @@ while :; do --cancel-label \"\$msg_cancel\" \ --menu \"\$menu_text\" $size \ $menu_items \ - 2> $DIALOG_TMPDIR/dialog.menu.$$ + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) retval=$? + setvar DIALOG_MENU_$$ "$dialog_menu" mtag=$( f_dialog_menutag ) f_dprintf "retval=$retval mtag=[$mtag]" diff --git a/usr.sbin/bsdconfig/usermgmt/share/group_input.subr b/usr.sbin/bsdconfig/usermgmt/share/group_input.subr index 0c616967b48f..e3d59d0bdc2b 100644 --- a/usr.sbin/bsdconfig/usermgmt/share/group_input.subr +++ b/usr.sbin/bsdconfig/usermgmt/share/group_input.subr @@ -84,14 +84,19 @@ f_dialog_menu_group_list() \"\$hline\" \ $menu_list ) - eval $DIALOG \ + local dialog_menu + dialog_menu=$( eval $DIALOG \ --clear --title \"\$DIALOG_TITLE\" \ --backtitle \"\$DIALOG_BACKTITLE\" \ --hline \"\$hline\" \ --ok-label \"\$msg_ok\" \ --cancel-label \"\$msg_cancel\" \ --menu \"\" $size $menu_list \ - 2> "$DIALOG_TMPDIR/dialog.menu.$$" + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) + local retval=$? + setvar DIALOG_MENU_$$ "$dialog_menu" + return $retval } # f_dialog_input_group_name [$group_name] @@ -121,7 +126,8 @@ f_dialog_input_group_name() "$_input" \ "$hline" ) - eval $DIALOG \ + local dialog_inputbox + dialog_inputbox=$( eval $DIALOG \ --title \"\$DIALOG_TITLE\" \ --backtitle \"\$DIALOG_BACKTITLE\" \ --hline \"\$hline\" \ @@ -129,9 +135,11 @@ f_dialog_input_group_name() --cancel-label \"\$msg_cancel\" \ --inputbox \"\$msg\" $size \ \"\$_input\" \ - 2> $DIALOG_TMPDIR/dialog.inputbox.$$ + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) retval=$? + setvar DIALOG_INPUTBOX_$$ "$dialog_inputbox" _input=$( f_dialog_inputstr ) # Return if user has either pressed ESC or chosen Cancel/No @@ -204,7 +212,8 @@ f_dialog_input_group_password() # local retval _password1 _password2 while :; do - eval $DIALOG \ + local dialog_inputbox + dialog_inputbox=$( eval $DIALOG \ --title \"\$DIALOG_TITLE\" \ --backtitle \"\$DIALOG_BACKTITLE\" \ --hline \"\$hline\" \ @@ -212,15 +221,17 @@ f_dialog_input_group_password() --cancel-label \"\$msg_cancel\" \ --insecure \ --passwordbox \"\$msg\" $size \ - 2> $DIALOG_TMPDIR/dialog.inputbox.$$ + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) retval=$? + setvar DIALOG_INPUTBOX_$$ "$dialog_inputbox" _password1=$( f_dialog_inputstr ) # Return if user has either pressed ESC or chosen Cancel/No [ $retval -eq $SUCCESS ] || return $retval - eval $DIALOG \ + dialog_inputbox=$( eval $DIALOG \ --title \"\$DIALOG_TITLE\" \ --backtitle \"\$DIALOG_BACKTITLE\" \ --hline \"\$hline\" \ @@ -228,9 +239,11 @@ f_dialog_input_group_password() --cancel-label \"\$msg_cancel\" \ --insecure \ --passwordbox \"\$rmsg\" $rsize \ - 2> $DIALOG_TMPDIR/dialog.inputbox.$$ + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) retval=$? + setvar DIALOG_INPUTBOX_$$ "$dialog_inputbox" _password2=$( f_dialog_inputstr ) # Return if user has either pressed ESC or chosen Cancel/No @@ -281,7 +294,8 @@ f_dialog_input_group_gid() "$_input" \ "$hline" ) - eval $DIALOG \ + local dialog_inputbox + dialog_inputbox=$( eval $DIALOG \ --title \"\$DIALOG_TITLE\" \ --backtitle \"\$DIALOG_BACKTITLE\" \ --hline \"\$hline\" \ @@ -289,9 +303,11 @@ f_dialog_input_group_gid() --cancel-label \"\$msg_cancel\" \ --inputbox \"\$msg\" $size \ \"\$_input\" \ - 2> $DIALOG_TMPDIR/dialog.inputbox.$$ + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) retval=$? + setvar DIALOG_INPUTBOX_$$ "$dialog_inputbox" _input=$( f_dialog_inputstr ) # Return if user has either pressed ESC or chosen Cancel/No @@ -327,6 +343,7 @@ f_dialog_input_group_members() '2' '$msg_enter_group_members_manually' " # END-QUOTE + local dialog_menu while :; do msg="$msg_group_members:" menu_size=$( eval f_dialog_menu_size \ @@ -335,7 +352,7 @@ f_dialog_input_group_members() \"\$msg\" \ \"\$hline\" \ $menu_list ) - eval $DIALOG \ + dialog_menu=$( eval $DIALOG \ --title \"\$DIALOG_TITLE\" \ --backtitle \"\$DIALOG_BACKTITLE\" \ --hline \"\$hline\" \ @@ -343,8 +360,10 @@ f_dialog_input_group_members() --cancel-label \"\$msg_cancel\" \ --menu \"\$msg\" $menu_size \ $menu_list \ - 2> $DIALOG_TMPDIR/dialog.menu.$$ + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) retval=$? + setvar DIALOG_MENU_$$ "$dialog_menu" menu_choice=$( f_dialog_menutag ) f_dprintf "retval=$retval menu_choice=[$menu_choice]" @@ -373,7 +392,8 @@ f_dialog_input_group_members() \"\" \ \"\$hline\" \ $checklist_users ) - eval $DIALOG \ + local dialog_inputbox + dialog_inputbox=$( eval $DIALOG \ --title \"\$DIALOG_TITLE\" \ --backtitle \"\$DIALOG_BACKTITLE\" \ --separate-output \ @@ -382,8 +402,10 @@ f_dialog_input_group_members() --cancel-label \"\$msg_cancel\" \ --checklist \"\$msg\" $size \ $checklist_users \ - 2> $DIALOG_TMPDIR/dialog.inputbox.$$ + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) retval=$? + setvar DIALOG_INPUTBOX_$$ "$dialog_inputbox" _group_members=$( f_dialog_inputstr | tr '\n' ' ' | sed -e 's/[[:space:]]\{1,\}/,/g;s/^,//;s/,$//' ) @@ -405,7 +427,8 @@ f_dialog_input_group_members() "$_input" \ "$hline" ) - eval $DIALOG \ + local dialog_inputbox + dialog_inputbox=$( eval $DIALOG \ --title \"\$DIALOG_TITLE\" \ --backtitle \"\$DIALOG_BACKTITLE\" \ --hline \"\$hline\" \ @@ -413,9 +436,11 @@ f_dialog_input_group_members() --cancel-label \"\$msg_cancel\" \ --inputbox \"\$msg\" $size \ \"\$_input\" \ - 2> $DIALOG_TMPDIR/dialog.inputbox.$$ + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) retval=$? + setvar DIALOG_INPUTBOX_$$ "$dialog_inputbox" _group_members=$( f_dialog_inputstr ) # Return to previous menu if user has either diff --git a/usr.sbin/bsdconfig/usermgmt/share/user_input.subr b/usr.sbin/bsdconfig/usermgmt/share/user_input.subr index d27b9be3e496..8b356b67136e 100644 --- a/usr.sbin/bsdconfig/usermgmt/share/user_input.subr +++ b/usr.sbin/bsdconfig/usermgmt/share/user_input.subr @@ -109,14 +109,19 @@ f_dialog_menu_user_list() \"\$hline\" \ $menu_list ) - eval $DIALOG \ + local dialog_menu + dialog_menu=$( eval $DIALOG \ --clear --title \"\$DIALOG_TITLE\" \ --backtitle \"\$DIALOG_BACKTITLE\" \ --hline \"\$hline\" \ --ok-label \"\$msg_ok\" \ --cancel-label \"\$msg_cancel\" \ --menu \"\" $size $menu_list \ - 2> "$DIALOG_TMPDIR/dialog.menu.$$" + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) + local retval=$? + setvar DIALOG_MENU_$$ "$dialog_menu" + return $retval } # f_dialog_input_member_groups [$member_groups] @@ -155,7 +160,8 @@ f_dialog_input_member_groups() \"\" \ \"\$hline\" \ $checklist_groups ) - eval $DIALOG \ + local dialog_inputbox + dialog_inputbox=$( eval $DIALOG \ --title \"\$DIALOG_TITLE\" \ --backtitle \"\$DIALOG_BACKTITLE\" \ --separate-output \ @@ -164,9 +170,11 @@ f_dialog_input_member_groups() --cancel-label \"\$msg_cancel\" \ --checklist \"\$msg\" $size \ $checklist_groups \ - 2> $DIALOG_TMPDIR/dialog.inputbox.$$ + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) retval=$? + setvar DIALOG_INPUTBOX_$$ "$dialog_inputbox" _member_groups=$( f_dialog_inputstr ) # Return if user has either pressed ESC or chosen Cancel/No @@ -223,7 +231,8 @@ f_dialog_input_name() "$_input" \ "$hline" ) - eval $DIALOG \ + local dialog_inputbox + dialog_inputbox=$( eval $DIALOG \ --title \"\$DIALOG_TITLE\" \ --backtitle \"\$DIALOG_BACKTITLE\" \ --hline \"\$hline\" \ @@ -231,9 +240,11 @@ f_dialog_input_name() --cancel-label \"\$msg_cancel\" \ --inputbox \"\$msg\" $size \ \"\$_input\" \ - 2> $DIALOG_TMPDIR/dialog.inputbox.$$ + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) retval=$? + setvar DIALOG_INPUTBOX_$$ "$dialog_inputbox" _input=$( f_dialog_inputstr ) # Return if user has either pressed ESC or chosen Cancel/No @@ -306,7 +317,8 @@ f_dialog_input_password() # local retval _password1 _password2 while :; do - eval $DIALOG \ + local dialog_inputbox + dialog_inputbox=$( eval $DIALOG \ --title \"\$DIALOG_TITLE\" \ --backtitle \"\$DIALOG_BACKTITLE\" \ --hline \"\$hline\" \ @@ -314,15 +326,17 @@ f_dialog_input_password() --cancel-label \"\$msg_cancel\" \ --insecure \ --passwordbox \"\$msg\" $size \ - 2> $DIALOG_TMPDIR/dialog.inputbox.$$ + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) retval=$? + setvar DIALOG_INPUTBOX_$$ "$dialog_inputbox" _password1=$( f_dialog_inputstr ) # Return if user has either pressed ESC or chosen Cancel/No [ $retval -eq $SUCCESS ] || return $retval - eval $DIALOG \ + dialog_inputbox=$( eval $DIALOG \ --title \"\$DIALOG_TITLE\" \ --backtitle \"\$DIALOG_BACKTITLE\" \ --hline \"\$hline\" \ @@ -330,9 +344,11 @@ f_dialog_input_password() --cancel-label \"\$msg_cancel\" \ --insecure \ --passwordbox \"\$rmsg\" $rsize \ - 2> $DIALOG_TMPDIR/dialog.inputbox.$$ + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) retval=$? + setvar DIALOG_INPUTBOX_$$ "$dialog_inputbox" _password2=$( f_dialog_inputstr ) # Return if user has either pressed ESC or chosen Cancel/No @@ -384,7 +400,8 @@ f_dialog_input_gecos() "$_input" \ "$hline" ) - eval $DIALOG \ + local dialog_inputbox + dialog_inputbox=$( eval $DIALOG \ --title \"\$DIALOG_TITLE\" \ --backtitle \"\$DIALOG_BACKTITLE\" \ --hline \"\$hline\" \ @@ -392,9 +409,11 @@ f_dialog_input_gecos() --cancel-label \"\$msg_cancel\" \ --inputbox \"\$msg\" $size \ \"\$_input\" \ - 2> $DIALOG_TMPDIR/dialog.inputbox.$$ + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) retval=$? + setvar DIALOG_INPUTBOX_$$ "$dialog_inputbox" _input=$( f_dialog_inputstr ) # Return if user has either pressed ESC or chosen Cancel/No @@ -427,7 +446,8 @@ f_dialog_input_uid() "$_input" \ "$hline" ) - eval $DIALOG \ + local dialog_inputbox + dialog_inputbox=$( eval $DIALOG \ --title \"\$DIALOG_TITLE\" \ --backtitle \"\$DIALOG_BACKTITLE\" \ --hline \"\$hline\" \ @@ -435,9 +455,11 @@ f_dialog_input_uid() --cancel-label \"\$msg_cancel\" \ --inputbox \"\$msg\" $size \ \"\$_input\" \ - 2> $DIALOG_TMPDIR/dialog.inputbox.$$ + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) retval=$? + setvar DIALOG_INPUTBOX_$$ "$dialog_inputbox" _input=$( f_dialog_inputstr ) # Return if user has either pressed ESC or chosen Cancel/No @@ -470,7 +492,8 @@ f_dialog_input_gid() "$_input" \ "$hline" ) - eval $DIALOG \ + local dialog_inputbox + dialog_inputbox=$( eval $DIALOG \ --title \"\$DIALOG_TITLE\" \ --backtitle \"\$DIALOG_BACKTITLE\" \ --hline \"\$hline\" \ @@ -478,9 +501,11 @@ f_dialog_input_gid() --cancel-label \"\$msg_cancel\" \ --inputbox \"\$msg\" $size \ \"\$_input\" \ - 2> $DIALOG_TMPDIR/dialog.inputbox.$$ + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) retval=$? + setvar DIALOG_INPUTBOX_$$ "$dialog_inputbox" _input=$( f_dialog_inputstr ) # Return if user has either pressed ESC or chosen Cancel/No @@ -513,7 +538,8 @@ f_dialog_input_class() "$_input" \ "$hline" ) - eval $DIALOG \ + local dialog_inputbox + dialog_inputbox=$( eval $DIALOG \ --title \"\$DIALOG_TITLE\" \ --backtitle \"\$DIALOG_BACKTITLE\" \ --hline \"\$hline\" \ @@ -521,9 +547,11 @@ f_dialog_input_class() --cancel-label \"\$msg_cancel\" \ --inputbox \"\$msg\" $size \ \"\$_input\" \ - 2> $DIALOG_TMPDIR/dialog.inputbox.$$ + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) retval=$? + setvar DIALOG_INPUTBOX_$$ "$dialog_inputbox" _input=$( f_dialog_inputstr ) # Return if user has either pressed ESC or chosen Cancel/No @@ -569,7 +597,8 @@ f_dialog_input_change() \"\$hline\" \ $menu_list ) - eval $DIALOG \ + local dialog_menu + dialog_menu=$( eval $DIALOG \ --title \"\$DIALOG_TITLE\" \ --backtitle \"\$DIALOG_BACKTITLE\" \ --hline \"\$hline\" \ @@ -577,8 +606,10 @@ f_dialog_input_change() --cancel-label \"\$msg_cancel\" \ --menu \"\$msg\" $menu_size \ $menu_list \ - 2> $DIALOG_TMPDIR/dialog.menu.$$ + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) retval=$? + setvar DIALOG_MENU_$$ "$dialog_menu" date_type=$( f_dialog_menutag ) f_dprintf "retval=$retval date_type=[$date_type]" @@ -602,7 +633,8 @@ f_dialog_input_change() "$DIALOG_BACKTITLE" \ "$msg" \ "$hline" ) - eval $DIALOG \ + local dialog_inputbox + dialog_inputbox=$( eval $DIALOG \ --title \"\$DIALOG_TITLE\" \ --backtitle \"\$DIALOG_BACKTITLE\" \ --hline \"\$hline\" \ @@ -610,8 +642,10 @@ f_dialog_input_change() --cancel-label \"\$msg_cancel\" \ --calendar \"\$msg\" $calendar_size \ $_input_date \ - 2> $DIALOG_TMPDIR/dialog.inputbox.$$ + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) retval=$? + setvar DIALOG_INPUTBOX_$$ "$dialog_inputbox" ret_date=$( f_dialog_inputstr ) f_dprintf "retval=$retval ret_date=[$ret_date]" @@ -626,7 +660,8 @@ f_dialog_input_change() "$DIALOG_BACKTITLE" \ "$msg" \ "$hline" ) - eval $DIALOG \ + local dialog_inputbox + dialog_inputbox=$( eval $DIALOG \ --title \"\$DIALOG_TITLE\" \ --backtitle \"\$DIALOG_BACKTITLE\" \ --hline \"\$hline\" \ @@ -634,8 +669,10 @@ f_dialog_input_change() --cancel-label \"\$msg_cancel\" \ --timebox \"\$msg\" $timebox_size \ $_input_time \ - 2> $DIALOG_TMPDIR/dialog.inputbox.$$ + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) retval=$? + setvar DIALOG_INPUTBOX_$$ "$dialog_inputbox" ret_time=$( f_dialog_inputstr ) f_dprintf "retval=$retval ret_time=[$ret_time]" @@ -666,7 +703,8 @@ f_dialog_input_change() "$ret_days" \ "$hline" ) - eval $DIALOG \ + local dialog_inputbox + dialog_inputbox=$( eval $DIALOG \ --title \"\$DIALOG_TITLE\" \ --backtitle \"\$DIALOG_BACKTITLE\" \ --hline \"\$hline\" \ @@ -674,8 +712,10 @@ f_dialog_input_change() --cancel-label \"\$msg_cancel\" \ --inputbox \"\$msg\" $size \ \"\$ret_days\" \ - 2> $DIALOG_TMPDIR/dialog.inputbox.$$ + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) retval=$? + setvar DIALOG_INPUTBOX_$$ "$dialog_inputbox" ret_days=$( f_dialog_inputstr ) # Return to menu if either ESC or Cancel/No @@ -707,7 +747,8 @@ f_dialog_input_change() "$msg" \ "$_input" \ "$hline" ) - eval $DIALOG \ + local dialog_inputbox + dialog_inputbox=$( eval $DIALOG \ --title \"\$DIALOG_TITLE\" \ --backtitle \"\$DIALOG_BACKTITLE\" \ --hline \"\$hline\" \ @@ -715,9 +756,11 @@ f_dialog_input_change() --cancel-label \"\$msg_cancel\" \ --inputbox \"\$msg\" $size \ \"\$_input\" \ - 2> $DIALOG_TMPDIR/dialog.inputbox.$$ + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) retval=$? + setvar DIALOG_INPUTBOX_$$ "$dialog_inputbox" ret_secs=$( f_dialog_inputstr ) # Return to menu if either ESC or Cancel/No @@ -779,7 +822,8 @@ f_dialog_input_expire() \"\$hline\" \ $menu_list ) - eval $DIALOG \ + local dialog_menu + dialog_menu=$( eval $DIALOG \ --title \"\$DIALOG_TITLE\" \ --backtitle \"\$DIALOG_BACKTITLE\" \ --hline \"\$hline\" \ @@ -787,8 +831,10 @@ f_dialog_input_expire() --cancel-label \"\$msg_cancel\" \ --menu \"\$msg\" $menu_size \ $menu_list \ - 2> $DIALOG_TMPDIR/dialog.menu.$$ + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) retval=$? + setvar DIALOG_MENU_$$ "$dialog_menu" date_type=$( f_dialog_menutag ) f_dprintf "retval=$retval date_type=[$date_type]" @@ -812,7 +858,8 @@ f_dialog_input_expire() "$DIALOG_BACKTITLE" \ "$msg" \ "$hline" ) - eval $DIALOG \ + local dialog_inputbox + dialog_inputbox=$( eval $DIALOG \ --title \"\$DIALOG_TITLE\" \ --backtitle \"\$DIALOG_BACKTITLE\" \ --hline \"\$hline\" \ @@ -820,8 +867,10 @@ f_dialog_input_expire() --cancel-label \"\$msg_cancel\" \ --calendar \"\$msg\" $calendar_size \ $_input_date \ - 2> $DIALOG_TMPDIR/dialog.inputbox.$$ + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) retval=$? + setvar DIALOG_INPUTBOX_$$ "$dialog_inputbox" ret_date=$( f_dialog_inputstr ) f_dprintf "retval=$retval ret_date=[$ret_date]" @@ -836,7 +885,7 @@ f_dialog_input_expire() "$DIALOG_BACKTITLE" \ "$msg" \ "$hline" ) - eval $DIALOG \ + dialog_inputbox=$( eval $DIALOG \ --title \"\$DIALOG_TITLE\" \ --backtitle \"\$DIALOG_BACKTITLE\" \ --hline \"\$hline\" \ @@ -844,8 +893,10 @@ f_dialog_input_expire() --cancel-label \"\$msg_cancel\" \ --timebox \"\$msg\" $timebox_size \ $_input_time \ - 2> $DIALOG_TMPDIR/dialog.inputbox.$$ + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) retval=$? + setvar DIALOG_INPUTBOX_$$ "$dialog_inputbox" ret_time=$( f_dialog_inputstr ) f_dprintf "retval=$retval ret_time=[$ret_time]" @@ -876,7 +927,8 @@ f_dialog_input_expire() "$ret_days" \ "$hline" ) - eval $DIALOG \ + local dialog_inputbox + dialog_inputbox=$( eval $DIALOG \ --title \"\$DIALOG_TITLE\" \ --backtitle \"\$DIALOG_BACKTITLE\" \ --hline \"\$hline\" \ @@ -884,8 +936,10 @@ f_dialog_input_expire() --cancel-label \"\$msg_cancel\" \ --inputbox \"\$msg\" $size \ \"\$ret_days\" \ - 2> $DIALOG_TMPDIR/dialog.inputbox.$$ + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) retval=$? + setvar DIALOG_INPUTBOX_$$ "$dialog_inputbox" ret_days=$( f_dialog_inputstr ) # Return to menu if either ESC or Cancel/No @@ -917,7 +971,8 @@ f_dialog_input_expire() "$msg" \ "$_input" \ "$hline" ) - eval $DIALOG \ + local dialog_inputbox + dialog_inputbox=$( eval $DIALOG \ --title \"\$DIALOG_TITLE\" \ --backtitle \"\$DIALOG_BACKTITLE\" \ --hline \"\$hline\" \ @@ -925,9 +980,11 @@ f_dialog_input_expire() --cancel-label \"\$msg_cancel\" \ --inputbox \"\$msg\" $size \ \"\$_input\" \ - 2> $DIALOG_TMPDIR/dialog.inputbox.$$ + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) retval=$? + setvar DIALOG_INPUTBOX_$$ "$dialog_inputbox" ret_secs=$( f_dialog_inputstr ) # Return to menu if either ESC or Cancel/No @@ -976,7 +1033,8 @@ f_dialog_input_home_dir() "$_input" \ "$hline" ) - eval $DIALOG \ + local dialog_inputbox + dialog_inputbox=$( eval $DIALOG \ --title \"\$DIALOG_TITLE\" \ --backtitle \"\$DIALOG_BACKTITLE\" \ --hline \"\$hline\" \ @@ -984,9 +1042,11 @@ f_dialog_input_home_dir() --cancel-label \"\$msg_cancel\" \ --inputbox \"\$msg\" $size \ \"\$_input\" \ - 2> $DIALOG_TMPDIR/dialog.inputbox.$$ + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) retval=$? + setvar DIALOG_INPUTBOX_$$ "$dialog_inputbox" _input=$( f_dialog_inputstr ) # Return if user has either pressed ESC or chosen Cancel/No @@ -1153,7 +1213,8 @@ f_dialog_input_shell() \"\$hline\" \ $shell_list ) - eval $DIALOG \ + local dialog_inputbox + dialog_inputbox=$( eval $DIALOG \ --title \"\$DIALOG_TITLE\" \ --backtitle \"\$DIALOG_BACKTITLE\" \ --hline \"\$hline\" \ @@ -1161,9 +1222,11 @@ f_dialog_input_shell() --cancel-label \"\$msg_cancel\" \ --radiolist \"\$prompt\" $size \ $shell_list \ - 2> $DIALOG_TMPDIR/dialog.inputbox.$$ + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) retval=$? + setvar DIALOG_INPUTBOX_$$ "$dialog_inputbox" _input=$( f_dialog_inputstr ) # Return if user has either pressed ESC or chosen Cancel/No diff --git a/usr.sbin/bsdconfig/usermgmt/userinput b/usr.sbin/bsdconfig/usermgmt/userinput index 7cabfdc33336..aca8aed05853 100755 --- a/usr.sbin/bsdconfig/usermgmt/userinput +++ b/usr.sbin/bsdconfig/usermgmt/userinput @@ -391,7 +391,8 @@ while :; do \"\$hline\" \ $menu_items ) - eval $DIALOG \ + local dialog_menu + dialog_menu=$( eval $DIALOG \ --title \"\$DIALOG_TITLE\" \ --backtitle \"\$DIALOG_BACKTITLE\" \ --hline \"\$hline\" \ @@ -399,9 +400,11 @@ while :; do --cancel-label \"\$msg_cancel\" \ --menu \"\$menu_text\" $size \ $menu_items \ - 2> $DIALOG_TMPDIR/dialog.menu.$$ + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) retval=$? + setvar DIALOG_MENU_$$ "$dialog_menu" mtag=$( f_dialog_menutag ) f_dprintf "retval=$retval mtag=[$mtag]" diff --git a/usr.sbin/bsdconfig/usermgmt/usermgmt b/usr.sbin/bsdconfig/usermgmt/usermgmt index b4905b39a3ea..0bfb0c01fc00 100755 --- a/usr.sbin/bsdconfig/usermgmt/usermgmt +++ b/usr.sbin/bsdconfig/usermgmt/usermgmt @@ -69,14 +69,19 @@ dialog_menu_main() \"\$hline\" \ $menu_list ) - eval $DIALOG \ + local dialog_menu + dialog_menu=$( eval $DIALOG \ --clear --title \"\$DIALOG_TITLE\" \ --backtitle \"\$DIALOG_BACKTITLE\" \ --hline \"\$hline\" \ --ok-label \"\$msg_ok\" \ --cancel-label \"\$msg_cancel\" \ --menu \"\" $size $menu_list \ - 2> "$DIALOG_TMPDIR/dialog.menu.$$" + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) + local retval=$? + setvar DIALOG_MENU_$$ "$dialog_menu" + return $retval } ############################################################ MAIN