MFC r258355,258360,258400-258401,258406-258407,258418,258430,258439,258589-

258590,258592,258727-258728,258785, with the following descriptions:

Revisions 258400-258401,258406-258407,258590,258727-258728,258785:
+ Add a new `includes' module (see: bsdconfig includes -h) for exploring
  the bsdconfig(8) API

Remaining revisions:
258592: Sort all the messages.subr files
258355: Fix typo in a comment in networking/device.subr
258360: Whitespace, style, and other changes in networking/device.subr
258418: Quote interface names for good measure in networking/device.subr
258430: Remove an unused line in networking/device.subr
258439: Minor bugfix to f_die() function in common.subr
258589: Minor bugfix to syscons_ttys module
This commit is contained in:
dteske 2014-01-15 07:36:34 +00:00
parent 0920d1cd65
commit a623494f5e
18 changed files with 452 additions and 71 deletions

View File

@ -6,6 +6,7 @@ SUBDIR= console \
dot \
examples \
include \
includes \
mouse \
networking \
packages \

View File

@ -51,8 +51,8 @@ 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_alternate_screenmap="Choose an alternate screenmap"
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."
@ -74,9 +74,9 @@ 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_estonian_iso_desc="Estonian ISO keymap"
msg_exit="Exit"
msg_exit_this_menu="Exit this menu"
msg_fade="Fade"
@ -97,8 +97,6 @@ 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"
@ -109,10 +107,14 @@ 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_green="Green"
msg_green_desc="\"Green\" power saving mode (if supported by monitor)"
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_1251="IBM 1251"
msg_ibm_1251_desc="Cyrillic, MS Windows encoding"
msg_ibm_437="IBM 437"
msg_ibm_437_desc="English and others, VGA default"
msg_ibm_437_vga_default="IBM437 (VGA default)"
@ -124,12 +126,12 @@ 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_15="ISO 8859-15"
msg_iso_8859_15_desc="Europe, ISO encoding"
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"
@ -144,8 +146,6 @@ 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"
@ -153,9 +153,9 @@ 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="KOI8-U"
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"
@ -224,8 +224,8 @@ 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_keymap="System Console Keymap"
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"

View File

@ -113,7 +113,7 @@ ttys_set_type()
#
# Create new temporary file to write our ttys(5) update with new types.
#
local tmpfile="$( mktemp -t "pgm" )"
local tmpfile="$( mktemp -t "$pgm" )"
[ "$tmpfile" ] || return $FAILURE
#

View File

@ -163,7 +163,7 @@ while getopts cdhi flag; do
done
shift $(( $OPTIND - 1 ))
cd $BSDCFG_LIBE || f_die 1 "$msg_directory_not_found" "$BSDCFG_LIB"
cd $BSDCFG_LIBE || f_die # Pedantic
#
# Get a list of menu programs

View File

@ -170,8 +170,8 @@ msg_install_from_an_http_server="Install from an HTTP server"
msg_install_from_the_existing_filesystem="Install from the existing filesystem"
msg_install_over_nfs="Install over NFS"
msg_installed="Installed"
msg_installed_lc="installed"
msg_installed_desc="Leave package as-is, installed"
msg_installed_lc="installed"
msg_invalid_gateway_ipv4_address_specified="Invalid gateway IPv4 address specified"
msg_invalid_hostname_value="Invalid hostname value"
msg_invalid_ipv4_address="Invalid IPv4 address"
@ -261,7 +261,6 @@ msg_ok="OK"
msg_options="Options"
msg_options_editor="Options Editor"
msg_other="other"
msg_pkg_delete_failed="Warning: pkg-delete(8) of %s failed.\n Run with debugging for details."
msg_package_is_needed_by_other_installed_packages="Warning: Package %s is needed by\n %d other installed package%s."
msg_package_not_installed_cannot_delete="Warning: package %s not installed\n No package can be deleted."
msg_package_temp="Package Temp"
@ -273,6 +272,7 @@ msg_parallel_desc="Applications dealing with parallelism in computing."
msg_pear_desc="Software related to the Pear PHP framework."
msg_perl5_desc="Utilities/modules for the PERL5 language."
msg_permission_denied="%s: %s: Permission denied"
msg_pkg_delete_failed="Warning: pkg-delete(8) of %s failed.\n Run with debugging for details."
msg_pkg_install_apparently_did_not_like_the_package="pkg-install(8) apparently did not like the %s package."
msg_plan9_desc="Software from the Plan9 operating system."
msg_please_check_the_url_and_try_again="No such directory: %s\nplease check the URL and try again.\n"
@ -375,9 +375,9 @@ msg_unable_to_get_file_from_selected_media="Unable to get %s file from selected
msg_unable_to_get_proper_ftp_path="Unable to get proper FTP path. FTP media not initialized."
msg_unable_to_initialize_media_type_for_package_extract="Unable to initialize media type for package extract."
msg_unable_to_make_directory_mountpoint="Unable to make %s directory mountpoint for %s!"
msg_unable_to_pkg_rquery_package_dependencies="Unable to pkg-rquery(8) package dependencies!"
msg_unable_to_pkg_rquery_package_categories="Unable to pkg-rquery(8) package categories!"
msg_unable_to_open="Unable to open %s"
msg_unable_to_pkg_rquery_package_categories="Unable to pkg-rquery(8) package categories!"
msg_unable_to_pkg_rquery_package_dependencies="Unable to pkg-rquery(8) package dependencies!"
msg_unable_to_update_pkg_from_selected_media="Unable to update pkg(8) from selected media."
msg_uninstall="Uninstall"
msg_uninstall_desc="Mark this package for deletion"

View File

@ -0,0 +1,56 @@
# Copyright (c) 2013 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 in the bsdconfig menu.
#
menu_title=""
#
# 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=""
#
# 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="includes|includes"
#
# ------------ 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=""

View File

@ -0,0 +1,16 @@
# $FreeBSD$
NO_OBJ=
SUBDIR= include
FILESDIR= ${LIBEXECDIR}/bsdconfig/includes
FILES= INDEX USAGE
SCRIPTSDIR= ${FILESDIR}
SCRIPTS= includes
beforeinstall:
mkdir -p ${DESTDIR}${FILESDIR}
.include <bsd.prog.mk>

View File

@ -0,0 +1,71 @@
# Copyright (c) 2013 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$
Usage: bsdconfig @PROGRAM_NAME@ [OPTIONS] [include ...]
OPTIONS:
-a Always use color even when output is not to a terminal.
-d Print description for each function selected. Implies `-f'.
-f Show functions for selected includes.
-F pattern
If `-f', only print functions matching pattern. Without `-f'
print only includes containing functions matching pattern.
-h Print this usage statement and exit.
-n Disable the use of color.
EXAMPLES:
View a list of available includes:
bsdconfig @PROGRAM_NAME@
View functions for all available includes (function names are
highlighted):
bsdconfig @PROGRAM_NAME@ -f
View functions with less(1) (function names are not highlighted):
bsdconfig @PROGRAM_NAME@ -f | less
View functions with less(1) and color:
bsdconfig @PROGRAM_NAME@ -af | less -R
View functions from `common.subr':
bsdconfig @PROGRAM_NAME@ common.subr
NB: The `-f' flag is implied when given an include.
Show only functions containing the word `show' in common.subr:
bsdconfig @PROGRAM_NAME@ -F show common
NB: The `.subr' suffix on the end of the include is optional.
Show descriptions of each of the `show' functions:
bsdconfig @PROGRAM_NAME@ -dF show

View File

@ -0,0 +1,11 @@
# $FreeBSD$
NO_OBJ=
FILESDIR= ${LIBEXECDIR}/bsdconfig/includes/include
FILES= messages.subr
beforeinstall:
mkdir -p ${DESTDIR}${FILESDIR}
.include <bsd.prog.mk>

View File

@ -0,0 +1,28 @@
# Copyright (c) 2013 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$
msg_functions_in="Functions in %s:"
msg_functions_in_matching="Functions in %s matching \`%s':"

View File

@ -0,0 +1,203 @@
#!/bin/sh
#-
# Copyright (c) 2013 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
# Prevent common.subr from auto initializing debugging (this is not an inter-
# active utility that requires debugging; also `-d' has been repurposed).
#
DEBUG_SELF_INITIALIZE=NO
BSDCFG_SHARE="/usr/share/bsdconfig"
. $BSDCFG_SHARE/common.subr || exit 1
f_dprintf "%s: loading includes..." "$0"
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="includes"
f_include_lang $BSDCFG_LIBE/include/messages.subr
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ GLOBALS
#
# Options
#
USE_COLOR=1
SHOW_DESC=
SHOW_FUNCS=
FUNC_PATTERN=
############################################################ FUNCTIONS
# show_functions $file
#
# Show the functions in the given include file.
#
show_include()
{
local file="${1#./}"
local pattern="${FUNC_PATTERN:-.*}"
output=$( awk \
-v use_color=${USE_COLOR:-0} \
-v re="$pattern" \
-v show_desc=${SHOW_DESC:-0} '
function asorti(src, dest)
{
# Copy src indices to dest and calculate array length
nitems = 0; for (i in src) dest[++nitems] = i
# Sort the array of indices (dest) using insertion sort method
for (i = 1; i <= nitems; k = i++)
{
idx = dest[i]
while ((k > 0) && (dest[k] > idx))
{
dest[k+1] = dest[k]
k--
}
dest[k+1] = idx
}
return nitems
}
/^$/,/^#/ {
if ($0 ~ /^# f_/) {
if (!match($2, re)) next
fn = $2
if (use_color)
syntax[fn] = sprintf("+%s%s%s\n",
substr($0, 2, RSTART),
substr($0, 2 + RSTART, RLENGTH),
substr($0, 2 + RSTART + RLENGTH))
else
syntax[fn] = "+" substr($0, 2) "\n"
if (show_desc)
print_more = 1
else
print_more = substr($0, length($0)) == "\\"
}
if (show_desc && print_more) {
getline
while ($0 ~ /^#/) {
syntax[fn] = syntax[fn] " " substr($0, 2) "\n"
getline
}
print_more = 0
} else while (print_more) {
getline
syntax[fn] = syntax[fn] " " substr($0, 2) "\n"
print_more = substr($0, length($0)) == "\\"
}
}
END {
n = asorti(syntax, sorted_indices)
for (i = 1; i <= n; i++)
printf "%s", syntax[sorted_indices[i]]
}' "$file" )
if [ "$output" ]; then
if [ ! "$SHOW_FUNCS" ]; then
echo "$file"
return $SUCCESS
fi
if [ "$FUNC_PATTERN" ]; then
printf ">>> $msg_functions_in_matching\n" \
"$file" "$FUNC_PATTERN"
else
printf ">>> $msg_functions_in\n" "$file"
fi
echo "$output"
echo # blank line to simplify awk(1)-based reparse
fi
}
############################################################ MAIN
# Incorporate rc-file if it exists
[ -f "$HOME/.bsdconfigrc" ] && f_include "$HOME/.bsdconfigrc"
# Are we in a terminal?
[ -t 1 ] || USE_COLOR=
#
# Process command-line arguments
#
while getopts adfF:hn flag; do
case "$flag" in
a) USE_COLOR=1 ;;
d) SHOW_DESC=1 SHOW_FUNCS=1 ;;
f) SHOW_FUNCS=1 ;;
F) FUNC_PATTERN="$OPTARG" ;;
n) USE_COLOR= ;;
h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm" ;;
esac
done
shift $(( $OPTIND - 1 ))
# cd(1) to `share' dir so relative paths work for find and positional args
cd $BSDCFG_SHARE || f_die # Pedantic
#
# If given an argument, operate on it specifically (implied `-f') and exit
#
[ $# -gt 0 ] && SHOW_FUNCS=1
for include in "$@"; do
# See if they've just omitted the `*.subr' suffix
[ -f "$include.subr" -a ! -f "$include" ] && include="$include.subr"
if [ ! -f "$include" ]; then
printf "$msg_no_such_file_or_directory\n" "$0" "$include"
exit $FAILURE
elif [ ! -r "$include" ]; then
printf "$msg_permission_denied\n" "$0" "$include"
exit $FAILURE
fi
show_include "$include" || f_die
done
# Exit if we processed some include arguments
[ $# -gt 0 ] && exit $SUCCESS
#
# Operate an all known include files
# NB: If we get this far, we had no include arguments
#
find -s . -type f -and -iname '*.subr' | while read file; do
if [ "$SHOW_FUNCS" -o "$FUNC_PATTERN" ]; then
show_include "$file"
else
echo "${file#./}"
fi
done
exit $SUCCESS
################################################################################
# END
################################################################################

View File

@ -58,14 +58,14 @@ msg_microsoft="Microsoft"
msg_microsoft_desc="Microsoft protocol (serial)"
msg_mm_series="MM Series"
msg_mm_series_desc="MM Series protocol (serial)"
msg_mouseman="MouseMan"
msg_mouseman_desc="Logitech MouseMan/TrackMan models (serial)"
msg_mousesystems="MouseSystems"
msg_mousesystems_desc="MouseSystems protocol (serial)"
msg_mouse_daemon_is_disabled="The mouse daemon is disabled."
msg_mouse_disable="Mouse Disable"
msg_mouse_enable="Mouse Enable"
msg_mouse_flags="Mouse Flags"
msg_mouseman="MouseMan"
msg_mouseman_desc="Logitech MouseMan/TrackMan models (serial)"
msg_mousesystems="MouseSystems"
msg_mousesystems_desc="MouseSystems protocol (serial)"
msg_now_move_the_mouse="Now move the mouse and see if it works.\n(Note that buttons don't have any effect for now.)\n\n Is the mouse cursor moving?\n"
msg_ok="OK"
msg_please_configure_your_mouse="Please configure your mouse"

View File

@ -59,15 +59,15 @@ msg_ipv4_addr_octet_contains_invalid_chars="ERROR! One or more individual octets
msg_ipv4_addr_octet_exceeds_max_value="ERROR! One or more individual octets within the IPv4 address\n(separated by dots) exceeds the maximum of 255.\n\nInvalid IP Address: %s"
msg_ipv4_addr_octet_is_null="ERROR! One or more individual octets within the IPv4 address\n(separated by dots) are null and/or missing.\n\nInvalid IP Address: %s"
msg_ipv4_addr_octet_missing_or_extra="ERROR! The IPv4 address entered has either too few (less than\nfour) or too many (more than four) octets, separated by dots.\n\nInvalid IP Address: %s"
msg_ipv6_addr_segment_contains_invalid_chars="ERROR! One or more individual segments within the IP address\n(separated by colons) contains one or more invalid characters.\nSegments must contain only combinations of the characters 0-9,\nA-F, or a-f.\n\nInvalid IPv6 Address: %s"
msg_ipv6_addr_segment_contains_too_many_chars="ERROR! One or more individual segments within the IP address\n(separated by colons) exceeds the length of 4 hex-digits.\n\nInvalid IPv6 Address: %s"
msg_ipv6_addr_too_few_or_extra_segments="ERROR! The IP address entered has either too few (less than 3), too\nmany (more than 8), or not enough segments, separated by colons.\n\nInvalid IPv6 Address: %s"
msg_ipv6_addr_too_many_null_segments="ERROR! Too many/incorrect null segments. A single null\nsegment is allowed within the IP address (separated by\ncolons) but not allowed at the beginning or end (unless\na double-null segment; i.e., \"::*\" or \"*::\").\n\nInvalid IPv6 Address: %s"
msg_ipv4_mask_field_contains_invalid_chars="ERROR! One or more individual fields within the subnet mask\n(separated by dots) contains one or more invalid characters.\n\nInvalid Subnet Mask: %s"
msg_ipv4_mask_field_exceeds_max_value="ERROR! One or more individual fields within the subnet mask\n(separated by dots) exceeds the maximum of 255.\n\nInvalid Subnet Mask: %s"
msg_ipv4_mask_field_invalid_value="ERROR! One or more individual fields within the subnet mask\n(separated by dots) contains one or more invalid integers.\nFields must be one of 0/128/192/224/240/248/252/254/255.\n\nInvalid Subnet Mask: %s"
msg_ipv4_mask_field_is_null="ERROR! One or more individual fields within the subnet mask\n(separated by dots) are null and/or missing.\n\nInvalid Subnet Mask: %s"
msg_ipv4_mask_field_missing_or_extra="ERROR! The subnet mask entered has either too few or too many\nfields.\n\nInvalid Subnet Mask: %s"
msg_ipv6_addr_segment_contains_invalid_chars="ERROR! One or more individual segments within the IP address\n(separated by colons) contains one or more invalid characters.\nSegments must contain only combinations of the characters 0-9,\nA-F, or a-f.\n\nInvalid IPv6 Address: %s"
msg_ipv6_addr_segment_contains_too_many_chars="ERROR! One or more individual segments within the IP address\n(separated by colons) exceeds the length of 4 hex-digits.\n\nInvalid IPv6 Address: %s"
msg_ipv6_addr_too_few_or_extra_segments="ERROR! The IP address entered has either too few (less than 3), too\nmany (more than 8), or not enough segments, separated by colons.\n\nInvalid IPv6 Address: %s"
msg_ipv6_addr_too_many_null_segments="ERROR! Too many/incorrect null segments. A single null\nsegment is allowed within the IP address (separated by\ncolons) but not allowed at the beginning or end (unless\na double-null segment; i.e., \"::*\" or \"*::\").\n\nInvalid IPv6 Address: %s"
msg_netmask="netmask"
msg_network_configuration="%s Network Configuration:\nChoose Save/Exit when finished or Cancel."
msg_network_interfaces="Network Interfaces"

View File

@ -62,7 +62,8 @@ f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
#
f_dialog_menu_netdev()
{
local defaultitem="${1%\*}" # Tim trailing asterisk if present
local menu_list # Calculated below
local defaultitem="${1%\*}" # Trim trailing asterisk if present
#
# Display a message to let the user know we're working...
@ -73,20 +74,15 @@ f_dialog_menu_netdev()
#
# Get list of usable network interfaces
#
local d='[[:digit:]]+:'
local iflist="`echo "$(ifconfig -l):" | sed -E -e "
# Convert all spaces to colons
y/ /:/
# Prune unsavory interfaces
s/lo$d//g
s/ppp$d//g
s/sl$d//g
s/faith$d//g
# Convert all colons back into spaces
y/:/ /
"`"
local if iflist= # Calculated below
for if in $( ifconfig -l ); do
# Skip unsavory interfaces
case "$if" in
lo[0-9]*|ppp[0-9]*|sl[0-9]*|faith[0-9]*) continue ;;
esac
iflist="$iflist $if"
done
iflist="${iflist# }"
#
# Optionally kick interfaces in the head to get them to accurately
@ -110,20 +106,17 @@ f_dialog_menu_netdev()
# Mark any "active" interfaces with an asterisk (*)
# to the right of the device name.
#
interfaces=$(
menu_list=$(
for ifn in $iflist; do
active=$( ifconfig $ifn | awk \
'
( $1 == "status:" ) \
{
if ( $2 == "active" ) { print 1; exit }
}
' )
active=$( ifconfig $ifn 2> /dev/null | awk '
($1 == "status:") {
if ($2 == "active") { print 1; exit }
}' )
printf "'%s%s' '%s'\n" \
$ifn "${active:+*}" "$( f_device_desc $ifn )"
done
)
if [ ! "$interfaces" ]; then
if [ ! "$menu_list" ]; then
f_show_msg "$msg_no_network_interfaces"
return $DIALOG_CANCEL
fi
@ -132,8 +125,8 @@ f_dialog_menu_netdev()
# Maybe the default item was marked as active
#
if [ "$defaultitem" ]; then
ifconfig "$defaultitem" 2> /dev/null | awk \
'( $1 == "status:" && $2 != "active" ) { exit 0 }' ||
ifconfig "$defaultitem" 2> /dev/null |
awk '($1 == "status:" && $2 == "active"){exit 1}' ||
defaultitem="$defaultitem*"
fi
@ -149,7 +142,7 @@ f_dialog_menu_netdev()
\"\$DIALOG_BACKTITLE\" \
\"\$prompt\" \
\"\$hline\" \
$interfaces
$menu_list
local menu_choice
menu_choice=$( eval $DIALOG \
--title \"\$DIALOG_TITLE\" \
@ -160,7 +153,7 @@ f_dialog_menu_netdev()
--default-item \"\$defaultitem\" \
--menu \"\$prompt\" \
$height $width $rows \
$interfaces \
$menu_list \
2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD
)
local retval=$?
@ -284,22 +277,23 @@ f_dialog_menu_netdev_edit()
msg=$( printf "$msg_scanning_for_dhcp" "$interface" )
if [ "$USE_XDIALOG" ]; then
(
f_quietly ifconfig $interface delete
f_quietly dhclient $interface
f_quietly ifconfig "$interface" delete
f_quietly dhclient "$interface"
) |
f_xdialog_info "$msg"
else
f_dialog_info "$msg"
f_quietly ifconfig $interface delete
f_quietly dhclient $interface
f_quietly ifconfig "$interface" delete
f_quietly dhclient "$interface"
fi
)
retval=$?
trap 'interrupt' SIGINT
if [ $retval -eq $DIALOG_OK ]; then
dhcp=1
ipaddr=$( f_ifconfig_inet $interface )
netmask=$( f_ifconfig_netmask $interface )
f_ifconfig_inet "$interface" ipaddr
f_ifconfig_inet6 "$interface" ipaddr6
f_ifconfig_netmask "$interface" netmask
options=
# Fixup search/domain in resolv.conf(5)

View File

@ -110,10 +110,11 @@ f_struct_define DHCP_LEASE \
# begin or end with a hyphen).
# 3 One or more individual labels within the hostname are null.
#
# f_dialog_validate_hostname $hostname
# To call this function and display an appropriate error message to the user
# based on the above error codes, use the following function defined in
# dialog.subr:
#
# If the hostname is determined to be invalid, the appropriate error will be
# displayed using the f_show_msg function.
# f_dialog_validate_hostname $hostname
#
f_validate_hostname()
{

View File

@ -179,7 +179,7 @@ f_debugging()
f_getvar $VAR_DEBUG value && [ "$value" ]
}
# f_interactive()
# f_interactive
#
# Are we running interactively? Return error if $nonInteractive is set and non-
# NULL, otherwise return success.
@ -190,7 +190,7 @@ f_interactive()
! f_getvar $VAR_NONINTERACTIVE value || [ ! "$value" ]
}
# f_netinteractive()
# f_netinteractive
#
# Has the user specifically requested the network-portion of configuration and
# setup to be performed interactively? Returns success if the user has asked
@ -205,7 +205,7 @@ f_netinteractive()
f_getvar $VAR_NETINTERACTIVE value && [ "$value" ]
}
# f_zfsinteractive()
# f_zfsinteractive
#
# Has the user specifically requested the ZFS-portion of configuration and
# setup to be performed interactively? Returns success if the user has asked

View File

@ -39,8 +39,8 @@ msg_all_desc="Select all directives"
msg_all_help="Select all displayed rc.conf(5) configuration directives"
msg_apm="APM"
msg_apm_desc="Auto-power management services (typically laptops)"
msg_are_you_sure_you_want_to_delete="Are you sure you want to delete the \`%s' directive\nfrom the rc.conf(5) collection of system configuration files?"
msg_are_you_sure_you_want_delete_the_following="Are you sure you want to delete the following directives\nfrom the rc.conf(5) collection of system configuration files?"
msg_are_you_sure_you_want_to_delete="Are you sure you want to delete the \`%s' directive\nfrom the rc.conf(5) collection of system configuration files?"
msg_cancel="Cancel"
msg_choose_view_details="Choose View Details"
msg_creating_menu_list="Creating menu list...\nThis may take a while."
@ -67,8 +67,8 @@ msg_exit_this_menu="Exit this menu"
msg_info="Info"
msg_lpd="lpd"
msg_lpd_desc="This host has a printer and wants to run lpd."
msg_miscellaneous_startup_services="Miscellaneous Startup Services"
msg_miscellaneous_menu_text="This menu allows you to configure various aspects of your system's\nstartup configuration. Use [SPACE] or [ENTER] to select items, and\n[TAB] to move to the buttons. Select Exit to leave this menu."
msg_miscellaneous_startup_services="Miscellaneous Startup Services"
msg_named="named"
msg_named_desc="Run a local name server on this host"
msg_named_flags="named flags"

View File

@ -32,9 +32,9 @@ hline_arrows_space_tab_enter="Use arrows, SPACE, TAB or ENTER"
hline_arrows_tab_enter="Press arrows, TAB or ENTER"
hline_num_arrows_tab_enter="Use numbers, arrows, TAB or ENTER"
hline_num_tab_enter="Use numbers, TAB or ENTER"
msg_account_does_not_expire="Account does not expire"
msg_account_expires_in_how_many_days="Account expires in how many days?"
msg_account_expires_on="Account Expires on"
msg_account_does_not_expire="Account does not expire"
msg_add="Add"
msg_add_group="Add Group"
msg_add_login="Add Login"
@ -65,9 +65,9 @@ msg_group="Group"
msg_group_added="Group Added"
msg_group_already_used="%s: Group is already used."
msg_group_deleted="Group Deleted"
msg_group_is_empty="Group is empty."
msg_group_id="Group ID"
msg_group_id_leave_empty_for_default="Group ID (Leave empty for default)"
msg_group_is_empty="Group is empty."
msg_group_members="Group Members"
msg_group_must_start_with_letter="Group must start with a letter."
msg_group_not_found="%s: Group not found."
@ -89,21 +89,21 @@ msg_login_not_found="Login not found."
msg_login_updated="Login Updated"
msg_member_of_groups="Member of Groups"
msg_n_a="N/A"
msg_number_of_seconds_since_epoch="Number of seconds since the Epoch\n(1 = %s)\nNULL or zero to disable:"
msg_no="No"
msg_number_of_seconds_since_epoch="Number of seconds since the Epoch\n(1 = %s)\nNULL or zero to disable:"
msg_ok="OK"
msg_password="Password"
msg_password_does_not_expire="Password does not expire"
msg_password_expires_in_how_many_days="Password expires in how many days?"
msg_password_expires_on="Password Expires on"
msg_passwords_do_not_match="Passwords do not match."
msg_password_does_not_expire="Password does not expire"
msg_reenter_group_password="Re-enter Group Password"
msg_reenter_password="Re-enter Password"
msg_save="Save"
msg_save_exit_or_cancel="Choose Save/Exit when finished or Cancel."
msg_separated_by_commas="Separated by commas"
msg_select_group_members_from_list="Select Group Members from a list"
msg_select_login_shell="Select Login Shell"
msg_separated_by_commas="Separated by commas"
msg_shell="Shell"
msg_unknown_user_management_menu_selection="Unknown user management menu selection"
msg_use_default_values_for_all_account_details="Use default values for all account details?"