bsdconfig (251244) | bsdconfig (251264) |
---|---|
1#!/bin/sh 2#- 3# Copyright (c) 2012 Ron McDowell 4# Copyright (c) 2012-2013 Devin Teske 5# All rights reserved. 6# 7# Redistribution and use in source and binary forms, with or without 8# modification, are permitted provided that the following conditions --- 11 unchanged lines hidden (view full) --- 20# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26# SUCH DAMAGE. 27# | 1#!/bin/sh 2#- 3# Copyright (c) 2012 Ron McDowell 4# Copyright (c) 2012-2013 Devin Teske 5# All rights reserved. 6# 7# Redistribution and use in source and binary forms, with or without 8# modification, are permitted provided that the following conditions --- 11 unchanged lines hidden (view full) --- 20# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26# SUCH DAMAGE. 27# |
28# $FreeBSD: head/usr.sbin/bsdconfig/bsdconfig 251244 2013-06-02 09:02:12Z dteske $ | 28# $FreeBSD: head/usr.sbin/bsdconfig/bsdconfig 251264 2013-06-02 20:02:50Z dteske $ |
29# 30############################################################ INCLUDES 31 32BSDCFG_SHARE="/usr/share/bsdconfig" 33. $BSDCFG_SHARE/common.subr || exit 1 34f_dprintf "%s: loading includes..." "$0" 35f_include $BSDCFG_SHARE/dialog.subr 36f_include $BSDCFG_SHARE/mustberoot.subr --- 8 unchanged lines hidden (view full) --- 45############################################################ FUNCTIONS 46 47# usage 48# 49# display usage and exit 50# 51usage() 52{ | 29# 30############################################################ INCLUDES 31 32BSDCFG_SHARE="/usr/share/bsdconfig" 33. $BSDCFG_SHARE/common.subr || exit 1 34f_dprintf "%s: loading includes..." "$0" 35f_include $BSDCFG_SHARE/dialog.subr 36f_include $BSDCFG_SHARE/mustberoot.subr --- 8 unchanged lines hidden (view full) --- 45############################################################ FUNCTIONS 46 47# usage 48# 49# display usage and exit 50# 51usage() 52{ |
53 local index="INDEX" cmd_list="" | 53 local index="INDEX" 54 local cmd_list # Calculated below |
54 55 cd $BSDCFG_LIBE 56 # No need to preserve CWD (headed toward exit) 57 58 # Test for language-specific indices 59 f_quietly ls */"$index.${LANG:-$LC_ALL}" && 60 index="$index.${LANG:-$LC_ALL}" 61 --- 78 unchanged lines hidden (view full) --- 140# 141# Display the dialog(1)-based application main menu. 142# 143dialog_menu_main() 144{ 145 local title="$DIALOG_TITLE" 146 local btitle="$DIALOG_BACKTITLE" 147 local prompt="$msg_menu_text" | 55 56 cd $BSDCFG_LIBE 57 # No need to preserve CWD (headed toward exit) 58 59 # Test for language-specific indices 60 f_quietly ls */"$index.${LANG:-$LC_ALL}" && 61 index="$index.${LANG:-$LC_ALL}" 62 --- 78 unchanged lines hidden (view full) --- 141# 142# Display the dialog(1)-based application main menu. 143# 144dialog_menu_main() 145{ 146 local title="$DIALOG_TITLE" 147 local btitle="$DIALOG_BACKTITLE" 148 local prompt="$msg_menu_text" |
148 local menu_list 149 local defaultitem= # Calculated below 150 151 menu_list=" | 149 local menu_list=" |
152 'X' '$msg_exit' '$msg_exit_bsdconfig' 153 '1' '$msg_usage' '$msg_quick_start_how_to_use_this_menu_system' 154 " # END-QUOTE | 150 'X' '$msg_exit' '$msg_exit_bsdconfig' 151 '1' '$msg_usage' '$msg_quick_start_how_to_use_this_menu_system' 152 " # END-QUOTE |
153 local defaultitem= # Calculated below 154 local hline= |
|
155 156 local sanitize_awk="{ gsub(/'/, \"'\\\\''\"); print }" 157 158 local menuitem menu_title menu_help menu_selection index=2 159 for menuitem in $( cd $BSDCFG_LIBE && ls -d [0-9][0-9][0-9].* ); do 160 [ $index -lt ${#DIALOG_MENU_TAGS} ] || break 161 tag=$( f_substr "$DIALOG_MENU_TAGS" $index 1 ) 162 --- 17 unchanged lines hidden (view full) --- 180 index=$(( $index + 1 )) 181 done 182 183 local height width rows 184 eval f_dialog_menu_with_help_size height width rows \ 185 \"\$title\" \ 186 \"\$btitle\" \ 187 \"\$prompt\" \ | 155 156 local sanitize_awk="{ gsub(/'/, \"'\\\\''\"); print }" 157 158 local menuitem menu_title menu_help menu_selection index=2 159 for menuitem in $( cd $BSDCFG_LIBE && ls -d [0-9][0-9][0-9].* ); do 160 [ $index -lt ${#DIALOG_MENU_TAGS} ] || break 161 tag=$( f_substr "$DIALOG_MENU_TAGS" $index 1 ) 162 --- 17 unchanged lines hidden (view full) --- 180 index=$(( $index + 1 )) 181 done 182 183 local height width rows 184 eval f_dialog_menu_with_help_size height width rows \ 185 \"\$title\" \ 186 \"\$btitle\" \ 187 \"\$prompt\" \ |
188 \"\" \ | 188 \"\$hline\" \ |
189 $menu_list 190 191 # Obtain default-item from previously stored selection 192 f_dialog_default_fetch defaultitem 193 194 local menu_choice 195 menu_choice=$( eval $DIALOG \ 196 --clear \ 197 --title \"\$title\" \ 198 --backtitle \"\$btitle\" \ | 189 $menu_list 190 191 # Obtain default-item from previously stored selection 192 f_dialog_default_fetch defaultitem 193 194 local menu_choice 195 menu_choice=$( eval $DIALOG \ 196 --clear \ 197 --title \"\$title\" \ 198 --backtitle \"\$btitle\" \ |
199 --hline \"\$hline\" \ |
|
199 --item-help \ 200 --ok-label \"\$msg_ok\" \ 201 --cancel-label \"\$msg_exit_bsdconfig\" \ 202 --help-button \ 203 --help-label \"\$msg_help\" \ 204 ${USE_XDIALOG:+--help \"\"} \ 205 --default-item \"\$defaultitem\" \ 206 --menu \"\$prompt\" \ --- 137 unchanged lines hidden --- | 200 --item-help \ 201 --ok-label \"\$msg_ok\" \ 202 --cancel-label \"\$msg_exit_bsdconfig\" \ 203 --help-button \ 204 --help-label \"\$msg_help\" \ 205 ${USE_XDIALOG:+--help \"\"} \ 206 --default-item \"\$defaultitem\" \ 207 --menu \"\$prompt\" \ --- 137 unchanged lines hidden --- |