summaryrefslogtreecommitdiffstats
path: root/usr.sbin/bsdconfig/console
diff options
context:
space:
mode:
authordteske <dteske@FreeBSD.org>2012-07-14 03:16:57 +0000
committerdteske <dteske@FreeBSD.org>2012-07-14 03:16:57 +0000
commit3981b9b76aa0266598ee7b724e5981627d8ac129 (patch)
tree8b439d31cf63b5d5c97b653a3cd721fd9961baa5 /usr.sbin/bsdconfig/console
parent5d2a55de5070f6d3a8e4b9762a397596e7b308ae (diff)
downloadFreeBSD-src-3981b9b76aa0266598ee7b724e5981627d8ac129.zip
FreeBSD-src-3981b9b76aa0266598ee7b724e5981627d8ac129.tar.gz
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)
Diffstat (limited to 'usr.sbin/bsdconfig/console')
-rw-r--r--usr.sbin/bsdconfig/console/INDEX59
-rw-r--r--usr.sbin/bsdconfig/console/Makefile16
-rw-r--r--usr.sbin/bsdconfig/console/USAGE33
-rwxr-xr-xusr.sbin/bsdconfig/console/console137
-rwxr-xr-xusr.sbin/bsdconfig/console/font205
-rw-r--r--usr.sbin/bsdconfig/console/include/Makefile11
-rw-r--r--usr.sbin/bsdconfig/console/include/messages.subr264
-rwxr-xr-xusr.sbin/bsdconfig/console/keymap365
-rwxr-xr-xusr.sbin/bsdconfig/console/repeat134
-rwxr-xr-xusr.sbin/bsdconfig/console/saver198
-rwxr-xr-xusr.sbin/bsdconfig/console/screenmap142
-rwxr-xr-xusr.sbin/bsdconfig/console/ttys197
12 files changed, 1761 insertions, 0 deletions
diff --git a/usr.sbin/bsdconfig/console/INDEX b/usr.sbin/bsdconfig/console/INDEX
new file mode 100644
index 0000000..30ebcf8
--- /dev/null
+++ b/usr.sbin/bsdconfig/console/INDEX
@@ -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"
diff --git a/usr.sbin/bsdconfig/console/Makefile b/usr.sbin/bsdconfig/console/Makefile
new file mode 100644
index 0000000..aa6c6f1
--- /dev/null
+++ b/usr.sbin/bsdconfig/console/Makefile
@@ -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>
diff --git a/usr.sbin/bsdconfig/console/USAGE b/usr.sbin/bsdconfig/console/USAGE
new file mode 100644
index 0000000..9aa4dca
--- /dev/null
+++ b/usr.sbin/bsdconfig/console/USAGE
@@ -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).
diff --git a/usr.sbin/bsdconfig/console/console b/usr.sbin/bsdconfig/console/console
new file mode 100755
index 0000000..d4eeec8
--- /dev/null
+++ b/usr.sbin/bsdconfig/console/console
@@ -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
+################################################################################
diff --git a/usr.sbin/bsdconfig/console/font b/usr.sbin/bsdconfig/console/font
new file mode 100755
index 0000000..5ea3e2d
--- /dev/null
+++ b/usr.sbin/bsdconfig/console/font
@@ -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\" \
+ \"\$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_font"
+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
+ "1 $msg_none") # Use hardware default font
+ f_sysrc_set font8x8 "NO" || f_die
+ f_sysrc_set font8x14 "NO" || f_die
+ f_sysrc_set font8x16 "NO" || f_die
+ break ;;
+ "2 $msg_ibm_437") # English and others, VGA default
+ f_sysrc_set font8x8 "cp437-8x8" || f_die
+ f_sysrc_set font8x14 "cp437-8x14" || f_die
+ f_sysrc_set font8x16 "cp437-8x16" || f_die
+ break ;;
+ "3 $msg_ibm_850") # Western Europe, IBM encoding
+ f_sysrc_set font8x8 "cp850-8x8" || f_die
+ f_sysrc_set font8x14 "cp850-8x14" || f_die
+ f_sysrc_set font8x16 "cp850-8x16" || f_die
+ break ;;
+ "4 $msg_ibm_865") # Norwegian, IBM encoding
+ f_sysrc_set font8x8 "cp865-8x8" || f_die
+ f_sysrc_set font8x14 "cp865-8x14" || f_die
+ f_sysrc_set font8x16 "cp865-8x16" || f_die
+ break ;;
+ "5 $msg_ibm_866") # Russian, IBM encoding (use with KOI8-R screenmap)
+ f_sysrc_set font8x8 "cp866-8x8" || f_die
+ f_sysrc_set font8x14 "cp866-8x14" || f_die
+ f_sysrc_set font8x16 "cp866b-8x16" || f_die
+ f_sysrc_set mousechar_start 3 || f_die
+ break ;;
+ "6 $msg_ibm_866u") # Ukrainian, IBM encoding (use w/ KOI8-U screenmap)
+ f_sysrc_set font8x8 "cp866u-8x8" || f_die
+ f_sysrc_set font8x14 "cp866u-8x14" || f_die
+ f_sysrc_set font8x16 "cp866u-8x16" || f_die
+ f_sysrc_set mousechar_start 3 || f_die
+ break ;;
+ "7 $msg_ibm_1251") # Cyrillic, MS Windows encoding
+ f_sysrc_set font8x8 "cp1251-8x8" || f_die
+ f_sysrc_set font8x14 "cp1251-8x14" || f_die
+ f_sysrc_set font8x16 "cp1251-8x16" || f_die
+ f_sysrc_set mousechar_start 3 || f_die
+ break ;;
+ "8 $msg_iso_8859_1") # Western Europe, ISO encoding
+ f_sysrc_set font8x8 "iso-8x8" || f_die
+ f_sysrc_set font8x14 "iso-8x14" || f_die
+ f_sysrc_set font8x16 "iso-8x16" || f_die
+ break ;;
+ "9 $msg_iso_8859_2") # Eastern Europe, ISO encoding
+ f_sysrc_set font8x8 "iso02-8x8" || f_die
+ f_sysrc_set font8x14 "iso02-8x14" || f_die
+ f_sysrc_set font8x16 "iso02-8x16" || f_die
+ break ;;
+ "a $msg_iso_8859_4") # Baltic, ISO encoding
+ f_sysrc_set font8x8 "iso04-8x8" || f_die
+ f_sysrc_set font8x14 "iso04-8x14" || f_die
+ f_sysrc_set font8x16 "iso04-8x16" || f_die
+ break ;;
+ "b $msg_iso_8859_7") # Greek, ISO encoding
+ f_sysrc_set font8x8 "iso07-8x8" || f_die
+ f_sysrc_set font8x14 "iso07-8x14" || f_die
+ f_sysrc_set font8x16 "iso07-8x16" || f_die
+ break ;;
+ "c $msg_iso_8859_8") # Hebrew, ISO encoding
+ f_sysrc_set font8x8 "iso08-8x8" || f_die
+ f_sysrc_set font8x14 "iso08-8x14" || f_die
+ f_sysrc_set font8x16 "iso08-8x16" || f_die
+ break ;;
+ "d $msg_iso_8859_15") # Europe, ISO encoding
+ f_sysrc_set font8x8 "iso15-8x8" || f_die
+ f_sysrc_set font8x14 "iso15-8x14" || f_die
+ f_sysrc_set font8x16 "iso15-8x16" || f_die
+ break ;;
+ "e $msg_swiss") # English, better resolution
+ f_sysrc_set font8x8 "swiss-8x8" || f_die
+ f_sysrc_set font8x14 "NO" || f_die
+ f_sysrc_set font8x16 "swiss-8x16" || f_die
+ break ;;
+ esac
+
+done
+
+exit $SUCCESS
+
+################################################################################
+# END
+################################################################################
diff --git a/usr.sbin/bsdconfig/console/include/Makefile b/usr.sbin/bsdconfig/console/include/Makefile
new file mode 100644
index 0000000..e915751
--- /dev/null
+++ b/usr.sbin/bsdconfig/console/include/Makefile
@@ -0,0 +1,11 @@
+# $FreeBSD$
+
+NO_OBJ=
+
+FILESDIR= ${LIBEXECDIR}/bsdconfig/080.console/include
+FILES= messages.subr
+
+beforeinstall:
+ mkdir -p ${DESTDIR}${FILESDIR}
+
+.include <bsd.prog.mk>
diff --git a/usr.sbin/bsdconfig/console/include/messages.subr b/usr.sbin/bsdconfig/console/include/messages.subr
new file mode 100644
index 0000000..ffc9084
--- /dev/null
+++ b/usr.sbin/bsdconfig/console/include/messages.subr
@@ -0,0 +1,264 @@
+# 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$
+
+hline_choose_a_font="Choose a font"
+hline_choose_a_keyboard_map="Choose a keyboard map"
+hline_choose_a_keyboard_repeat_rate="Choose a keyboard repeat rate"
+hline_choose_a_screen_map="Choose a screen map"
+hline_choose_a_screen_saver="Choose a nifty-looking screen saver"
+hline_choose_a_terminal_type="Choose a terminal type"
+hline_configure_system_console_settings="Configure your system console settings"
+msg_beastie="Beastie"
+msg_beastie_desc="\"BSD Daemon\" animated screen saver (graphics)"
+msg_belgian="Belgian"
+msg_belgian_desc="Belgian ISO keymap"
+msg_blank="Blank"
+msg_blank_desc="Simply blank the screen"
+msg_brazil_cp850="Brazil CP850"
+msg_brazil_cp850_desc="Brazil CP850 keymap"
+msg_brazil_iso="Brazil ISO"
+msg_brazil_iso_accent="Brazil ISO (accent)"
+msg_brazil_iso_accent_desc="Brazil ISO keymap (accent keys)"
+msg_brazil_iso_desc="Brazil ISO keymap"
+msg_bulgarian_bds="Bulgarian BDS"
+msg_bulgarian_bds_desc="Bulgarian BDS keymap"
+msg_bulgarian_phonetic="Bulgarian Phonetic"
+msg_bulgarian_phonetic_desc="Bulgarian Phonetic keymap"
+msg_cancel="Cancel"
+msg_central_european_iso="Central European ISO"
+msg_central_european_iso_desc="Central European ISO keymap"
+msg_choose_alternate_keyboard_map="Choose an alternate keyboard map"
+msg_choose_alternate_screenmap="Choose an alternate screenmap"
+msg_choose_alternate_screen_font="Choose an alternate screen font"
+msg_choose_console_terminal_type="Choose console terminal type"
+msg_configure_screen_saver="Configure the screen saver"
+msg_console_menu_text="The system console driver for FreeBSD has a number of configuration\noptions which may be set according to your preference.\n\nWhen you are done setting configuration options, select Cancel."
+msg_croatian_iso="Croation ISO"
+msg_croatian_iso_desc="Croation ISO keymap"
+msg_czech_iso_accent="Czech ISO (accent)"
+msg_czech_iso_accent_desc="Czech ISO keymap (accent keys)"
+msg_daemon="Daemon"
+msg_daemon_desc="\"BSD Daemon\" animated screen saver (text)"
+msg_danish_cp865="Danish CP865"
+msg_danish_cp865_desc="Danish Code Page 865 keymap"
+msg_danish_iso="Danish ISO"
+msg_danish_iso_desc="Danish ISO keymap"
+msg_default="Default"
+msg_default_desc="Use default keyboard repeat rate"
+msg_dragon="Dragon"
+msg_dragon_desc="Dragon screensaver (graphics)"
+msg_enter_timeout_period="Enter time-out period in seconds for screen saver"
+msg_estonian_cp850="Estonian CP850"
+msg_estonian_cp850_desc="Estonian Code Page 850 keymap"
+msg_estonian_iso="Estonian ISO"
+msg_estonian_iso_desc="Estonian ISO keymap"
+msg_estonian_iso_15="Estonian ISO 15"
+msg_estonian_iso_15_desc="Estonian ISO 8859-15 keymap"
+msg_exit="Exit"
+msg_exit_this_menu="Exit this menu (returning to previous)"
+msg_fade="Fade"
+msg_fade_desc="Fade out effect screen saver"
+msg_fast="Fast"
+msg_fast_desc="Fast keyboard repeat rate"
+msg_finnish_cp850="Finnish CP850"
+msg_finnish_cp850_desc="Finnish Code Page 850 keymap"
+msg_finnish_iso="Finnish ISO"
+msg_finnish_iso_desc="Finnish ISO keymap"
+msg_fire="Fire"
+msg_fire_desc="Flames effect screen saver"
+msg_font="Font"
+msg_font_menu_text="Most PC hardware defaults to displaying characters in the\nIBM 437 character set. However, in the Unix world, this\ncharacter set is very rarely used. Most Western European\ncountries, for example, prefer ISO 8859-1.\nAmerican users won't notice the difference since the bottom half\nof all these charactersets is ANSI anyway. However, they might\nwant to load a font anyway to use the 30- or 50-line displays.\nIf your hardware is capable of downloading a new display font,\nyou can select the appropriate font below."
+msg_french_iso="French ISO"
+msg_french_iso_accent="French ISO (accent)"
+msg_french_iso_accent_desc="French ISO keymap (accent keys)"
+msg_french_iso_desc="French ISO keymap"
+msg_french_iso_macbook="French ISO/Macbook"
+msg_french_iso_macbook_desc="French ISO keymap on macbook"
+msg_green="Green"
+msg_green_desc="\"Green\" power saving mode (if supported by monitor)"
+msg_german_cp850="German CP850"
+msg_german_cp850_desc="German Code Page 850 keymap"
+msg_german_iso="German ISO"
+msg_german_iso_desc="German ISO keymap"
+msg_greek_101="Greek 101"
+msg_greek_101_desc="Greek ISO keymap (101 keys)"
+msg_greek_104="Greek 104"
+msg_greek_104_desc="Greek ISO keymap (104 keys)"
+msg_greek_elot="Greek ELOT"
+msg_greek_elot_desc="Greek ISO keymap (ELOT 1000)"
+msg_hungarian_101="Hungarian 101"
+msg_hungarian_101_desc="Hungarian ISO keymap (101 key)"
+msg_hungarian_102="Hungarian 102"
+msg_hungarian_102_desc="Hungarian ISO keymap (102 key)"
+msg_ibm_437="IBM 437"
+msg_ibm_437_desc="English and others, VGA default"
+msg_ibm_437_vga_default="IBM437 (VGA default)"
+msg_ibm_850="IBM 850"
+msg_ibm_850_desc="Western Europe, IBM encoding"
+msg_ibm_865="IBM 865"
+msg_ibm_865_desc="Norwegian, IBM encoding"
+msg_ibm_866="IBM 866"
+msg_ibm_866_desc="Russian, IBM encoding (use with KOI8-R screenmap)"
+msg_ibm_866u="IBM 866u"
+msg_ibm_866u_desc="Ukrainian, IBM encoding (use with KOI8-U screenmap)"
+msg_ibm_1251="IBM 1251"
+msg_ibm_1251_desc="Cyrillic, MS Windows encoding"
+msg_icelandic="Icelandic"
+msg_icelandic_accent="Icelandic (accent)"
+msg_icelandic_accent_desc="Icelandic ISO keymap (accent keys)"
+msg_icelandic_desc="Icelandic ISO keymap"
+msg_iso_8859_1="ISO 8859-1"
+msg_iso_8859_1_desc="Western Europe, ISO encoding"
+msg_iso_8859_1_to_ibm437="ISO 8859-1 to IBM437"
+msg_iso_8859_1_to_ibm437_desc="W-Europe ISO 8859-1 to IBM 437 screenmap"
+msg_iso_8859_2="ISO 8859-2"
+msg_iso_8859_2_desc="Eastern Europe, ISO encoding"
+msg_iso_8859_4="ISO 8859-4"
+msg_iso_8859_4_desc="Baltic, ISO encoding"
+msg_iso_8859_7="ISO 8859-7"
+msg_iso_8859_7_desc="Greek, ISO encoding"
+msg_iso_8859_7_to_ibm437="ISO 8859-7 to IBM437"
+msg_iso_8859_7_to_ibm437_desc="Greek ISO 8859-1 to IBM 437 screenmap"
+msg_iso_8859_8="ISO 8859-8"
+msg_iso_8859_8_desc="Hebrew, ISO encoding"
+msg_iso_8859_15="ISO 8859-15"
+msg_iso_8859_15_desc="Europe, ISO encoding"
+msg_italian="Italian"
+msg_italian_desc="Italian ISO keymap"
+msg_japanese_106="Japanese 106"
+msg_japanese_106_desc="Japanese 106 keymap"
+msg_keymap="Keymap"
+msg_keymap_menu_text="The system console driver for FreeBSD defaults to a standard\n\"US\" keyboard map. Users may wish to choose one of the\nother keymaps below."
+msg_koi8_r="KOI8-R"
+msg_koi8_u="KOI8-U"
+msg_koi8_r_to_ibm866="KOI8-R to IBM866"
+msg_koi8_r_to_ibm866_desc="Russian KOI8-R to IBM 866 screenmap"
+msg_koi8_u_to_ibm866u="KOI8-U to IBM866u"
+msg_koi8_u_to_ibm866u_desc="Ukrainian KOI8-U to IBM 866u screenmap"
+msg_latin_american="Latin American"
+msg_latin_american_accent="Latin American (accent)"
+msg_latin_american_accent_desc="Latin American ISO keymap (accent keys)"
+msg_latin_american_desc="Latin American ISO keymap"
+msg_logo="Logo"
+msg_logo_desc="FreeBSD \"logo\" animated screen saver (graphics)"
+msg_none="None"
+msg_none_saver_desc="Disable the screensaver"
+msg_none_screenmap_desc="No screenmap, don'\''t touch font"
+msg_none_ttys_desc="Don'\''t touch anything"
+msg_normal="Normal"
+msg_normal_desc="\"Normal\" keyboard repeat rate"
+msg_norway_iso="Norway ISO"
+msg_norway_iso_desc="Norwegian ISO keymap"
+msg_ok="OK"
+msg_polish_iso="Polish ISO"
+msg_polish_iso_desc="Polish ISO keymap"
+msg_portuguese="Portuguese"
+msg_portuguese_accent="Portuguese (accent)"
+msg_portuguese_accent_desc="Portuguese ISO keymap (accent keys)"
+msg_portuguese_desc="Portuguese ISO keymap"
+msg_rain="Rain"
+msg_rain_desc="Rain drops screen saver"
+msg_repeat="Repeat"
+msg_repeat_menu_text="This menu allows you to set the speed at which keys repeat\nwhen held down."
+msg_russia_koi8_r="Russia KOI8-R"
+msg_russia_koi8_r_desc="Russia KOI8-R keymap"
+msg_saver="Saver"
+msg_saver_menu_text="By default, the console driver will not attempt to do anything\nspecial with your screen when it's idle. If you expect to leave your\nmonitor switched on and idle for long periods of time then you should\nprobably enable one of these screen savers to prevent burn-in."
+msg_screenmap="Screenmap"
+msg_screenmap_menu_text="Unless you load a specific font, most PC hardware defaults to\ndisplaying characters in the IBM 437 character set. However,\nin the Unix world, this character set is very rarely used. Most\nWestern European countries, for example, prefer ISO 8859-1.\nAmerican users won't notice the difference since the bottom half\nof all these character sets is ANSI anyway.\nIf your hardware is capable of downloading a new display font,\nyou should probably choose that option. However, for hardware\nwhere this is not possible (e.g. monochrome adapters), a screen\nmap will give you the best approximation that your hardware can\ndisplay at all."
+msg_set_repeat_rate="Set the rate at which keys repeat"
+msg_slovak="Slovak"
+msg_slovak_desc="Slovak ISO keymap"
+msg_slovenian="Slovenian"
+msg_slovenian_desc="Slovenian ISO keymap"
+msg_slow="Slow"
+msg_slow_desc="Slow keyboard repeat rate"
+msg_snake="Snake"
+msg_snake_desc="Draw a FreeBSD \"snake\" on your screen"
+msg_spanish="Spanish"
+msg_spanish_accent="Spanish (accent)"
+msg_spanish_accent_desc="Spanish ISO keymap (accent keys)"
+msg_spanish_desc="Spanish ISO keymap"
+msg_star="Star"
+msg_star_desc="A \"twinkling stars\" effect"
+msg_swedish_cp850="Swedish CP850"
+msg_swedish_cp850_desc="Swedish Code Page 850 keymap"
+msg_swedish_iso="Swedish ISO"
+msg_swedish_iso_desc="Swedish ISO keymap"
+msg_swiss="SWISS"
+msg_swiss_desc="English, better resolution"
+msg_swiss_french_cp850="Swiss French CP850"
+msg_swiss_french_cp850_desc="Swiss French Code Page 850 keymap"
+msg_swiss_french_iso="Swiss French ISO"
+msg_swiss_french_iso_accent="Swiss French ISO (accent)"
+msg_swiss_french_iso_accent_desc="Swiss French ISO keymap (accent keys)"
+msg_swiss_french_iso_desc="Swiss French ISO keymap"
+msg_swiss_german_cp850="Swiss German CP850"
+msg_swiss_german_cp850_desc="Swiss German Code Page 850 keymap"
+msg_swiss_german_iso="Swiss German ISO"
+msg_swiss_german_iso_accent="Swiss German ISO (accent)"
+msg_swiss_german_iso_accent_desc="Swiss German ISO keymap (accent keys)"
+msg_swiss_german_iso_desc="Swiss German ISO keymap"
+msg_system_console_configuration="System Console Configuration"
+msg_system_console_font="System Console Font"
+msg_system_console_keymap="System Console Keymap"
+msg_system_console_keyboard_repeat_rate="System Console Keyboard Repeat Rate"
+msg_system_console_screen_saver="System Console Screen Saver"
+msg_system_console_screenmap="System Console Screenmap"
+msg_system_console_terminal_type="System Console Terminal Type"
+msg_timeout="Timeout"
+msg_timeout_desc="Set the screen saver timeout interval"
+msg_ttys="Ttys"
+msg_ttys_menu_text="For various console encodings, a corresponding terminal type\nmust be chosen in /etc/ttys.\n\nWARNING: For compatibility reasons, only entries starting with\nttyv and terminal types starting with cons[0-9] can be changed\nvia this menu."
+msg_uk_cp850="UK CP850"
+msg_uk_cp850_desc="UK Code Page 850 keymap"
+msg_uk_iso="UK ISO"
+msg_uk_iso_desc="UK ISO keymap"
+msg_ukrainian_koi8_u="Ukranian KOI8-U"
+msg_ukrainian_koi8_u_desc="Ukranian KOI8-U keymap"
+msg_ukrainian_koi8_u_koi8_r="Ukranian KOI8-U+KOI8-R"
+msg_ukrainian_koi8_u_koi8_r_desc="Ukranian KOI8-U+KOI8-R keymap (alter)"
+msg_us_ascii="US-ASCII"
+msg_us_ascii_to_ibm327="US-ASCII to IBM437"
+msg_us_ascii_to_ibm327_desc="US-ASCII to IBM 437 screenmap"
+msg_usa_capslock_ctrl="USA CapsLock->Ctrl"
+msg_usa_capslock_ctrl_desc="US standard (Caps as L-Control)"
+msg_usa_dvorak="USA Dvorak"
+msg_usa_dvorak_desc="US Dvorak keymap"
+msg_usa_dvorak_left="USA Dvorak (left)"
+msg_usa_dvorak_left_desc="US left handed Dvorak keymap"
+msg_usa_dvorak_right="USA Dvorak (right)"
+msg_usa_dvorak_right_desc="US right handed Dvorak keymap"
+msg_usa_emacs="USA Emacs"
+msg_usa_emacs_desc="US standard optimized for EMACS"
+msg_usa_iso="USA ISO"
+msg_usa_iso_desc="US ISO keymap"
+msg_usa_unix="USA UNIX"
+msg_usa_unix_desc="US traditional UNIX-workstation"
+msg_use_hardware_default_font="Use hardware default font"
+msg_value_required="Value Required"
+msg_warp="Warp"
+msg_warp_desc="A \"stars warping\" effect"
diff --git a/usr.sbin/bsdconfig/console/keymap b/usr.sbin/bsdconfig/console/keymap
new file mode 100755
index 0000000..63592e7
--- /dev/null
+++ b/usr.sbin/bsdconfig/console/keymap
@@ -0,0 +1,365 @@
+#!/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"
+
+############################################################ CONFIGURATION
+
+#
+# List of keymap names
+#
+KEYMAP_NAMES="
+ belgian brazil_cp850 brazil_iso
+ brazil_iso_accent bulgarian_bds bulgarian_phonetic
+ central_european_iso croatian_iso czech_iso_accent
+ danish_cp865 danish_iso estonian_cp850
+ estonian_iso estonian_iso_15 finnish_cp850
+ finnish_iso french_iso french_iso_accent
+ french_iso_macbook german_cp850 german_iso
+ greek_101 greek_104 greek_elot
+ hungarian_101 hungarian_102 icelandic
+ icelandic_accent italian japanese_106
+ latin_american latin_american_accent norway_iso
+ polish_iso portuguese portuguese_accent
+ russia_koi8_r slovak slovenian
+ spanish spanish_accent swedish_cp850
+ swedish_iso swiss_french_cp850 swiss_french_iso
+ swiss_french_iso_accent swiss_german_cp850 swiss_german_iso
+ swiss_german_iso_accent uk_cp850 uk_iso
+ ukrainian_koi8_u ukrainian_koi8_u_koi8_r usa_capslock_ctrl
+ usa_dvorak usa_dvorak_left usa_dvorak_right
+ usa_emacs usa_iso usa_unix
+" # END-QUOTE
+
+############################################################ FUNCTIONS
+
+# dialog_menu_main
+#
+# Display the dialog(1)-based application main menu.
+#
+dialog_menu_main()
+{
+ local menu_list size
+ local hline="$hline_choose_a_keyboard_map"
+ local prompt="$msg_keymap_menu_text"
+
+ #
+ # Export variables for awk(1) ENVIRON visibility
+ #
+ local name
+ for name in $KEYMAP_NAMES; do
+ export msg_$name msg_${name}_desc
+ done
+
+ #
+ # Generate a sorted list of keymaps. If the first letter of the keymap
+ # name is unique (case-insensitive) then it is used as the tag to allow
+ # the user to jump to that entry.
+ #
+ menu_list=$(
+ for name in $KEYMAP_NAMES; do
+ eval echo \"\$msg_$name\" msg_$name
+ done | sort | awk 'BEGIN { prefix = "" }
+ {
+ cur_prefix = tolower(substr(ENVIRON[$NF], 1, 1))
+ printf "'\''"
+ if ( prefix != cur_prefix )
+ prefix = cur_prefix
+ else
+ printf " "
+ printf "%s'\'' '\''%s'\''\n",
+ ENVIRON[$NF], ENVIRON[$NF"_desc"]
+ }'
+ )
+
+ 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_keymap"
+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
+
+ #
+ # Reverse the users choice into the variable name
+ #
+ keymap_name=
+ mtag="${mtag# }" # remove single leading-space if-present
+ for name in $KEYMAP_NAMES; do
+ if [ "$( eval echo \"\$msg_$name\" )" = "$mtag" ]; then
+ keymap_name="$name"
+ break
+ fi
+ done
+
+ [ "$keymap_name" ] || continue
+
+ case "$keymap_name" in
+ belgian)
+ f_sysrc_set keymap "be.iso" || f_die
+ break ;;
+ brazil_cp850)
+ f_sysrc_set keymap "br275.cp850" || f_die
+ break ;;
+ brazil_iso)
+ f_sysrc_set keymap "br275.iso" || f_die
+ break ;;
+ brazil_iso_accent)
+ f_sysrc_set keymap "br275.iso.acc" || f_die
+ break ;;
+ bulgarian_bds)
+ f_sysrc_set keymap "bg.bds.ctrlcaps" || f_die
+ break ;;
+ bulgarian_phonetic)
+ f_sysrc_set keymap "bg.phonetic.ctrlcaps" || f_die
+ break ;;
+ central_european_iso)
+ f_sysrc_set keymap "ce.iso2" || f_die
+ break ;;
+ croatian_iso)
+ f_sysrc_set keymap "hr.iso" || f_die
+ break ;;
+ czech_iso_accent)
+ f_sysrc_set keymap "cs.latin2.qwertz" || f_die
+ break ;;
+ danish_cp865)
+ f_sysrc_set keymap "danish.cp865" || f_die
+ break ;;
+ danish_iso)
+ f_sysrc_set keymap "danish.iso" || f_die
+ break ;;
+ estonian_cp850)
+ f_sysrc_set keymap "estonian.cp850" || f_die
+ break ;;
+ estonian_iso)
+ f_sysrc_set keymap "estonian.iso" || f_die
+ break ;;
+ estonian_iso_15)
+ f_sysrc_set keymap "estonian.iso15" || f_die
+ break ;;
+ finnish_cp850)
+ f_sysrc_set keymap "finnish.cp850" || f_die
+ break ;;
+ finnish_iso)
+ f_sysrc_set keymap "finnish.iso" || f_die
+ break ;;
+ french_iso)
+ f_sysrc_set keymap "fr.iso" || f_die
+ break ;;
+ french_iso_accent)
+ f_sysrc_set keymap "fr.iso.acc" || f_die
+ break ;;
+ french_iso_macbook)
+ f_sysrc_set keymap "fr.macbook.acc" || f_die
+ break ;;
+ german_cp850)
+ f_sysrc_set keymap "german.cp850" || f_die
+ break ;;
+ german_iso)
+ f_sysrc_set keymap "german.iso" || f_die
+ break ;;
+ greek_101)
+ f_sysrc_set keymap "gr.us101.acc" || f_die
+ break ;;
+ greek_104)
+ f_sysrc_set keymap "el.iso07" || f_die
+ break ;;
+ greek_elot)
+ f_sysrc_set keymap "gr.elot.acc" || f_die
+ break ;;
+ hungarian_101)
+ f_sysrc_set keymap "hu.iso2.101keys" || f_die
+ break ;;
+ hungarian_102)
+ f_sysrc_set keymap "hu.iso2.102keys" || f_die
+ break ;;
+ icelandic)
+ f_sysrc_set keymap "icelandic.iso" || f_die
+ break ;;
+ icelandic_accent)
+ f_sysrc_set keymap "icelandic.iso.acc" || f_die
+ break ;;
+ italian)
+ f_sysrc_set keymap "it.iso" || f_die
+ break ;;
+ japanese_106)
+ f_sysrc_set keymap "jp.106" || f_die
+ break ;;
+ latin_american)
+ f_sysrc_set keymap "latinamerican" || f_die
+ break ;;
+ latin_american_accent)
+ f_sysrc_set keymap "latinamerican.iso.acc" || f_die
+ break ;;
+ norway_iso)
+ f_sysrc_set keymap "norwegian.iso" || f_die
+ break ;;
+ polish_iso)
+ f_sysrc_set keymap "pl_PL.ISO8859-2" || f_die
+ break ;;
+ portuguese)
+ f_sysrc_set keymap "pt.iso" || f_die
+ break ;;
+ portuguese_accent)
+ f_sysrc_set keymap "pt.iso.acc" || f_die
+ break ;;
+ russia_koi8_r)
+ f_sysrc_set keymap "ru.koi8-r" || f_die
+ break ;;
+ slovak)
+ f_sysrc_set keymap "sk.iso2" || f_die
+ break ;;
+ slovenian)
+ f_sysrc_set keymap "si.iso" || f_die
+ break ;;
+ spanish)
+ f_sysrc_set keymap "spanish.iso" || f_die
+ break ;;
+ spanish_accent)
+ f_sysrc_set keymap "spanish.iso.acc" || f_die
+ break ;;
+ swedish_cp850)
+ f_sysrc_set keymap "swedish.cp850" || f_die
+ break ;;
+ swedish_iso)
+ f_sysrc_set keymap "swedish.iso" || f_die
+ break ;;
+ swiss_french_cp850)
+ f_sysrc_set keymap "swissfrench.cp850" || f_die
+ break ;;
+ swiss_french_iso)
+ f_sysrc_set keymap "swissfrench.iso" || f_die
+ break ;;
+ swiss_french_iso_accent)
+ f_sysrc_set keymap "swissfrench.iso.acc" || f_die
+ break ;;
+ swiss_german_cp850)
+ f_sysrc_set keymap "swissgerman.cp850" || f_die
+ break ;;
+ swiss_german_iso)
+ f_sysrc_set keymap "swissgerman.iso" || f_die
+ break ;;
+ swiss_german_iso_accent)
+ f_sysrc_set keymap "swissgerman.iso.acc" || f_die
+ break ;;
+ uk_cp850)
+ f_sysrc_set keymap "uk.cp850" || f_die
+ break ;;
+ uk_iso)
+ f_sysrc_set keymap "uk.iso" || f_die
+ break ;;
+ ukrainian_koi8_u)
+ f_sysrc_set keymap "ua.koi8-u" || f_die
+ break ;;
+ ukrainian_koi8_u_koi8_r)
+ f_sysrc_set keymap "ua.koi8-u.shift.alt" || f_die
+ break ;;
+ usa_capslock_ctrl)
+ f_sysrc_set keymap "us.pc-ctrl" || f_die
+ break ;;
+ usa_dvorak)
+ f_sysrc_set keymap "us.dvorak" || f_die
+ break ;;
+ usa_dvorak_left)
+ f_sysrc_set keymap "us.dvorakl" || f_die
+ break ;;
+ usa_dvorak_right)
+ f_sysrc_set keymap "us.dvorakr" || f_die
+ break ;;
+ usa_emacs)
+ f_sysrc_set keymap "us.emacs" || f_die
+ break ;;
+ usa_iso)
+ f_sysrc_set keymap "us.iso" || f_die
+ break ;;
+ usa_unix)
+ f_sysrc_set keymap "us.unix" || f_die
+ break ;;
+ esac
+done
+
+exit $SUCCESS
+
+################################################################################
+# END
+################################################################################
diff --git a/usr.sbin/bsdconfig/console/repeat b/usr.sbin/bsdconfig/console/repeat
new file mode 100755
index 0000000..8f968fd
--- /dev/null
+++ b/usr.sbin/bsdconfig/console/repeat
@@ -0,0 +1,134 @@
+#!/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_keyboard_repeat_rate"
+ local prompt="$msg_repeat_menu_text"
+
+ menu_list="
+ '$msg_slow' '$msg_slow_desc'
+ '$msg_normal' '$msg_normal_desc'
+ '$msg_fast' '$msg_fast_desc'
+ '$msg_default' '$msg_default_desc'
+ " # 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_keyboard_repeat_rate"
+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
+ "$msg_slow") # Slow keyboard repeat rate
+ f_sysrc_set keyrate "slow" || f_die
+ break ;;
+ "$msg_normal") # "Normal" keyboard repeat rate
+ f_sysrc_set keyrate "normal" || f_die
+ break ;;
+ "$msg_fast") # Fast keyboard repeat rate
+ f_sysrc_set keyrate "fast" || f_die
+ break ;;
+ "$msg_default") # Use default keyboard repeat rate
+ f_sysrc_set keyrate "NO" || f_die
+ break ;;
+ esac
+
+done
+
+exit $SUCCESS
+
+################################################################################
+# END
+################################################################################
diff --git a/usr.sbin/bsdconfig/console/saver b/usr.sbin/bsdconfig/console/saver
new file mode 100755
index 0000000..8e803d2
--- /dev/null
+++ b/usr.sbin/bsdconfig/console/saver
@@ -0,0 +1,198 @@
+#!/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_screen_saver"
+ local prompt="$msg_saver_menu_text"
+
+ menu_list="
+ '1 $msg_blank' '$msg_blank_desc'
+ '2 $msg_beastie' '$msg_beastie_desc'
+ '3 $msg_daemon' '$msg_daemon_desc'
+ '4 $msg_dragon' '$msg_dragon_desc'
+ '5 $msg_fade' '$msg_fade_desc'
+ '6 $msg_fire' '$msg_fire_desc'
+ '7 $msg_green' '$msg_green_desc'
+ '8 $msg_logo' '$msg_logo_desc'
+ '9 $msg_rain' '$msg_rain_desc'
+ 'a $msg_snake' '$msg_snake_desc'
+ 'b $msg_star' '$msg_star_desc'
+ 'c $msg_warp' '$msg_warp_desc'
+ 'd $msg_none' '$msg_none_saver_desc'
+ '$msg_timeout' '$msg_timeout_desc'
+ " # 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_screen_saver"
+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
+ "1 $msg_blank") # Simply blank the screen
+ f_sysrc_set saver "blank" || f_die
+ break ;;
+ "2 $msg_beastie") # "BSD Daemon" animated screen saver (graphics)
+ f_sysrc_set saver "beastie" || f_die
+ break ;;
+ "3 $msg_daemon") # "BSD Daemon" animated screen saver (text)
+ f_sysrc_set saver "daemon" || f_die
+ break ;;
+ "4 $msg_dragon") # Dragon screensaver (graphics)
+ f_sysrc_set saver "dragon" || f_die
+ break ;;
+ "5 $msg_fade") # Fade out effect screen saver
+ f_sysrc_set saver "fade" || f_die
+ break ;;
+ "6 $msg_fire") # Flames effect screen saver
+ f_sysrc_set saver "fire" || f_die
+ break ;;
+ "7 $msg_green") # "Green" power saving mode (if supported by monitor)
+ f_sysrc_set saver "green" || f_die
+ break ;;
+ "8 $msg_logo") # FreeBSD "logo" animated screen saver (graphics)
+ f_sysrc_set saver "logo" || f_die
+ break ;;
+ "9 $msg_rain") # Rain drops screen saver
+ f_sysrc_set saver "rain" || f_die
+ break ;;
+ "a $msg_snake") # Draw a FreeBSD "snake" on your screen
+ f_sysrc_set saver "snake" || f_die
+ break ;;
+ "b $msg_star") # A "twinkling stars" effect
+ f_sysrc_set saver "star" || f_die
+ break ;;
+ "c $msg_warp") # A "stars warping" effect
+ f_sysrc_set saver "warp" || f_die
+ break ;;
+ "d $msg_none") # Disable the screensaver
+ f_sysrc_set saver "NO" || f_die
+ break ;;
+ "$msg_timeout") # Set the screen saver timeout interval
+ f_dialog_title "$msg_value_required"
+ title="$DIALOG_TITLE"
+ btitle="$DIALOG_BACKTITLE"
+ f_dialog_title_restore
+ prompt="$msg_enter_timeout_period"
+ blanktime=$( f_sysrc_get blanktime )
+ hline=""
+ size=$( f_dialog_inputbox_size \
+ "$title" \
+ "$btitle" \
+ "$prompt" \
+ "$blanktime" \
+ "$hline" )
+ $DIALOG \
+ --title "$title" \
+ --backtitle "$btitle" \
+ --hline "$hline" \
+ --ok-label "$msg_ok" \
+ --cancel-label "$msg_cancel" \
+ --inputbox "$prompt" $size \
+ "$blanktime" \
+ 2> "$DIALOG_TMPDIR/dialog.inputbox.$$"
+ retval=$?
+ blanktime=$( f_dialog_inputstr )
+ [ $retval -eq $SUCCESS ] &&
+ f_sysrc_set blanktime "$blanktime"
+ ;;
+ esac
+done
+
+exit $SUCCESS
+
+################################################################################
+# END
+################################################################################
diff --git a/usr.sbin/bsdconfig/console/screenmap b/usr.sbin/bsdconfig/console/screenmap
new file mode 100755
index 0000000..9e10c9f
--- /dev/null
+++ b/usr.sbin/bsdconfig/console/screenmap
@@ -0,0 +1,142 @@
+#!/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_screen_map"
+ local prompt="$msg_screenmap_menu_text"
+
+ menu_list="
+ '1 $msg_none' '$msg_none_screenmap_desc'
+ '2 $msg_iso_8859_1_to_ibm437' '$msg_iso_8859_1_to_ibm437_desc'
+ '3 $msg_iso_8859_7_to_ibm437' '$msg_iso_8859_7_to_ibm437_desc'
+ '4 $msg_us_ascii_to_ibm327' '$msg_us_ascii_to_ibm327_desc'
+ '5 $msg_koi8_r_to_ibm866' '$msg_koi8_r_to_ibm866_desc'
+ '6 $msg_koi8_u_to_ibm866u' '$msg_koi8_u_to_ibm866u_desc'
+ " # 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_screenmap"
+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
+ "1 $msg_none") # No screenmap, don't touch font
+ f_sysrc_set scrnmap "NO" || f_die
+ break ;;
+ "2 $msg_iso_8859_1_to_ibm437") # W-Europe ISO 8859-1 to IBM 437 scrnmap
+ f_sysrc_set scrnmap "iso-8859-1_to_cp437" || f_die
+ break ;;
+ "3 $msg_iso_8859_7_to_ibm437") # Greek ISO 8859-7 to IBM 437 screenmap
+ f_sysrc_set scrnmap "iso-8859-7_to_cp437" || f_die
+ break ;;
+ "4 $msg_us_ascii_to_ibm327") # US-ASCII to IBM 437 screenmap
+ f_sysrc_set scrnmap "us-ascii_to_cp437" || f_die
+ break ;;
+ "5 $msg_koi8_r_to_ibm866") # Russian KOI8-R to IBM 866 screenmap
+ f_sysrc_set scrnmap "koi8-r2cp866" || f_die
+ break ;;
+ "6 $msg_koi8_u_to_ibm866u") # Ukrainian KOI8-U to IBM 866u screenmap
+ f_sysrc_set scrnmap "koi8-u2cp866u" || f_die
+ break ;;
+ esac
+
+done
+
+exit $SUCCESS
+
+################################################################################
+# END
+################################################################################
diff --git a/usr.sbin/bsdconfig/console/ttys b/usr.sbin/bsdconfig/console/ttys
new file mode 100755
index 0000000..7502bec
--- /dev/null
+++ b/usr.sbin/bsdconfig/console/ttys
@@ -0,0 +1,197 @@
+#!/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"
+
+############################################################ CONFIGURATION
+
+#
+# Location of ttys(5)
+#
+ETC_TTYS=/etc/ttys
+
+############################################################ GLOBALS
+
+#
+# Terminal-type map/menu-item list
+#
+TTY_MENU_LIST="
+ '1 $msg_none' '$msg_none_ttys_desc'
+ '2 $msg_ibm_437_vga_default' 'cons25'
+ '3 $msg_iso_8859_1' 'cons25l1'
+ '4 $msg_iso_8859_2' 'cons25l2'
+ '5 $msg_iso_8859_7' 'cons25l7'
+ '6 $msg_koi8_r' 'cons25r'
+ '7 $msg_koi8_u' 'cons25u'
+ '8 $msg_us_ascii' 'cons25w'
+" # END-QUOTE
+
+############################################################ FUNCTIONS
+
+# dialog_menu_main
+#
+# Display the dialog(1)-based application main menu.
+#
+dialog_menu_main()
+{
+ local size
+ local hline="$hline_choose_a_terminal_type"
+ local prompt="$msg_ttys_menu_text"
+
+ size=$( eval f_dialog_menu_size \
+ \"\$DIALOG_TITLE\" \
+ \"\$DIALOG_BACKTITLE\" \
+ \"\$prompt\" \
+ \"\$hline\" \
+ $TTY_MENU_LIST )
+
+ eval $DIALOG \
+ --clear --title \"\$DIALOG_TITLE\" \
+ --backtitle \"\$DIALOG_BACKTITLE\" \
+ --hline \"\$hline\" \
+ --ok-label \"\$msg_ok\" \
+ --cancel-label \"\$msg_cancel\" \
+ --menu \"\$prompt\" $size \
+ $TTY_MENU_LIST \
+ 2> "$DIALOG_TMPDIR/dialog.menu.$$"
+}
+
+# ttys_set_type $consterm
+#
+# Set terminal type of `ttyv*' and `cons[0-9]' entries in ttys(5) to $consterm.
+#
+ttys_set_type()
+{
+ local consterm="$1"
+
+ #
+ # Create new temporary file to write our ttys(5) update with new types.
+ #
+ local tmpfile="$( mktemp -t "pgm" )"
+ [ "$tmpfile" ] || return $FAILURE
+
+ #
+ # Fixup permissions and ownership (mktemp(1) creates the temporary file
+ # with 0600 permissions -- change the permissions and ownership to
+ # match ttys(5) before we write it out and mv(1) it into place).
+ #
+ local mode="$( stat -f '%#Lp' "$ETC_TTYS" 2> /dev/null )"
+ local owner="$( stat -f '%u:%g' "$ETC_TTYS" 2> /dev/null )"
+ f_quietly chmod "${mode:-0644}" "$tmpfile"
+ f_quietly chown "${owner:-root:wheel}" "$tmpfile"
+
+ #
+ # Operate on ttys(5), replacing only the types of `ttyv*' and
+ # `cons[0-9]' terminals with the new type.
+ #
+ awk -v consterm="$consterm" '
+ BEGIN {
+ }
+ {
+ # "Skip" blank-lines, lines containing only whitespace, and
+ # lines containing only a comment or whitespace-then-comment.
+ #
+ if ( $0 ~ /^[[:space:]]*(#|$)/ ) { print; next }
+
+ # "Skip" terminal types other than those supported
+ #
+ if ( $1 !~ /^(ttyv.*|cons[0-9])$/ ) { print; next }
+
+ # Change the terminal type to the new value
+ #
+ match($0, /[[:alnum:]\.\+-_]+[[:space:]]+(on|off).*$/)
+ if ( ! RSTART ) { print; next }
+ left = substr($0, 0, RSTART - 1)
+ match($0, /[[:space:]]+(on|off).*$/)
+ right = substr($0, RSTART)
+ printf "%s%s%s\n", left, consterm, right
+ }
+ ' "$ETC_TTYS" > "$tmpfile" || return $FAILURE
+ f_quietly mv "$tmpfile" "$ETC_TTYS" || return $FAILURE
+
+ return $SUCCESS
+}
+
+############################################################ 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_terminal_type"
+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
+ [ "$mtag" = "1 $msg_none" ] && break
+
+ consterm=$( eval f_dialog_menutag2item \"\$mtag\" $TTY_MENU_LIST )
+ err=$( ttys_set_type "$consterm" 2>&1 )
+ [ "$err" ] || break
+
+ f_show_msg "%s" "$err"
+done
+
+exit $SUCCESS
+
+################################################################################
+# END
+################################################################################
OpenPOWER on IntegriCloud