Date: Sat, 14 Jul 2012 03:16:58 +0000 (UTC) From: Devin Teske <dteske@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r238438 - in head: share/mk tools/build/options usr.sbin usr.sbin/bsdconfig usr.sbin/bsdconfig/console usr.sbin/bsdconfig/console/include usr.sbin/bsdconfig/diskmgmt usr.sbin/bsdconfig/... Message-ID: <201207140316.q6E3Gw7C005617@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: dteske Date: Sat Jul 14 03:16:57 2012 New Revision: 238438 URL: http://svn.freebsd.org/changeset/base/238438 Log: Import bsdconfig(8) as a replacement for the post-install abilities of deprecated sysinstall(8). NOTE: WITH_BSDCONFIG is currently required. Submitted by: Devin Teske (dteske), Ron McDowell <rcm@fuzzwad.org> Reviewed by: Ron McDowell <rcm@fuzzwad.org> Approved by: Ed Maste (emaste) Added: head/tools/build/options/WITH_BSDCONFIG (contents, props changed) head/usr.sbin/bsdconfig/ head/usr.sbin/bsdconfig/Makefile (contents, props changed) head/usr.sbin/bsdconfig/USAGE (contents, props changed) head/usr.sbin/bsdconfig/bsdconfig (contents, props changed) head/usr.sbin/bsdconfig/bsdconfig.8 (contents, props changed) head/usr.sbin/bsdconfig/console/ head/usr.sbin/bsdconfig/console/INDEX (contents, props changed) head/usr.sbin/bsdconfig/console/Makefile (contents, props changed) head/usr.sbin/bsdconfig/console/USAGE (contents, props changed) head/usr.sbin/bsdconfig/console/console (contents, props changed) head/usr.sbin/bsdconfig/console/font (contents, props changed) head/usr.sbin/bsdconfig/console/include/ head/usr.sbin/bsdconfig/console/include/Makefile (contents, props changed) head/usr.sbin/bsdconfig/console/include/messages.subr (contents, props changed) head/usr.sbin/bsdconfig/console/keymap (contents, props changed) head/usr.sbin/bsdconfig/console/repeat (contents, props changed) head/usr.sbin/bsdconfig/console/saver (contents, props changed) head/usr.sbin/bsdconfig/console/screenmap (contents, props changed) head/usr.sbin/bsdconfig/console/ttys (contents, props changed) head/usr.sbin/bsdconfig/diskmgmt/ head/usr.sbin/bsdconfig/diskmgmt/INDEX (contents, props changed) head/usr.sbin/bsdconfig/diskmgmt/Makefile (contents, props changed) head/usr.sbin/bsdconfig/diskmgmt/USAGE (contents, props changed) head/usr.sbin/bsdconfig/diskmgmt/diskmgmt (contents, props changed) head/usr.sbin/bsdconfig/diskmgmt/include/ head/usr.sbin/bsdconfig/diskmgmt/include/Makefile (contents, props changed) head/usr.sbin/bsdconfig/diskmgmt/include/messages.subr (contents, props changed) head/usr.sbin/bsdconfig/docsinstall/ head/usr.sbin/bsdconfig/docsinstall/INDEX (contents, props changed) head/usr.sbin/bsdconfig/docsinstall/Makefile (contents, props changed) head/usr.sbin/bsdconfig/docsinstall/USAGE (contents, props changed) head/usr.sbin/bsdconfig/docsinstall/docsinstall (contents, props changed) head/usr.sbin/bsdconfig/docsinstall/include/ head/usr.sbin/bsdconfig/docsinstall/include/Makefile (contents, props changed) head/usr.sbin/bsdconfig/docsinstall/include/messages.subr (contents, props changed) head/usr.sbin/bsdconfig/dot/ head/usr.sbin/bsdconfig/dot/INDEX (contents, props changed) head/usr.sbin/bsdconfig/dot/Makefile (contents, props changed) head/usr.sbin/bsdconfig/dot/USAGE (contents, props changed) head/usr.sbin/bsdconfig/dot/dot (contents, props changed) head/usr.sbin/bsdconfig/dot/include/ head/usr.sbin/bsdconfig/dot/include/Makefile (contents, props changed) head/usr.sbin/bsdconfig/dot/include/messages.subr (contents, props changed) head/usr.sbin/bsdconfig/examples/ head/usr.sbin/bsdconfig/examples/Makefile (contents, props changed) head/usr.sbin/bsdconfig/examples/bsdconfigrc (contents, props changed) head/usr.sbin/bsdconfig/fdisk/ head/usr.sbin/bsdconfig/include/ head/usr.sbin/bsdconfig/include/Makefile (contents, props changed) head/usr.sbin/bsdconfig/include/common.subr (contents, props changed) head/usr.sbin/bsdconfig/include/dialog.subr (contents, props changed) head/usr.sbin/bsdconfig/include/messages.subr (contents, props changed) head/usr.sbin/bsdconfig/include/mustberoot.subr (contents, props changed) head/usr.sbin/bsdconfig/include/strings.subr (contents, props changed) head/usr.sbin/bsdconfig/include/sysrc.subr (contents, props changed) head/usr.sbin/bsdconfig/mouse/ head/usr.sbin/bsdconfig/mouse/INDEX (contents, props changed) head/usr.sbin/bsdconfig/mouse/Makefile (contents, props changed) head/usr.sbin/bsdconfig/mouse/USAGE (contents, props changed) head/usr.sbin/bsdconfig/mouse/disable (contents, props changed) head/usr.sbin/bsdconfig/mouse/enable (contents, props changed) head/usr.sbin/bsdconfig/mouse/flags (contents, props changed) head/usr.sbin/bsdconfig/mouse/include/ head/usr.sbin/bsdconfig/mouse/include/Makefile (contents, props changed) head/usr.sbin/bsdconfig/mouse/include/messages.subr (contents, props changed) head/usr.sbin/bsdconfig/mouse/mouse (contents, props changed) head/usr.sbin/bsdconfig/mouse/port (contents, props changed) head/usr.sbin/bsdconfig/mouse/type (contents, props changed) head/usr.sbin/bsdconfig/networking/ head/usr.sbin/bsdconfig/networking/INDEX (contents, props changed) head/usr.sbin/bsdconfig/networking/Makefile (contents, props changed) head/usr.sbin/bsdconfig/networking/USAGE (contents, props changed) head/usr.sbin/bsdconfig/networking/defaultrouter (contents, props changed) head/usr.sbin/bsdconfig/networking/devices (contents, props changed) head/usr.sbin/bsdconfig/networking/hostname (contents, props changed) head/usr.sbin/bsdconfig/networking/include/ head/usr.sbin/bsdconfig/networking/include/Makefile (contents, props changed) head/usr.sbin/bsdconfig/networking/include/common.subr (contents, props changed) head/usr.sbin/bsdconfig/networking/include/device.subr (contents, props changed) head/usr.sbin/bsdconfig/networking/include/hostname.subr (contents, props changed) head/usr.sbin/bsdconfig/networking/include/ipaddr.subr (contents, props changed) head/usr.sbin/bsdconfig/networking/include/media.subr (contents, props changed) head/usr.sbin/bsdconfig/networking/include/messages.subr (contents, props changed) head/usr.sbin/bsdconfig/networking/include/netmask.subr (contents, props changed) head/usr.sbin/bsdconfig/networking/include/resolv.subr (contents, props changed) head/usr.sbin/bsdconfig/networking/include/routing.subr (contents, props changed) head/usr.sbin/bsdconfig/networking/nameservers (contents, props changed) head/usr.sbin/bsdconfig/networking/networking (contents, props changed) head/usr.sbin/bsdconfig/password/ head/usr.sbin/bsdconfig/password/INDEX (contents, props changed) head/usr.sbin/bsdconfig/password/Makefile (contents, props changed) head/usr.sbin/bsdconfig/password/USAGE (contents, props changed) head/usr.sbin/bsdconfig/password/include/ head/usr.sbin/bsdconfig/password/include/Makefile (contents, props changed) head/usr.sbin/bsdconfig/password/include/messages.subr (contents, props changed) head/usr.sbin/bsdconfig/password/include/password.subr (contents, props changed) head/usr.sbin/bsdconfig/password/password (contents, props changed) head/usr.sbin/bsdconfig/security/ head/usr.sbin/bsdconfig/security/INDEX (contents, props changed) head/usr.sbin/bsdconfig/security/Makefile (contents, props changed) head/usr.sbin/bsdconfig/security/USAGE (contents, props changed) head/usr.sbin/bsdconfig/security/include/ head/usr.sbin/bsdconfig/security/include/Makefile (contents, props changed) head/usr.sbin/bsdconfig/security/include/messages.subr (contents, props changed) head/usr.sbin/bsdconfig/security/kern_securelevel (contents, props changed) head/usr.sbin/bsdconfig/security/security (contents, props changed) head/usr.sbin/bsdconfig/startup/ head/usr.sbin/bsdconfig/startup/INDEX (contents, props changed) head/usr.sbin/bsdconfig/startup/Makefile (contents, props changed) head/usr.sbin/bsdconfig/startup/USAGE (contents, props changed) head/usr.sbin/bsdconfig/startup/include/ head/usr.sbin/bsdconfig/startup/include/Makefile (contents, props changed) head/usr.sbin/bsdconfig/startup/include/messages.subr (contents, props changed) head/usr.sbin/bsdconfig/startup/include/rcconf.subr (contents, props changed) head/usr.sbin/bsdconfig/startup/include/rcedit.subr (contents, props changed) head/usr.sbin/bsdconfig/startup/include/rcvar.subr (contents, props changed) head/usr.sbin/bsdconfig/startup/misc (contents, props changed) head/usr.sbin/bsdconfig/startup/rcadd (contents, props changed) head/usr.sbin/bsdconfig/startup/rcconf (contents, props changed) head/usr.sbin/bsdconfig/startup/rcdelete (contents, props changed) head/usr.sbin/bsdconfig/startup/rcedit (contents, props changed) head/usr.sbin/bsdconfig/startup/rcvar (contents, props changed) head/usr.sbin/bsdconfig/startup/startup (contents, props changed) head/usr.sbin/bsdconfig/timezone/ head/usr.sbin/bsdconfig/timezone/INDEX (contents, props changed) head/usr.sbin/bsdconfig/timezone/Makefile (contents, props changed) head/usr.sbin/bsdconfig/timezone/USAGE (contents, props changed) head/usr.sbin/bsdconfig/timezone/include/ head/usr.sbin/bsdconfig/timezone/include/Makefile (contents, props changed) head/usr.sbin/bsdconfig/timezone/include/continents.subr (contents, props changed) head/usr.sbin/bsdconfig/timezone/include/countries.subr (contents, props changed) head/usr.sbin/bsdconfig/timezone/include/iso3166.subr (contents, props changed) head/usr.sbin/bsdconfig/timezone/include/menus.subr (contents, props changed) head/usr.sbin/bsdconfig/timezone/include/messages.subr (contents, props changed) head/usr.sbin/bsdconfig/timezone/include/zones.subr (contents, props changed) head/usr.sbin/bsdconfig/timezone/timezone (contents, props changed) head/usr.sbin/bsdconfig/ttys/ head/usr.sbin/bsdconfig/ttys/INDEX (contents, props changed) head/usr.sbin/bsdconfig/ttys/Makefile (contents, props changed) head/usr.sbin/bsdconfig/ttys/USAGE (contents, props changed) head/usr.sbin/bsdconfig/ttys/include/ head/usr.sbin/bsdconfig/ttys/include/Makefile (contents, props changed) head/usr.sbin/bsdconfig/ttys/include/messages.subr (contents, props changed) head/usr.sbin/bsdconfig/ttys/ttys (contents, props changed) head/usr.sbin/bsdconfig/usermgmt/ head/usr.sbin/bsdconfig/usermgmt/INDEX (contents, props changed) head/usr.sbin/bsdconfig/usermgmt/Makefile (contents, props changed) head/usr.sbin/bsdconfig/usermgmt/USAGE (contents, props changed) head/usr.sbin/bsdconfig/usermgmt/groupadd (contents, props changed) head/usr.sbin/bsdconfig/usermgmt/groupdel (contents, props changed) head/usr.sbin/bsdconfig/usermgmt/groupedit (contents, props changed) head/usr.sbin/bsdconfig/usermgmt/groupinput (contents, props changed) head/usr.sbin/bsdconfig/usermgmt/include/ head/usr.sbin/bsdconfig/usermgmt/include/Makefile (contents, props changed) head/usr.sbin/bsdconfig/usermgmt/include/group_input.subr (contents, props changed) head/usr.sbin/bsdconfig/usermgmt/include/messages.subr (contents, props changed) head/usr.sbin/bsdconfig/usermgmt/include/user_input.subr (contents, props changed) head/usr.sbin/bsdconfig/usermgmt/useradd (contents, props changed) head/usr.sbin/bsdconfig/usermgmt/userdel (contents, props changed) head/usr.sbin/bsdconfig/usermgmt/useredit (contents, props changed) head/usr.sbin/bsdconfig/usermgmt/userinput (contents, props changed) head/usr.sbin/bsdconfig/usermgmt/usermgmt (contents, props changed) Modified: head/share/mk/bsd.own.mk head/usr.sbin/Makefile Modified: head/share/mk/bsd.own.mk ============================================================================== --- head/share/mk/bsd.own.mk Sat Jul 14 02:59:11 2012 (r238437) +++ head/share/mk/bsd.own.mk Sat Jul 14 03:16:57 2012 (r238438) @@ -421,6 +421,7 @@ __DEFAULT_NO_OPTIONS = \ BIND_LIBS \ BIND_SIGCHASE \ BIND_XML \ + BSDCONFIG \ CLANG_EXTRAS \ CLANG_IS_CC \ CTF \ Added: head/tools/build/options/WITH_BSDCONFIG ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/build/options/WITH_BSDCONFIG Sat Jul 14 03:16:57 2012 (r238438) @@ -0,0 +1,2 @@ +.\" $FreeBSD$ +Install bsdconfig(8), a BSD-licensed configuration/management utility. Modified: head/usr.sbin/Makefile ============================================================================== --- head/usr.sbin/Makefile Sat Jul 14 02:59:11 2012 (r238437) +++ head/usr.sbin/Makefile Sat Jul 14 03:16:57 2012 (r238438) @@ -144,6 +144,10 @@ SUBDIR+= rndc-confgen SUBDIR+= bluetooth .endif +.if ${MK_BSDCONFIG} != "no" +SUBDIR+= bsdconfig +.endif + .if ${MK_BSNMP} != "no" SUBDIR+= bsnmpd .endif Added: head/usr.sbin/bsdconfig/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/bsdconfig/Makefile Sat Jul 14 03:16:57 2012 (r238438) @@ -0,0 +1,32 @@ +# $FreeBSD$ + +NO_OBJ= + +SUBDIR= console \ + diskmgmt \ + docsinstall \ + dot \ + examples \ + include \ + mouse \ + networking \ + password \ + security \ + startup \ + timezone \ + ttys \ + usermgmt + +FILESDIR= ${LIBEXECDIR}/bsdconfig +FILES= USAGE + +SCRIPTS= bsdconfig + +MAN= bsdconfig.8 + +beforeinstall: + mkdir -p ${DESTDIR}${FILESDIR} + mkdir -p ${DESTDIR}${SCRIPTSDIR} + mkdir -p ${DESTDIR}${MANDIR}8 + +.include <bsd.prog.mk> Added: head/usr.sbin/bsdconfig/USAGE ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/bsdconfig/USAGE Sat Jul 14 03:16:57 2012 (r238438) @@ -0,0 +1,40 @@ +# Copyright (c) 2012 Ron McDowell +# Copyright (c) 2012 Devin Teske +# All Rights Reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD$ + +Usage: + @PROGRAM_NAME@ [-h] + @PROGRAM_NAME@ command [-h] + @PROGRAM_NAME@ [OPTIONS] [command [OPTIONS]] + +OPTIONS: + -h Print usage statement and exit. + -S Secure X11 mode (implies `-X'). As root, always prompt-for + and validate sudo(8) username/password before starting. + -X Use Xdialog(1) in place of dialog(1). + +COMMANDS: +@COMMAND_LIST@ Added: head/usr.sbin/bsdconfig/bsdconfig ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/bsdconfig/bsdconfig Sat Jul 14 03:16:57 2012 (r238438) @@ -0,0 +1,313 @@ +#!/bin/sh +#- +# Copyright (c) 2012 Ron McDowell +# Copyright (c) 2012 Devin Teske +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD$ +# +############################################################ INCLUDES + +BSDCFG_LIBE="/usr/libexec/bsdconfig" +. $BSDCFG_LIBE/include/common.subr || exit 1 +f_include $BSDCFG_LIBE/include/dialog.subr +f_include $BSDCFG_LIBE/include/mustberoot.subr +f_include $BSDCFG_LIBE/include/strings.subr +f_include_lang $BSDCFG_LIBE/include/messages.subr + +############################################################ FUNCTIONS + +# usage +# +# display usage and exit +# +usage() +{ + local index="INDEX" cmd_list="" + + cd $BSDCFG_LIBE + + # Test for language-specific indices + f_quietly ls */"$index.${LANG:-$LC_ALL}" && + index="$index.${LANG:-$LC_ALL}" + + cmd_list=$( + awk '/^menu_selection="/ { + sub(/\|.*/, "") + sub(/^menu_selection="/, "") + print + }' */$index | sort + ) + + # + # Determine the longest command-length (in characters) + # + local longest_cmd + longest_cmd=$( echo "$cmd_list" | f_longest_line_length ) + f_dprintf "longest_cmd=[$longest_cmd]" + + # + # Determine the maximum width of terminal/console + # + local max_size max_width + max_size=$( stty size 2> /dev/null ) + : ${max_size:="24 80"} + max_width="${max_size#*[$IFS]}" + f_dprintf "max_width=[$max_width]" + + # + # Using the longest command-length as the width of a single column, + # determine if we can use more than one column to display commands. + # + local x=$longest_cmd ncols=1 + x=$(( $x + 8 )) # Accomodate leading tab character + x=$(( $x + 3 + $longest_cmd )) # Preload end of next column + while [ $x -lt $max_width ]; do + ncols=$(( $ncols + 1 )) + x=$(( $x + 3 + $longest_cmd )) + done + f_dprintf "ncols=[$ncols] x=[$x]" + + # + # Re-format the command-list into multiple columns + # + cmd_list=$( eval "$( echo "$cmd_list" | + awk -v ncols=$ncols -v size=$longest_cmd ' + BEGIN { + n = 0 + row_item[1] = "" + } + function print_row() + { + fmt = "printf \"\\t%-" size "s" + for (i = 1; i < cur_col; i++) + fmt = fmt " %-" size "s" + fmt = fmt "\\n\"" + printf "%s", fmt + for (i = 1; i <= cur_col; i++) + printf " \"%s\"", row_item[i] + print "" + } + { + n++ + cur_col = (( n - 1 ) % ncols ) + 1 + printf "f_dprintf \"row_item[%u]=[%s]\"\n", cur_col, $0 + row_item[cur_col] = $0 + if ( cur_col == ncols ) print_row() + } + END { + if ( cur_col < ncols ) print_row() + }' )" + ) + + f_usage $BSDCFG_LIBE/USAGE \ + "PROGRAM_NAME" "$pgm" \ + "COMMAND_LIST" "$cmd_list" +} + +# dialog_menu_main +# +# Display the dialog(1)-based application main menu. +# +dialog_menu_main() +{ + local title="$DIALOG_TITLE" + local btitle="$DIALOG_BACKTITLE" + local prompt="$msg_menu_text" + local menu_list size + + menu_list=" + 'X' '$msg_exit' '$msg_exit_bsdconfig' + " # END-QUOTE + + local sanitize_awk="{ gsub(/'/, \"'\\\\''\"); print }" + + local menuitem menu_title menu_help menu_selection index=1 + for menuitem in $( ls -d [0-9][0-9][0-9].* ); do + [ $index -lt ${#DIALOG_MENU_TAGS} ] || break + tag=$( f_substr "$DIALOG_MENU_TAGS" $index 1 ) + + menu_program= + menu_title= + menu_help= + f_include_lang $menuitem/INDEX + [ "$menu_program" ] || continue + + case "$menu_program" in + /*) : already fully qualified ;; + *) + menu_program="$menuitem/$menu_program" + esac + + menu_title=$( echo "$menu_title" | awk "$sanitize_awk" ) + menu_help=$( echo "$menu_help" | awk "$sanitize_awk" ) + setvar "menu_program$tag" "$menu_program" + menu_list="$menu_list '$tag' '$menu_title' '$menu_help'" + + index=$(( $index + 1 )) + done + + size=$( eval f_dialog_menu_with_help_size \ + \"\$title\" \ + \"\$btitle\" \ + \"\$prompt\" \ + \"\" \ + $menu_list ) + + eval $DIALOG \ + --clear \ + --title \"\$title\" \ + --backtitle \"\$btitle\" \ + --item-help \ + --ok-label \"\$msg_ok\" \ + --cancel-label \"\$msg_exit_bsdconfig\" \ + --menu \"\$prompt\" $size $menu_list \ + 2> "$DIALOG_TMPDIR/dialog.menu.$$" +} + +############################################################ MAIN + +# +# Process command-line arguments +# +while getopts hSX flag; do + case "$flag" in + h|\?) usage;; + esac +done +shift $(( $OPTIND -1 )) + +# +# Initialize +# +f_dialog_init +f_dialog_title "$msg_main_menu" + +[ "$SECURE" ] && f_mustberoot_init + +# Incorporate rc-file if it exists +[ -f "$HOME/.bsdconfigrc" ] && f_include "$HOME/.bsdconfigrc" + +# +# Log our operating environment for debugging purposes +# +export UNAME_S="$(uname -s)" # Operating System (i.e. FreeBSD) +export UNAME_P="$(uname -p)" # Processor Architecture (i.e. i386) +export UNAME_R="$(uname -r)" # Release Level (i.e. X.Y-RELEASE) +f_dprintf "UNAME_S=[$UNAME_S] UNAME_P=[$UNAME_P] UNAME_R=[$UNAME_R]" + +cd $BSDCFG_LIBE || f_die 1 "$msg_directory_not_found" "$BSDCFG_LIBE" + +# +# If a non-option argument was passed, process it as a menuitem selection... +# +if [ "$1" ]; then + # + # ...unless it's a long-option for usage. + # + case "$1" in + -help|--help|-\?) usage;; + esac + + # + # Find the INDEX (possibly i18n) claiming this keyword + # + lang="${LANG:-$LC_ALL}" + if [ "$lang" ]; then + sel=$( grep "^menu_selection=\"$1|" */INDEX.$lang \ + 2> /dev/null | tail -1 ) + + # Fall-back to non-i18n sources if nothing was found + [ "$sel" ] || + sel=$( grep "^menu_selection=\"$1|" */INDEX | tail -1 ) + else + sel=$( grep "^menu_selection=\"$1|" */INDEX | tail -1 ) + fi + + # + # If no matches, display usage (which shows valid keywords) + # + if [ ! "$sel" ]; then + f_err "%s: %s: $msg_not_found\n" "$pgm" "$1" + usage + fi + + # + # The command to execute is after the pipe-character (|) in the + # menu_selection property of the INDEX file for the menuitem. + # + cmd="${sel#*|}" + cmd="${cmd%\"}" + if [ ! "$cmd" ]; then + echo "$pgm: $1: $msg_not_found" + usage + fi + shift + + # + # If the command pathname is not fully qualified fix-up/force to be + # relative to the menuitem directory. + # + case "$cmd" in + /*) : already fully qualified ;; + *) + dir="${sel%%/*}" + cmd="$dir/$cmd" + esac + + exec $cmd ${USE_XDIALOG:+-X} "$@" || exit 1 +fi + +[ -f "$HOME/.bsdconfigrc" ] || f_dialog_msgbox "$msg_help_text" + +# +# Launch application main menu +# +while :; do + dialog_menu_main + retval=$? + mtag=$( f_dialog_menutag ) + f_dprintf "retval=$retval mtag=[$mtag]" + + [ $retval -eq 0 ] || f_die + + case "$mtag" in + X) # Exit + break + ;; + + *) # Dynamically loaded menuitem + cmd=$( eval echo \"\$menu_program$mtag\" ) + f_dprintf "cmd=[$cmd]" + $cmd ${USE_XDIALOG:+-X} + ;; + + esac +done + +exit $SUCCESS + +################################################################################ +# END +################################################################################ Added: head/usr.sbin/bsdconfig/bsdconfig.8 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/bsdconfig/bsdconfig.8 Sat Jul 14 03:16:57 2012 (r238438) @@ -0,0 +1,240 @@ +.\" Copyright (c) 2012 Ron McDowell +.\" Copyright (c) 2012 Devin Teske +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +.\" DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, +.\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +.\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +.\" POSSIBILITY OF SUCH DAMAGE. +.\" +.\" docsinstall +.\" password +.\" diskmgmt +.\" usermgmt +.\" useradd +.\" useredit +.\" userdel +.\" groupmgmt +.\" groupadd +.\" groupedit +.\" groupdel +.\" console +.\" syscons_font +.\" syscons_keymap +.\" syscons_repeat +.\" syscons_saver +.\" syscons_screenmap +.\" syscons_ttys +.\" timezone +.\" mouse +.\" mouse_enable +.\" mouse_type +.\" mouse_port +.\" mouse_flags +.\" mouse_disable +.\" networking +.\" defaultrouter +.\" hostname +.\" nameservers +.\" netdev +.\" security +.\" ttys +.\" [dot] +.\" +.\" $FreeBSD$ +.\" +.Dd Mar 20, 2012 +.Dt BSDCONFIG 8 +.Os +.Sh NAME +.Nm bsdconfig +.Nd system configuration utility +.Sh SYNOPSIS +.Nm +.Op Fl h +.Nm +.Ar command +.Op Fl h +.Nm +.Op OPTIONS +.Op command Op OPTIONS +.Sh DESCRIPTION +.Nm +is used to set up many system configuration settings, both for new systems, as +well as changing configuration settings of existing systems. +.Pp +.Nm +takes a command as an argument. If invoked with no arguments, it will bring up +a master menu listing the available commands. +.Pp +The following options are available: +.Bl -tag -width indent+ +.It Fl h +Print usage statement and exit. +.It Fl S +Secure X11 mode +.Pq implies Fl X . +As root, always prompt-for and validate +.Xr sudo 8 +username/password before starting. +.It Fl X +Use +.Xr Xdialog 1 +in place of +.Xr dialog 1 . + +.Sh COMMANDS +The following commands +.Pq sorted alphabetically +are currently included in the base +.Nm +program, with more to be added soon. Other commands can be added, as detailed +below in the +.Cm ADDING COMMANDS +section, and once added, will appear in the master menu as well as in the +.Cm -h +listing. +.Bl -tag -width ".Cm syscons_screenmap" +.It Cm console +Utilities to customize the behavior of the system console. +.It Cm defaultrouter +Shortcut to the Default Router/Gateway menu under networking. +.It Cm diskmgmt +Manage disk partitions and/or labels. Executes +.Xr sade 8 . +.It Cm docsinstall +Executes the +.Cm bsdinstall docsinstall +sub-utility to allow installation/re-installation of the FreeBSD Documentation +set(s). +.It Cm dot +Generate a graphviz +.Xr dot 1 +language file +.Pq printed on stdout +visualizing the +.Xr bsdconfig 8 +menu, include, and shortcut structure and relationships. See +.Dq bsdconfig dot -h +for more details. +.It Cm groupadd +Shortcut to the Add Groups menu under groupmgmt. +.It Cm groupdel +Shortcut to the Delete Groups menu under groupmgmt. +.It Cm groupedit +Shortcut to the Edit/View Groups menu under groupmgmt. +.It Cm groupmgmt +Utilities to Add/Change/View/Delete Group Accounts. +.It Cm hostname +Shortcut to the Hostname/Domain menu under networking. +.It Cm mouse +Utilities for configuring, exploring, and enabling console mouse support. +.It Cm mouse_disable +Shortcut to the Disable menu under mouse. +.It Cm mouse_enable +Shortcut to the Enable menu under mouse. +.It Cm mouse_flags +Shortcut to the Flags menu under mouse. +.It Cm mouse_port +Shortcut to the Port menu under mouse. +.It Cm mouse_type +Shortcut to the Type menu under mouse. +.It Cm nameservers +Shortcut to the DNS Nameservers menu under networking. +.It Cm netdev +Shortcut to the Network Interfaces menu under networking. +.It Cm networking +Utilities to set/change Hostname/Domain, Network Interfaces, Default +Router/Gateway, and DNS Nameservers. +.It Cm password +Set the system administrator +.Pq root +password. +.It Cm security +Configure various system security settings. +.It Cm syscons_font +Shortcut to the Font menu under console. +.It Cm syscons_keymap +Shortcut to the Keymap menu under console. +.It Cm syscons_repeat +Shortcut to the Repeat menu under console. +.It Cm syscons_saver +Shortcut to the Saver menu under console. +.It Cm syscons_screenmap +Shortcut to the Screenmap menu under console. +.It Cm syscons_ttys +Shortcut to the Ttys menu under console. +.It Cm timezone +Set the regional timezone of the local machine. +.It Cm useradd +Shortcut to the Add Users menu under usermgmt. +.It Cm userdel +Shortcut to the Delete Users menu under usermgmt. +.It Cm useredit +Shortcut to the Edit/View Users menu under usermgmt. +.It Cm usermgmt +Utilities to Add/Edit/View/Delete User Accounts. + +.Sh INTERNATIONALIZATION +i18n features are built into +.Nm +and language-specific translation files will be added as they become available. +In the absence of language-specific translation files, the default +.Pq en_US.ISO8859-1 +files will be used. + +.Sh ADDING COMMANDS +To be documented later. Document menu_selection="command|*" syntax of INDEX +files. + +.Sh ENVIRONMENT VARIABLES +The following environment variables affect the execution of +.Nm : +.Bl -tag -width ".Ev LC_ALL" +.It Ev LANG +If LANG is set, messages and index information will be read from files named +messages.$LANG and INDEX.$LANG and fall back to files named messages and INDEX if +messages.$LANG and INDEX.$LANG do not exist. LANG takes precedence over LC_ALL. +.It Ev LC_ALL +If LC_ALL is set, messages and index information will be read from files named +messages.$LC_ALL and INDEX.$LC_ALL and fall back to files named messages and INDEX if +messages.$LC_ALL and INDEX.$LC_ALL do not exist. + +.Sh FILES +/usr/share/examples/bsdconfig/bsdconfigrc can be copied to $HOME/.bsdconfigrc and +customized as needed. + +.Sh EXIT STATUS +.Ex -std + +.Sh SEE ALSO +.Xr host-setup 8 + +.Sh HISTORY +.Nm +first appeared in +.Fx 10.0 . + +.Sh AUTHORS +.\" An -nosplit +.An Ron McDowell Aq rcm@FuzzWad.ORG +.An Devin Teske Aq devinteske@hotmail.com + +.Sh BUGS +Undoubtedly. Added: head/usr.sbin/bsdconfig/console/INDEX ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/bsdconfig/console/INDEX Sat Jul 14 03:16:57 2012 (r238438) @@ -0,0 +1,59 @@ +# Copyright (c) 2012 Ron McDowell +# Copyright (c) 2012 Devin Teske +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD$ + +# +# Title that will be shown on the bsdconfig menu +menu_title="Console" +# +# a short descriptive line shown at the bottom of the bsdconfig menu. +# keep it short because any line longer than the terminal width will +# be truncated. +menu_help="Customize system console behavior" +# +# two-part variable that defines an action to take when 'keyword' +# is passed on a bsdconfig command line. variable takes the form +# "keyword|command" and multiple occurrences of the variable +# (with different 'keyword's, or different 'keyword's AND 'command's) +# are allowed. If 'command' begins with a '/' then the full +# path to the program is needed. If 'command' begins with anything +# else it is a path relative to the directory this INDEX file is in. +# 'keyword' can be i18n'ed but 'command' is the name of a script. +menu_selection="console|console" +menu_selection="syscons_font|font" +menu_selection="syscons_keymap|keymap" +menu_selection="syscons_repeat|repeat" +menu_selection="syscons_saver|saver" +menu_selection="syscons_screenmap|screenmap" +menu_selection="syscons_ttys|ttys" +# +# Items below this line do NOT need i18n translation---------------------- +# +# Name of the program to be run when this menu choice is selected. +# if it begins with a '/' then the full path to the program is needed. +# if it begins with anything else it is a path relative to the directory +# this INDEX file is in. +menu_program="console" Added: head/usr.sbin/bsdconfig/console/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/bsdconfig/console/Makefile Sat Jul 14 03:16:57 2012 (r238438) @@ -0,0 +1,16 @@ +# $FreeBSD$ + +NO_OBJ= + +SUBDIR= include + +FILESDIR= ${LIBEXECDIR}/bsdconfig/080.console +FILES= INDEX USAGE + +SCRIPTSDIR= ${FILESDIR} +SCRIPTS= console font keymap repeat saver screenmap ttys + +beforeinstall: + mkdir -p ${DESTDIR}${FILESDIR} + +.include <bsd.prog.mk> Added: head/usr.sbin/bsdconfig/console/USAGE ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/bsdconfig/console/USAGE Sat Jul 14 03:16:57 2012 (r238438) @@ -0,0 +1,33 @@ +# Copyright (c) 2012 Devin Teske +# All Rights Reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD$ + +Usage: bsdconfig @PROGRAM_NAME@ [OPTIONS] + +OPTIONS: + -h Print usage statement and exit. + -S Secure X11 mode (implies `-X'). As root, always prompt-for + and validate sudo(8) username/password before starting. + -X Use Xdialog(1) in place of dialog(1). Added: head/usr.sbin/bsdconfig/console/console ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/bsdconfig/console/console Sat Jul 14 03:16:57 2012 (r238438) @@ -0,0 +1,137 @@ +#!/bin/sh +#- +# Copyright (c) 2012 Devin Teske +# All Rights Reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD$ +# +############################################################ INCLUDES + +BSDCFG_LIBE="/usr/libexec/bsdconfig" +. $BSDCFG_LIBE/include/common.subr || exit 1 +f_include $BSDCFG_LIBE/include/dialog.subr +f_include $BSDCFG_LIBE/include/mustberoot.subr + +APP_DIR="080.console" +f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr + +ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" ) +[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm" + +############################################################ FUNCTIONS + +# dialog_menu_main +# +# Display the dialog(1)-based application main menu. +# +dialog_menu_main() +{ + local menu_list size + local hline="$hline_configure_system_console_settings" + local prompt="$msg_console_menu_text" + + menu_list=" + 'X $msg_exit' '$msg_exit_this_menu' + '2 $msg_font' '$msg_choose_alternate_screen_font' + '3 $msg_keymap' '$msg_choose_alternate_keyboard_map' + '4 $msg_repeat' '$msg_set_repeat_rate' + '5 $msg_saver' '$msg_configure_screen_saver' + '6 $msg_screenmap' '$msg_choose_alternate_screenmap' + '7 $msg_ttys' '$msg_choose_console_terminal_type' + " # END-QUOTE + + size=$( eval f_dialog_menu_size \ + \"\$DIALOG_TITLE\" \ + \"\$DIALOG_BACKTITLE\" \ + \"\$prompt\" \ + \"\$hline\" \ + $menu_list ) + + eval $DIALOG \ + --clear --title \"\$DIALOG_TITLE\" \ + --backtitle \"\$DIALOG_BACKTITLE\" \ + --hline \"\$hline\" \ + --ok-label \"\$msg_ok\" \ + --cancel-label \"\$msg_cancel\" \ + --menu \"\$prompt\" $size \ + $menu_list \ + 2> "$DIALOG_TMPDIR/dialog.menu.$$" +} + +############################################################ MAIN + +# Incorporate rc-file if it exists +[ -f "$HOME/.bsdconfigrc" ] && f_include "$HOME/.bsdconfigrc" + +# +# Process command-line arguments +# +while getopts hSX flag; do + case "$flag" in + h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";; + esac +done +shift $(( $OPTIND - 1 )) + +# +# Initialize +# +f_dialog_init +f_dialog_title "$msg_system_console_configuration" +f_dialog_backtitle "${ipgm:+bsdconfig }$pgm" +f_mustberoot_init + +# +# Launch application main menu +# +while :; do + dialog_menu_main + retval=$? + mtag=$( f_dialog_menutag ) + + [ $retval -eq 0 ] || f_die + + case "$mtag" in + "X $msg_exit") break ;; + "2 $msg_font") # Choose an alternate screen font + $BSDCFG_LIBE/$APP_DIR/font ${USE_XDIALOG:+-X} ;; + "3 $msg_keymap") # Choose an alternate keyboard map + $BSDCFG_LIBE/$APP_DIR/keymap ${USE_XDIALOG:+-X} ;; + "4 $msg_repeat") # Set the rate at which keys repeat + $BSDCFG_LIBE/$APP_DIR/repeat ${USE_XDIALOG:+-X} ;; + "5 $msg_saver") # Configure the screen saver + $BSDCFG_LIBE/$APP_DIR/saver ${USE_XDIALOG:+-X} ;; + "6 $msg_screenmap") # Choose an alternate screenmap + $BSDCFG_LIBE/$APP_DIR/screenmap ${USE_XDIALOG:+-X} ;; + "7 $msg_ttys") # Choose console terminal type + $BSDCFG_LIBE/$APP_DIR/ttys ${USE_XDIALOG:+-X} ;; + esac + +done + +exit $SUCCESS + +################################################################################ +# END +################################################################################ Added: head/usr.sbin/bsdconfig/console/font ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/bsdconfig/console/font Sat Jul 14 03:16:57 2012 (r238438) @@ -0,0 +1,205 @@ +#!/bin/sh +#- +# Copyright (c) 2012 Devin Teske +# All Rights Reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD$ +# +############################################################ INCLUDES + +BSDCFG_LIBE="/usr/libexec/bsdconfig" +. $BSDCFG_LIBE/include/common.subr || exit 1 +f_include $BSDCFG_LIBE/include/dialog.subr +f_include $BSDCFG_LIBE/include/mustberoot.subr +f_include $BSDCFG_LIBE/include/sysrc.subr + +APP_DIR="080.console" +f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr + +ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" ) +[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm" + +############################################################ FUNCTIONS + +# dialog_menu_main +# +# Display the dialog(1)-based application main menu. +# +dialog_menu_main() +{ + local menu_list size + local hline="$hline_choose_a_font" + local prompt="$msg_font_menu_text" + + menu_list=" + '1 $msg_none' '$msg_use_hardware_default_font' + '2 $msg_ibm_437' '$msg_ibm_437_desc' + '3 $msg_ibm_850' '$msg_ibm_850_desc' + '4 $msg_ibm_865' '$msg_ibm_865_desc' + '5 $msg_ibm_866' '$msg_ibm_866_desc' + '6 $msg_ibm_866u' '$msg_ibm_866u_desc' + '7 $msg_ibm_1251' '$msg_ibm_1251_desc' + '8 $msg_iso_8859_1' '$msg_iso_8859_1_desc' + '9 $msg_iso_8859_2' '$msg_iso_8859_2_desc' + 'a $msg_iso_8859_4' '$msg_iso_8859_4_desc' + 'b $msg_iso_8859_7' '$msg_iso_8859_7_desc' + 'c $msg_iso_8859_8' '$msg_iso_8859_8_desc' + 'd $msg_iso_8859_15' '$msg_iso_8859_15_desc' + 'e $msg_swiss' '$msg_swiss_desc' + " # END-QUOTE + + size=$( eval f_dialog_menu_size \ + \"\$DIALOG_TITLE\" \ + \"\$DIALOG_BACKTITLE\" \ + \"\$prompt\" \ *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201207140316.q6E3Gw7C005617>