bsddialog: vendor import 2021-12-05
This commit is contained in:
parent
857c66bb5f
commit
1b308d0631
25
.gitignore
vendored
Normal file
25
.gitignore
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
bsddialog
|
||||
*.o
|
||||
*~
|
||||
examples_library/buildlist
|
||||
examples_library/checklist
|
||||
examples_library/datebox
|
||||
examples_library/form
|
||||
examples_library/menu
|
||||
examples_library/mixedlist
|
||||
examples_library/radiolist
|
||||
examples_library/theme
|
||||
examples_library/treeview
|
||||
examples_library/infobox
|
||||
examples_library/msgbox
|
||||
examples_library/pause
|
||||
examples_library/rangebox
|
||||
examples_library/sade
|
||||
examples_library/timebox
|
||||
examples_library/yesno
|
||||
*.gz
|
||||
lib/libbsddialog.so*
|
||||
BSDDIALOG.geany
|
||||
BSDDIALOG.tags
|
||||
*.core
|
||||
bsdinstall/partedit/sade
|
99
README.md
99
README.md
@ -55,19 +55,43 @@ Examples utility:
|
||||
% ./bsddialog --backtitle "TITLE" --title yesno --hline "bsddialog" --yesno "Hello World!" 5 25
|
||||
% ./bsddialog --extra-button --help-button --defaultno --yesno "Hello World!" 0 0
|
||||
```
|
||||
and
|
||||
```
|
||||
% sh ./examples_utility/buildlist.sh
|
||||
% sh ./examples_utility/checklist.sh
|
||||
% sh ./examples_utility/form.sh
|
||||
% sh ./examples_utility/gauge.sh
|
||||
% sh ./examples_utility/infobox.sh
|
||||
% sh ./examples_utility/inputbox.sh
|
||||
% sh ./examples_utility/menu.sh
|
||||
% sh ./examples_utility/mixedform.sh
|
||||
% sh ./examples_utility/mixedgauge.sh
|
||||
% sh ./examples_utility/msgbox.sh
|
||||
% sh ./examples_utility/passwordbox.sh
|
||||
% sh ./examples_utility/passwordform.sh
|
||||
% sh ./examples_utility/radiolist.sh
|
||||
% sh ./examples_utility/treeview.sh
|
||||
% sh ./examples_utility/yesno.sh
|
||||
```
|
||||
|
||||
Examples library:
|
||||
```
|
||||
% cd library_examples
|
||||
% cd examples_library
|
||||
% sh compile
|
||||
% ./buildlist
|
||||
% ./compile
|
||||
% ./datebox
|
||||
% ./form
|
||||
% ./infobox
|
||||
% ./menu
|
||||
% ./mixedlist
|
||||
% ./msgbox
|
||||
% ./ports
|
||||
% ./pause
|
||||
% ./radiolist
|
||||
% ./rangebox
|
||||
% ./sade
|
||||
% ./theme
|
||||
% ./timebox
|
||||
% ./treeview
|
||||
% ./yesno
|
||||
```
|
||||
@ -87,74 +111,63 @@ Use Cases:
|
||||
--colors, --date-format *format*, --default-button *string*, --defaultno,
|
||||
--default-item *string*,
|
||||
--exit-label *string*, --extra-button, --extra-label *string*,
|
||||
--hfile *filename* (for completed widgets), n--help-button,
|
||||
--hfile *filename* (for completed widgets), --help, --help-button,
|
||||
--help-label *string*, --help-status, --help-tags, --hline *string*, --ignore,
|
||||
--item-help, --no-cancel, --nocancel, --no-label *string*, --no-items,
|
||||
--no-lines, --no-ok,
|
||||
--insecure, --item-help, --max-input *size*, --no-cancel, --nocancel,
|
||||
--no-label *string*, --no-items, --no-lines, --no-ok,
|
||||
--nook, --no-shadow, --no-tags, --ok-label *string*, --output-fd *fd*,
|
||||
--output-separator *string*, --print-version,
|
||||
--print-size (todo move lib -> utility), --quoted (quotes all != dialog),
|
||||
--print-maxsize, --shadow, --single-quoted (add --quote-with *ch*?),
|
||||
--separator *string* (alias --output-separator *string*),
|
||||
--separate-output (rename --separate-output-withnl?), --sleep *secs*, --stderr,
|
||||
--stdout, --theme *string* ("bsddialog", "dialog", "blackwhite" and "magenta"),
|
||||
--stdout, --theme *string* ("bsddialog", "dialog", "blackwhite"),
|
||||
--time-format *format*, --title *title*, --version, --yes-label *string*.
|
||||
|
||||
**Widgets:**
|
||||
|
||||
infobox (do not clear the screen), msgbox,
|
||||
yesno (dialog renames "yes/no" -> "ok/cancel" with --extra-button --help-button).
|
||||
checklist, radiolist, menu, mixedlist, treeview and textbox.
|
||||
checklist, radiolist, menu, mixedlist, treeview, textbox, mixedgauge, datebox,
|
||||
timebox, gauge, rangebox, pause.
|
||||
|
||||
|
||||
Without resize:
|
||||
|
||||
form, inputbox, mixedform, passwordbox, passwordform.
|
||||
|
||||
|
||||
Without autosize, resize, F1:
|
||||
|
||||
buildlist
|
||||
|
||||
|
||||
|
||||
## TODO
|
||||
|
||||
|
||||
**Common Options:**
|
||||
|
||||
| Option | Status | Note |
|
||||
| ---------------------------- | ----------- | ------------------------------- |
|
||||
| --cr-wrap | Coding | |
|
||||
| --help | In progress | |
|
||||
| --input-fd *fd* | | |
|
||||
| --insecure | | |
|
||||
| --keep-tite | | |
|
||||
| --keep-window | | |
|
||||
| --last-key | | |
|
||||
| --max-input *size* | | |
|
||||
| --no-collapse | Coding | |
|
||||
| --no-kill | | |
|
||||
| --no-nl-expand | Coding | |
|
||||
| --tab-correct | | |
|
||||
| --tab-len *n* | | |
|
||||
| --trim | Coding | |
|
||||
| --cr-wrap | In progress | text |
|
||||
| --no-collapse | In progress | text |
|
||||
| --no-nl-expand | In progress | text |
|
||||
| --trim | In progress | text |
|
||||
|
||||
|
||||
To evaluate / Not planned in the short term: --column-separator *string*,
|
||||
To evaluate / Not planned in the short term / not in bsdinstall:
|
||||
|
||||
--create-rc *file*, --iso-week, --no-mouse, --print-text-only *str h w*,
|
||||
--print-text-size *str h w*, --reorder, -scrollbar, --separate-widget *string*,
|
||||
--size-err, --timeout *secs*,--trace *filename*, --visit-items,
|
||||
--week-start *day*.
|
||||
--week-start *day*, --keep-tite, --keep-window, --last-key, --no-kill,
|
||||
--column-separator *string*, --input-fd *fd*, --tab-correct, --tab-len *n*
|
||||
|
||||
|
||||
**Widgets:**
|
||||
|
||||
| Widget | Status | Note |
|
||||
|--------------- | ----------- | ----------------------------------------------|
|
||||
| --buildlist | In progress | todo autosize, resize, F1 |
|
||||
| --calendar | In progress | todo autosize, resize, F1, leap year, year <=0, month days |
|
||||
| --editbox | | |
|
||||
| --form | In progress | implemented via --mixedform |
|
||||
| --gauge | In progress | |
|
||||
| --inputbox | In progress | implemented via --mixedform, todo \<init\> |
|
||||
| --mixedform | In progress | todo autosize, resize, F1 |
|
||||
| --mixedgauge | In progress | todo autosize, resize, F1 |
|
||||
| --passwordbox | In progress | implemented via --mixedform, todo \<init\> |
|
||||
| --passwordform | In progress | implemented via --mixedform |
|
||||
| --pause | In progress | todo autosize, resize, F1 |
|
||||
| --prgbox | In progress | add command opts |
|
||||
| --programbox | Coding | |
|
||||
| --progressbox | | |
|
||||
| --rangebox | In progress | todo autosize, resize, F1, PAGE-UP/PAGE-DOWN/HOME/END keys |
|
||||
| --timebox | In progress | todo autosize, resize, F1 |
|
||||
To evaluate / Not planned in the short term:
|
||||
|
||||
To evaluate / Not planned in the short term: tailbox (textbox/fseek), tailboxbg,
|
||||
dselect, fselect, inputmenu.
|
||||
tailbox (textbox/fseek), tailboxbg, dselect, fselect, inputmenu, editbox,
|
||||
calendar (use datebox), prgbox, programbox, progressbox.
|
||||
|
33
bsdconfig/Makefile
Normal file
33
bsdconfig/Makefile
Normal file
@ -0,0 +1,33 @@
|
||||
# $FreeBSD$
|
||||
|
||||
.include <src.opts.mk>
|
||||
|
||||
SUBDIR= console \
|
||||
diskmgmt \
|
||||
docsinstall \
|
||||
dot \
|
||||
include \
|
||||
includes \
|
||||
mouse \
|
||||
networking \
|
||||
packages \
|
||||
password \
|
||||
security \
|
||||
share \
|
||||
startup \
|
||||
timezone \
|
||||
ttys \
|
||||
usermgmt
|
||||
|
||||
.if ${MK_EXAMPLES} != "no"
|
||||
SUBDIR+= examples
|
||||
.endif
|
||||
|
||||
FILESDIR= ${LIBEXECDIR}/bsdconfig
|
||||
FILES= USAGE
|
||||
|
||||
SCRIPTS= bsdconfig
|
||||
|
||||
MAN= bsdconfig.8
|
||||
|
||||
.include <bsd.prog.mk>
|
11
bsdconfig/Makefile.depend
Normal file
11
bsdconfig/Makefile.depend
Normal file
@ -0,0 +1,11 @@
|
||||
# $FreeBSD$
|
||||
# Autogenerated - do NOT edit!
|
||||
|
||||
DIRDEPS = \
|
||||
|
||||
|
||||
.include <dirdeps.mk>
|
||||
|
||||
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
|
||||
# local dependencies - needed for -jN in clean tree
|
||||
.endif
|
47
bsdconfig/USAGE
Normal file
47
bsdconfig/USAGE
Normal file
@ -0,0 +1,47 @@
|
||||
# Copyright (c) 2012 Ron McDowell
|
||||
# Copyright (c) 2012-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:
|
||||
@PROGRAM_NAME@ [-h]
|
||||
@PROGRAM_NAME@ command [-h]
|
||||
@PROGRAM_NAME@ [OPTIONS] [command [OPTIONS]]
|
||||
|
||||
OPTIONS:
|
||||
-d Provide lots of debugging info on standard-out when running.
|
||||
-D file Send debugging info to file. If file begins with a plus-sign
|
||||
debug info is sent to both standard-out and file (minus the
|
||||
leading plus).
|
||||
-f file Load file as script and then exit. If multiple occurrences,
|
||||
program will only exit after last occurrence. If file is a
|
||||
single dash (`-'), @PROGRAM_NAME@ reads from standard input.
|
||||
-h Print this usage statement and exit.
|
||||
-S Secure X11 mode (implies `-X'). As root, always prompt-for
|
||||
and validate sudo(8) username/password before starting.
|
||||
-X Use Xdialog(1) in place of dialog(1).
|
||||
|
||||
COMMANDS:
|
||||
@COMMAND_LIST@
|
428
bsdconfig/bsdconfig
Executable file
428
bsdconfig/bsdconfig
Executable file
@ -0,0 +1,428 @@
|
||||
#!/bin/sh
|
||||
#-
|
||||
# Copyright (c) 2012 Ron McDowell
|
||||
# Copyright (c) 2012-2021 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
|
||||
|
||||
# When common.subr is included, it automatically scans "$@" for `-d' and/or
|
||||
# `-D file' arguments to conditionally enable debugging. Similarly, when
|
||||
# dialog.subr is included, it automatically scans "$@" for `-X' and/or `-S'.
|
||||
# To prevent this scanning from becoming confused by extra options, define
|
||||
# any/all extra arguments to use in the optstring to getopts when scanning
|
||||
# for dedicated options such as those described.
|
||||
#
|
||||
# NOTE: This needs to be declared before including `common.subr'.
|
||||
# NOTE: You really only need to list flags that require an argument as unknown
|
||||
# flags are silently accepted unless they take an argument (in which case
|
||||
# the following argument will terminate option processing unless it looks
|
||||
# like a flag).
|
||||
#
|
||||
GETOPTS_EXTRA="f:"
|
||||
|
||||
BSDCFG_SHARE="/usr/share/bsdconfig"
|
||||
. $BSDCFG_SHARE/common.subr || exit 1
|
||||
f_dprintf "%s: loading includes..." "$0"
|
||||
f_include $BSDCFG_SHARE/dialog.subr
|
||||
f_include $BSDCFG_SHARE/mustberoot.subr
|
||||
f_include $BSDCFG_SHARE/strings.subr
|
||||
|
||||
BSDCFG_LIBE="/usr/libexec/bsdconfig"
|
||||
f_include_lang $BSDCFG_LIBE/include/messages.subr
|
||||
|
||||
BSDCONFIG_HELPFILE=$BSDCFG_LIBE/include/bsdconfig.hlp
|
||||
USAGE_HELPFILE=$BSDCFG_LIBE/include/usage.hlp
|
||||
|
||||
############################################################ CONFIGURATION
|
||||
|
||||
#
|
||||
# Alternate `local' libexec directory for add-on modules (e.g., from ports)
|
||||
#
|
||||
BSDCFG_LOCAL_LIBE="/usr/local/libexec/bsdconfig"
|
||||
|
||||
############################################################ FUNCTIONS
|
||||
|
||||
# usage
|
||||
#
|
||||
# display usage and exit
|
||||
#
|
||||
usage()
|
||||
{
|
||||
local index="INDEX"
|
||||
local cmd_list # Calculated below
|
||||
|
||||
cd $BSDCFG_LIBE
|
||||
# No need to preserve CWD (headed toward exit)
|
||||
|
||||
# Test for language-specific indices
|
||||
f_quietly ls */"$index.${LANG:-$LC_ALL}" &&
|
||||
index="$index.${LANG:-$LC_ALL}"
|
||||
|
||||
cmd_list=$(
|
||||
awk '/^menu_selection="/ {
|
||||
sub(/\|.*/, "")
|
||||
sub(/^menu_selection="/, "")
|
||||
print
|
||||
}' */$index | sort
|
||||
)
|
||||
|
||||
local alt_cmd_list # Calculated below (if $BSDCFG_LOCAL_LIBE exists)
|
||||
if f_quietly cd $BSDCFG_LOCAL_LIBE; then
|
||||
# No need to preserve CWD (headed toward exit)
|
||||
|
||||
# Test for language-specific indices
|
||||
f_quietly ls */"$index.${LANG:-$LC_ALL}" &&
|
||||
index="$index.${LANG:-$LC_ALL}"
|
||||
|
||||
alt_cmd_list=$(
|
||||
awk '/^menu_selection="/ {
|
||||
sub(/\|.*/, "")
|
||||
sub(/^menu_selection="/, "")
|
||||
print
|
||||
}' */$index 2> /dev/null | sort
|
||||
)
|
||||
|
||||
# Conflate lists, removing duplicates
|
||||
cmd_list=$( printf "%s\n%s\n" \
|
||||
"$cmd_list" "$alt_cmd_list" | sort -u )
|
||||
fi
|
||||
|
||||
#
|
||||
# Determine the longest command-length (in characters)
|
||||
#
|
||||
local longest_cmd
|
||||
longest_cmd=$( echo "$cmd_list" | f_longest_line_length )
|
||||
f_dprintf "longest_cmd=[%s]" "$longest_cmd"
|
||||
|
||||
#
|
||||
# Determine the maximum width of terminal/console
|
||||
#
|
||||
local max_size="$( stty size 2> /dev/null )"
|
||||
: ${max_size:="24 80"}
|
||||
local max_width="${max_size#*[$IFS]}"
|
||||
f_dprintf "max_width=[%s]" "$max_width"
|
||||
|
||||
#
|
||||
# Using the longest command-length as the width of a single column,
|
||||
# determine if we can use more than one column to display commands.
|
||||
#
|
||||
local x=$longest_cmd ncols=1
|
||||
x=$(( $x + 8 )) # Accommodate leading tab character
|
||||
x=$(( $x + 3 + $longest_cmd )) # Pre-load end of next column
|
||||
while [ $x -lt $max_width ]; do
|
||||
ncols=$(( $ncols + 1 ))
|
||||
x=$(( $x + 3 + $longest_cmd ))
|
||||
done
|
||||
f_dprintf "ncols=[%u] x=[%u]" $ncols $x
|
||||
|
||||
#
|
||||
# Re-format the command-list into multiple columns
|
||||
#
|
||||
cmd_list=$( eval "$( echo "$cmd_list" |
|
||||
awk -v ncols=$ncols -v size=$longest_cmd '
|
||||
BEGIN {
|
||||
n = 0
|
||||
row_item[1] = ""
|
||||
}
|
||||
function print_row()
|
||||
{
|
||||
fmt = "printf \"\\t%-" size "s"
|
||||
for (i = 1; i < cur_col; i++)
|
||||
fmt = fmt " %-" size "s"
|
||||
fmt = fmt "\\n\""
|
||||
printf "%s", fmt
|
||||
for (i = 1; i <= cur_col; i++)
|
||||
printf " \"%s\"", row_item[i]
|
||||
print ""
|
||||
}
|
||||
{
|
||||
n++
|
||||
cur_col = (( n - 1 ) % ncols ) + 1
|
||||
printf "f_dprintf \"row_item[%u]=[%%s]\" \"%s\"\n",
|
||||
cur_col, $0
|
||||
row_item[cur_col] = $0
|
||||
if ( cur_col == ncols ) print_row()
|
||||
}
|
||||
END {
|
||||
if ( cur_col < ncols ) print_row()
|
||||
}' )"
|
||||
)
|
||||
|
||||
f_usage $BSDCFG_LIBE/USAGE \
|
||||
"PROGRAM_NAME" "$pgm" \
|
||||
"COMMAND_LIST" "$cmd_list"
|
||||
|
||||
# NOTREACHED
|
||||
}
|
||||
|
||||
# dialog_menu_main
|
||||
#
|
||||
# Display the dialog(1)-based application main menu.
|
||||
#
|
||||
dialog_menu_main()
|
||||
{
|
||||
local title="$DIALOG_TITLE"
|
||||
local btitle="$DIALOG_BACKTITLE"
|
||||
local prompt="$msg_menu_text"
|
||||
local menu_list="
|
||||
'X' '$msg_exit' '$msg_exit_bsdconfig'
|
||||
'1' '$msg_usage' '$msg_quick_start_how_to_use_this_menu_system'
|
||||
" # END-QUOTE
|
||||
local defaultitem= # Calculated below
|
||||
local hline=
|
||||
|
||||
#
|
||||
# Pick up the base modules (directories named `[0-9][0-9][0-9].*')
|
||||
#
|
||||
local menuitem menu_title menu_help menu_selection index=2
|
||||
for menuitem in $( cd $BSDCFG_LIBE && ls -d [0-9][0-9][0-9].* ); do
|
||||
[ -f "$BSDCFG_LIBE/$menuitem/INDEX" ] || continue
|
||||
[ $index -lt ${#DIALOG_MENU_TAGS} ] || break
|
||||
|
||||
menu_program= menu_title= menu_help=
|
||||
f_include_lang $BSDCFG_LIBE/$menuitem/INDEX
|
||||
[ "$menu_program" ] || continue
|
||||
|
||||
case "$menu_program" in
|
||||
/*) : already fully qualified ;;
|
||||
*) menu_program="$menuitem/$menu_program"
|
||||
esac
|
||||
|
||||
f_substr -v tag "$DIALOG_MENU_TAGS" $index 1
|
||||
setvar "menu_program$tag" "$menu_program"
|
||||
|
||||
f_shell_escape "$menu_title" menu_title
|
||||
f_shell_escape "$menu_help" menu_help
|
||||
menu_list="$menu_list '$tag' '$menu_title' '$menu_help'"
|
||||
|
||||
index=$(( $index + 1 ))
|
||||
done
|
||||
|
||||
#
|
||||
# Process the `local' libexec sources.
|
||||
#
|
||||
# Whereas modules in $BSDCFG_LIBE must be named [0-9][0-9][0-9].*
|
||||
# modules in $BSDCFG_LOCAL_LIBE should NOT be named this way (making it
|
||||
# more practical for port-maintainers).
|
||||
#
|
||||
# This also has the fortunate side-effect of making the de-duplication
|
||||
# effort rather simple (because so-called `base' modules must be named
|
||||
# differently than add-on modules).
|
||||
#
|
||||
local separator_added=
|
||||
for menuitem in $( cd "$BSDCFG_LOCAL_LIBE" 2> /dev/null && ls -d * )
|
||||
do
|
||||
# Skip the module if it looks like a `base' module
|
||||
case "$menuitem" in [0-9][0-9][0-9].*) continue;; esac
|
||||
|
||||
[ -f "$BSDCFG_LOCAL_LIBE/$menuitem/INDEX" ] || continue
|
||||
[ $index -lt ${#DIALOG_MENU_TAGS} ] || break
|
||||
|
||||
menu_program= menu_title= menu_help=
|
||||
f_include_lang $BSDCFG_LOCAL_LIBE/$menuitem/INDEX || continue
|
||||
[ "$menu_program" ] || continue
|
||||
|
||||
if [ ! "$separator_added" ]; then
|
||||
menu_list="$menu_list '-' '-' ''"
|
||||
separator_added=1
|
||||
fi
|
||||
|
||||
case "$menu_program" in
|
||||
/*) : already fully qualified ;;
|
||||
*) menu_program="$BSDCFG_LOCAL_LIBE/$menuitem/$menu_program"
|
||||
esac
|
||||
|
||||
f_substr -v tag "$DIALOG_MENU_TAGS" $index 1
|
||||
setvar "menu_program$tag" "$menu_program"
|
||||
|
||||
f_shell_escape "$menu_title" menu_title
|
||||
f_shell_escape "$menu_help" menu_help
|
||||
menu_list="$menu_list '$tag' '$menu_title' '$menu_help'"
|
||||
|
||||
index=$(( $index + 1 ))
|
||||
done
|
||||
|
||||
local height width rows
|
||||
eval f_dialog_menu_with_help_size height width rows \
|
||||
\"\$title\" \
|
||||
\"\$btitle\" \
|
||||
\"\$prompt\" \
|
||||
\"\$hline\" \
|
||||
$menu_list
|
||||
|
||||
# Obtain default-item from previously stored selection
|
||||
f_dialog_default_fetch defaultitem
|
||||
|
||||
local menu_choice
|
||||
menu_choice=$( eval $DIALOG \
|
||||
--clear \
|
||||
--title \"\$title\" \
|
||||
--backtitle \"\$btitle\" \
|
||||
--hline \"\$hline\" \
|
||||
--item-help \
|
||||
--ok-label \"\$msg_ok\" \
|
||||
--cancel-label \"\$msg_exit_bsdconfig\" \
|
||||
--help-button \
|
||||
--help-label \"\$msg_help\" \
|
||||
${USE_XDIALOG:+--help \"\"} \
|
||||
--default-item \"\$defaultitem\" \
|
||||
--menu \"\$prompt\" \
|
||||
$height $width $rows \
|
||||
$menu_list \
|
||||
2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD
|
||||
)
|
||||
local retval=$?
|
||||
f_dialog_data_sanitize menu_choice
|
||||
f_dialog_menutag_store "$menu_choice"
|
||||
|
||||
# Only update default-item on success
|
||||
[ $retval -eq $DIALOG_OK ] && f_dialog_default_store "$menu_choice"
|
||||
|
||||
return $retval
|
||||
}
|
||||
|
||||
############################################################ MAIN
|
||||
|
||||
#
|
||||
# If $0 is not "bsdconfig", interpret it either as a keyword to a menuitem or
|
||||
# as a valid resword (see script.subr for additional details about reswords).
|
||||
#
|
||||
if [ "$pgm" != "bsdconfig" ]; then
|
||||
if indexfile=$( f_index_file "$pgm" ) &&
|
||||
cmd=$( f_index_menusel_command "$indexfile" "$pgm" )
|
||||
then
|
||||
f_dprintf "pgm=[%s] cmd=[%s] *=[%s]" "$pgm" "$cmd" "$*"
|
||||
exec "$cmd" "$@" || exit 1
|
||||
else
|
||||
f_include $BSDCFG_SHARE/script.subr
|
||||
for resword in $RESWORDS; do
|
||||
[ "$pgm" = "$resword" ] || continue
|
||||
# Found a match
|
||||
f_dprintf "pgm=[%s] A valid resWord!" "$pgm"
|
||||
f_dispatch $resword $resword "$@"
|
||||
exit $?
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
||||
#
|
||||
# Process command-line arguments
|
||||
#
|
||||
scripts_loaded=0
|
||||
while getopts f:h$GETOPTS_STDARGS flag; do
|
||||
case "$flag" in
|
||||
f) [ $scripts_loaded -eq 0 ] && f_include $BSDCFG_SHARE/script.subr
|
||||
f_script_load "$OPTARG"
|
||||
scripts_loaded=$(( $scripts_loaded + 1 )) ;;
|
||||
h|\?) usage ;;
|
||||
esac
|
||||
done
|
||||
shift $(( $OPTIND - 1 ))
|
||||
|
||||
# If we've loaded any scripts, do not continue any further
|
||||
[ $scripts_loaded -gt 0 ] && exit
|
||||
|
||||
#
|
||||
# Initialize
|
||||
#
|
||||
f_dialog_title "$msg_main_menu"
|
||||
|
||||
[ "$SECURE" ] && f_mustberoot_init
|
||||
|
||||
# Incorporate rc-file if it exists
|
||||
[ -f "$HOME/.bsdconfigrc" ] && f_include "$HOME/.bsdconfigrc"
|
||||
|
||||
#
|
||||
# If a non-option argument was passed, process it as a menuitem selection...
|
||||
#
|
||||
if [ "$1" ]; then
|
||||
#
|
||||
# ...unless it's a long-option for usage.
|
||||
#
|
||||
case "$1" in -help|--help|-\?)
|
||||
usage
|
||||
# NOTREACHED
|
||||
esac
|
||||
|
||||
#
|
||||
# Find the INDEX (possibly i18n) claiming this keyword and get the
|
||||
# command to execute from the menu_selection line.
|
||||
#
|
||||
if ! { indexfile=$( f_index_file "$1" ) &&
|
||||
cmd=$( f_index_menusel_command "$indexfile" "$1" )
|
||||
}; then
|
||||
# No matches, display usage (which shows valid keywords)
|
||||
f_err "%s: %s: $msg_not_found\n" "$pgm" "$1"
|
||||
usage
|
||||
# NOTREACHED
|
||||
fi
|
||||
|
||||
f_dprintf "cmd=[%s] *=[%s]" "$cmd" "$*"
|
||||
shift
|
||||
exec $cmd ${USE_XDIALOG:+-X} "$@" || exit 1
|
||||
# NOTREACHED
|
||||
fi
|
||||
|
||||
#
|
||||
# Launch application main menu
|
||||
#
|
||||
while :; do
|
||||
dialog_menu_main
|
||||
retval=$?
|
||||
f_dialog_menutag_fetch mtag
|
||||
f_dprintf "retval=%u mtag=[%s]" $retval "$mtag"
|
||||
|
||||
if [ $retval -eq $DIALOG_HELP ]; then
|
||||
f_show_help "$BSDCONFIG_HELPFILE"
|
||||
continue
|
||||
elif [ $retval -ne $DIALOG_OK ]; then
|
||||
f_die
|
||||
fi
|
||||
|
||||
case "$mtag" in
|
||||
X) break ;;
|
||||
1) # Usage
|
||||
f_show_help "$USAGE_HELPFILE"
|
||||
continue
|
||||
esac
|
||||
|
||||
# Anything else is a dynamically loaded menuitem
|
||||
|
||||
f_getvar menu_program$mtag menu_program
|
||||
case "$menu_program" in
|
||||
/*) cmd="$menu_program" ;;
|
||||
*) cmd="$BSDCFG_LIBE/$menu_program"
|
||||
esac
|
||||
f_dprintf "cmd=[%s]" "$cmd"
|
||||
$cmd ${USE_XDIALOG:+-X}
|
||||
done
|
||||
|
||||
exit $SUCCESS
|
||||
|
||||
################################################################################
|
||||
# END
|
||||
################################################################################
|
256
bsdconfig/bsdconfig.8
Normal file
256
bsdconfig/bsdconfig.8
Normal file
@ -0,0 +1,256 @@
|
||||
.\" Copyright (c) 2012 Ron McDowell
|
||||
.\" Copyright (c) 2012-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 ``AS IS'' AND ANY EXPRESS OR
|
||||
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
.\" DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
||||
.\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
.\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
.\" POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd April 12, 2020
|
||||
.Dt BSDCONFIG 8
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm bsdconfig
|
||||
.Nd system configuration utility
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Fl h
|
||||
.Nm
|
||||
.Ar command
|
||||
.Op Fl h
|
||||
.Nm
|
||||
.Op OPTIONS
|
||||
.Op command Op OPTIONS
|
||||
.Sh DESCRIPTION
|
||||
.Nm
|
||||
is used to set up many system configuration settings, both for new systems, as
|
||||
well as changing configuration settings of existing systems.
|
||||
.Pp
|
||||
.Nm
|
||||
optionally takes a command as an argument.
|
||||
If invoked with no arguments, it will bring up an interactive menu listing the
|
||||
available modules.
|
||||
.Pp
|
||||
The following options are available:
|
||||
.Bl -tag -width indent+
|
||||
.It Fl d
|
||||
Provide lots of debugging info on standard-out when running.
|
||||
.It Fl D Ar file
|
||||
Send debugging info to file.
|
||||
If file begins with a plus-sign debug info is sent to both standard-out and
|
||||
file (minus the leading plus).
|
||||
.It Fl f Ar file
|
||||
Load
|
||||
.Ar file
|
||||
as script and then exit.
|
||||
If multiple occurrences, program will only exit after last occurrence.
|
||||
If
|
||||
.Ar file
|
||||
is a single dash
|
||||
.Pq Sq Fl ,
|
||||
.Nm
|
||||
reads from standard input.
|
||||
.It Fl h
|
||||
Print usage statement and exit.
|
||||
.It Fl S
|
||||
Secure X11 mode
|
||||
.Pq implies Fl X .
|
||||
As root, always prompt-for and validate
|
||||
.Xr sudo 8
|
||||
username/password before starting.
|
||||
.It Fl X
|
||||
Use
|
||||
.Xr Xdialog 1
|
||||
in place of
|
||||
.Xr dialog 1 .
|
||||
.El
|
||||
.Sh COMMANDS
|
||||
The following commands
|
||||
.Pq sorted alphabetically
|
||||
are currently included in the base
|
||||
.Nm
|
||||
program, with more to be added soon.
|
||||
Other commands can be added, as detailed below in the
|
||||
.Cm ADDING COMMANDS
|
||||
section, and once added, will appear in the master menu as well as in the
|
||||
.Cm -h
|
||||
listing.
|
||||
.Bl -tag -width ".Cm syscons_screenmap"
|
||||
.It Cm console
|
||||
Utilities to customize the behavior of the system console.
|
||||
.It Cm defaultrouter
|
||||
Shortcut to the Default Router/Gateway menu under networking.
|
||||
.It Cm diskmgmt
|
||||
Manage disk partitions and/or labels.
|
||||
Executes
|
||||
.Xr sade 8 .
|
||||
.It Cm docsinstall
|
||||
Executes the
|
||||
.Cm bsdinstall docsinstall
|
||||
sub-utility to allow installation/re-installation of the FreeBSD Documentation
|
||||
set(s).
|
||||
.It Cm dot
|
||||
Generate a graphviz
|
||||
.Xr dot 1
|
||||
language file
|
||||
.Pq printed on stdout
|
||||
visualizing the
|
||||
.Nm
|
||||
menu, include, and shortcut structure relationships.
|
||||
See
|
||||
.Dq bsdconfig dot -h
|
||||
for more details.
|
||||
.It Cm groupadd
|
||||
Shortcut to the Add Groups menu under groupmgmt.
|
||||
.It Cm groupdel
|
||||
Shortcut to the Delete Groups menu under groupmgmt.
|
||||
.It Cm groupedit
|
||||
Shortcut to the Edit/View Groups menu under groupmgmt.
|
||||
.It Cm groupmgmt
|
||||
Utilities to Add/Change/View/Delete Group Accounts.
|
||||
.It Cm hostname
|
||||
Shortcut to the Hostname/Domain menu under networking.
|
||||
.It Cm kern_securelevel
|
||||
Shortcut to the kern.securelevel menu under security.
|
||||
.It Cm mouse
|
||||
Utilities for configuring, exploring, and enabling console mouse support.
|
||||
.It Cm mouse_disable
|
||||
Shortcut to the Disable menu under mouse.
|
||||
.It Cm mouse_enable
|
||||
Shortcut to the Enable menu under mouse.
|
||||
.It Cm mouse_flags
|
||||
Shortcut to the Flags menu under mouse.
|
||||
.It Cm mouse_port
|
||||
Shortcut to the Port menu under mouse.
|
||||
.It Cm mouse_type
|
||||
Shortcut to the Type menu under mouse.
|
||||
.It Cm nameservers
|
||||
Shortcut to the DNS Nameservers menu under networking.
|
||||
.It Cm netdev
|
||||
Shortcut to the Network Interfaces menu under networking.
|
||||
.It Cm networking
|
||||
Utilities to set/change Hostname/Domain, Network Interfaces, Wireless
|
||||
Network, Default Router/Gateway, and DNS Nameservers.
|
||||
.It Cm packages
|
||||
Browse, install, uninstall, or re-install packaged software.
|
||||
.It Cm password
|
||||
Set the system administrator
|
||||
.Pq root
|
||||
password.
|
||||
.It Cm security
|
||||
Configure various system security settings.
|
||||
.It Cm startup
|
||||
Configure various aspects of system startup.
|
||||
.It Cm startup_misc
|
||||
Shortcut to the Miscellaneous Startup Services menu under startup.
|
||||
.It Cm startup_rcadd
|
||||
Shortcut to the Add New menu under the View/Edit Startup Configuration menu
|
||||
(startup_rcconf) of startup.
|
||||
.It Cm startup_rcconf
|
||||
Shortcut to the View/Edit Startup Configuration menu under startup.
|
||||
.It Cm startup_rcdelete
|
||||
Shortcut to the Delete menu under the View/Edit Startup Configuration menu
|
||||
(startup_rcconf) of startup.
|
||||
.It Cm startup_rcvar
|
||||
Shortcut to the Toggle Startup Services menu under startup.
|
||||
.\" use neutral name, e.g. console_keymap instead of syscons_keymap?
|
||||
.\" font (encoding) selection not applicable to vt(4)!
|
||||
.It Cm syscons_font
|
||||
Shortcut to the Font menu under console.
|
||||
.\" .It Cm console_keymap
|
||||
.\" Shortcut to the Keymap menu under console.
|
||||
.It Cm syscons_keymap
|
||||
Shortcut to the Keymap menu under console.
|
||||
.\" .It Cm vt_repeat
|
||||
.\" Shortcut to the Repeat menu under console.
|
||||
.It Cm syscons_repeat
|
||||
Shortcut to the Repeat menu under console.
|
||||
.\" .It Cm vt_saver
|
||||
.\" Shortcut to the Saver menu under console.
|
||||
.It Cm syscons_saver
|
||||
Shortcut to the Saver menu under console.
|
||||
.\" screenmap (encoding) selection not applicable to vt(4)!
|
||||
.It Cm syscons_screenmap
|
||||
Shortcut to the Screenmap menu under console.
|
||||
.\" .It Cm vt_syscons_ttys
|
||||
.\" Shortcut to the Ttys menu under console.
|
||||
.It Cm syscons_ttys
|
||||
Shortcut to the Ttys menu under console.
|
||||
.It Cm timezone
|
||||
Set the regional timezone of the local machine.
|
||||
.It Cm ttys
|
||||
Edit the
|
||||
.Xr ttys 5
|
||||
database with your favorite editor.
|
||||
.It Cm useradd
|
||||
Shortcut to the Add Users menu under usermgmt.
|
||||
.It Cm userdel
|
||||
Shortcut to the Delete Users menu under usermgmt.
|
||||
.It Cm useredit
|
||||
Shortcut to the Edit/View Users menu under usermgmt.
|
||||
.It Cm usermgmt
|
||||
Utilities to Add/Edit/View/Delete User Accounts.
|
||||
.It Cm wireless
|
||||
Shortcut to the Wireless Networks menu under networking.
|
||||
.El
|
||||
.Sh INTERNATIONALIZATION
|
||||
i18n features are built into
|
||||
.Nm
|
||||
and language-specific translation files will be added as they become available.
|
||||
In the absence of language-specific translation files, the default
|
||||
.Pq en_US.ISO8859-1
|
||||
files will be used.
|
||||
.Sh ADDING COMMANDS
|
||||
To be documented later.
|
||||
Document menu_selection="command|*" syntax of INDEX files.
|
||||
.Sh ENVIRONMENT VARIABLES
|
||||
The following environment variables affect the execution of
|
||||
.Nm :
|
||||
.Bl -tag -width ".Ev LC_ALL"
|
||||
.It Ev LANG
|
||||
If LANG is set, messages and index information will be read from files named
|
||||
messages.$LANG and INDEX.$LANG and fall back to files named messages and INDEX
|
||||
if messages.$LANG and INDEX.$LANG do not exist.
|
||||
LANG takes precedence over LC_ALL.
|
||||
.It Ev LC_ALL
|
||||
If LC_ALL is set, messages and index information will be read from files named
|
||||
messages.$LC_ALL and INDEX.$LC_ALL and fall back to files named messages and
|
||||
INDEX if messages.$LC_ALL and INDEX.$LC_ALL do not exist.
|
||||
.El
|
||||
.Sh FILES
|
||||
/usr/share/examples/bsdconfig/bsdconfigrc can be copied to $HOME/.bsdconfigrc
|
||||
and customized as needed.
|
||||
.Sh EXIT STATUS
|
||||
.Ex -std
|
||||
.Sh SEE ALSO
|
||||
.Xr bsdinstall 8
|
||||
.Sh HISTORY
|
||||
.Nm
|
||||
first appeared in
|
||||
.Fx 9.2 .
|
||||
.Sh AUTHORS
|
||||
.An Ron McDowell
|
||||
.An Devin Teske Aq Mt dteske@FreeBSD.org
|
||||
.Sh BUGS
|
||||
The docsinstall and diskmgmt modules call bsdinstall.
|
||||
Bugs found in these modules should be considered those of bsdinstall, not
|
||||
.Nm .
|
70
bsdconfig/console/INDEX
Normal file
70
bsdconfig/console/INDEX
Normal file
@ -0,0 +1,70 @@
|
||||
# Copyright (c) 2012 Ron McDowell
|
||||
# Copyright (c) 2012-2015 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="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="vt_font|font"
|
||||
menu_selection="vt_keymap|keymap"
|
||||
menu_selection="vt_repeat|repeat"
|
||||
menu_selection="vt_saver|saver"
|
||||
menu_selection="vt_screenmap|screenmap"
|
||||
menu_selection="vt_ttys|ttys"
|
||||
# For backward compatibility
|
||||
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"
|
11
bsdconfig/console/Makefile
Normal file
11
bsdconfig/console/Makefile
Normal file
@ -0,0 +1,11 @@
|
||||
# $FreeBSD$
|
||||
|
||||
SUBDIR= include
|
||||
|
||||
FILESDIR= ${LIBEXECDIR}/bsdconfig/080.console
|
||||
FILES= INDEX USAGE
|
||||
|
||||
SCRIPTSDIR= ${FILESDIR}
|
||||
SCRIPTS= console font keymap repeat saver screenmap ttys
|
||||
|
||||
.include <bsd.prog.mk>
|
11
bsdconfig/console/Makefile.depend
Normal file
11
bsdconfig/console/Makefile.depend
Normal file
@ -0,0 +1,11 @@
|
||||
# $FreeBSD$
|
||||
# Autogenerated - do NOT edit!
|
||||
|
||||
DIRDEPS = \
|
||||
|
||||
|
||||
.include <dirdeps.mk>
|
||||
|
||||
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
|
||||
# local dependencies - needed for -jN in clean tree
|
||||
.endif
|
37
bsdconfig/console/USAGE
Normal file
37
bsdconfig/console/USAGE
Normal file
@ -0,0 +1,37 @@
|
||||
# Copyright (c) 2012-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]
|
||||
|
||||
OPTIONS:
|
||||
-d Provide lots of debugging info on standard-out when running.
|
||||
-D file Send debugging info to file. If file begins with a plus-sign
|
||||
debug info is sent to both standard-out and file (minus the
|
||||
leading plus).
|
||||
-h Print this 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).
|
146
bsdconfig/console/console
Executable file
146
bsdconfig/console/console
Executable file
@ -0,0 +1,146 @@
|
||||
#!/bin/sh
|
||||
#-
|
||||
# Copyright (c) 2012-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
|
||||
|
||||
BSDCFG_SHARE="/usr/share/bsdconfig"
|
||||
. $BSDCFG_SHARE/common.subr || exit 1
|
||||
f_dprintf "%s: loading includes..." "$0"
|
||||
f_include $BSDCFG_SHARE/dialog.subr
|
||||
f_include $BSDCFG_SHARE/mustberoot.subr
|
||||
|
||||
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="080.console"
|
||||
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
|
||||
|
||||
f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" ipgm &&
|
||||
pgm="${ipgm:-$pgm}"
|
||||
|
||||
############################################################ FUNCTIONS
|
||||
|
||||
# dialog_menu_main
|
||||
#
|
||||
# Display the dialog(1)-based application main menu.
|
||||
#
|
||||
dialog_menu_main()
|
||||
{
|
||||
local prompt="$msg_console_menu_text"
|
||||
local 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
|
||||
local defaultitem= # Calculated below
|
||||
local hline="$hline_configure_system_console_settings"
|
||||
|
||||
local height width rows
|
||||
eval f_dialog_menu_size height width rows \
|
||||
\"\$DIALOG_TITLE\" \
|
||||
\"\$DIALOG_BACKTITLE\" \
|
||||
\"\$prompt\" \
|
||||
\"\$hline\" \
|
||||
$menu_list
|
||||
|
||||
# Obtain default-item from previously stored selection
|
||||
f_dialog_default_fetch defaultitem
|
||||
|
||||
local menu_choice
|
||||
menu_choice=$( eval $DIALOG \
|
||||
--title \"\$DIALOG_TITLE\" \
|
||||
--backtitle \"\$DIALOG_BACKTITLE\" \
|
||||
--hline \"\$hline\" \
|
||||
--ok-label \"\$msg_ok\" \
|
||||
--cancel-label \"\$msg_cancel\" \
|
||||
--default-item \"\$defaultitem\" \
|
||||
--menu \"\$prompt\" \
|
||||
$height $width $rows \
|
||||
$menu_list \
|
||||
2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD
|
||||
)
|
||||
local retval=$?
|
||||
f_dialog_data_sanitize menu_choice
|
||||
f_dialog_menutag_store "$menu_choice"
|
||||
f_dialog_default_store "$menu_choice"
|
||||
return $retval
|
||||
}
|
||||
|
||||
############################################################ MAIN
|
||||
|
||||
# Incorporate rc-file if it exists
|
||||
[ -f "$HOME/.bsdconfigrc" ] && f_include "$HOME/.bsdconfigrc"
|
||||
|
||||
#
|
||||
# Process command-line arguments
|
||||
#
|
||||
while getopts h$GETOPTS_STDARGS flag; do
|
||||
case "$flag" in
|
||||
h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm" ;;
|
||||
esac
|
||||
done
|
||||
shift $(( $OPTIND - 1 ))
|
||||
|
||||
#
|
||||
# Initialize
|
||||
#
|
||||
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 || f_die
|
||||
f_dialog_menutag_fetch mtag
|
||||
|
||||
command=
|
||||
case "$mtag" in
|
||||
"X $msg_exit") break ;;
|
||||
"2 $msg_font") command=font ;; # Choose alternate screen font
|
||||
"3 $msg_keymap") command=keymap ;; # Choose alt. keyboard map
|
||||
"4 $msg_repeat") command=repeat ;; # Set key repeat rate
|
||||
"5 $msg_saver") command=saver ;; # Configure the screen saver
|
||||
"6 $msg_screenmap") command=screenmap ;; # Choose alternate screenmap
|
||||
"7 $msg_ttys") command=ttys ;; # Choose console terminal type
|
||||
esac
|
||||
|
||||
if [ "$command" ]; then
|
||||
$BSDCFG_LIBE/$APP_DIR/$command ${USE_XDIALOG:+-X}
|
||||
else
|
||||
f_die 1 "$msg_unknown_console_menu_selection"
|
||||
fi
|
||||
done
|
||||
|
||||
exit $SUCCESS
|
||||
|
||||
################################################################################
|
||||
# END
|
||||
################################################################################
|
193
bsdconfig/console/font
Executable file
193
bsdconfig/console/font
Executable file
@ -0,0 +1,193 @@
|
||||
#!/bin/sh
|
||||
#-
|
||||
# Copyright (c) 2012-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
|
||||
|
||||
BSDCFG_SHARE="/usr/share/bsdconfig"
|
||||
. $BSDCFG_SHARE/common.subr || exit 1
|
||||
f_dprintf "%s: loading includes..." "$0"
|
||||
f_include $BSDCFG_SHARE/dialog.subr
|
||||
f_include $BSDCFG_SHARE/mustberoot.subr
|
||||
f_include $BSDCFG_SHARE/sysrc.subr
|
||||
|
||||
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="080.console"
|
||||
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
|
||||
|
||||
f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" ipgm &&
|
||||
pgm="${ipgm:-$pgm}"
|
||||
|
||||
############################################################ FUNCTIONS
|
||||
|
||||
# dialog_menu_main
|
||||
#
|
||||
# Display the dialog(1)-based application main menu.
|
||||
#
|
||||
dialog_menu_main()
|
||||
{
|
||||
local prompt="$msg_font_menu_text"
|
||||
local 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
|
||||
local defaultitem= # Calculated below
|
||||
local hline="$hline_choose_a_font"
|
||||
|
||||
local height width rows
|
||||
eval f_dialog_menu_size height width rows \
|
||||
\"\$DIALOG_TITLE\" \
|
||||
\"\$DIALOG_BACKTITLE\" \
|
||||
\"\$prompt\" \
|
||||
\"\$hline\" \
|
||||
$menu_list
|
||||
|
||||
case "$( f_sysrc_get font8x8 )" in
|
||||
[Nn][Oo]|'') defaultitem="1 $msg_none" ;;
|
||||
cp437-8x8) defaultitem="2 $msg_ibm_437" ;;
|
||||
cp850-8x8) defaultitem="3 $msg_ibm_850" ;;
|
||||
cp865-8x8) defaultitem="4 $msg_ibm_865" ;;
|
||||
cp866-8x8) defaultitem="5 $msg_ibm_866" ;;
|
||||
cp866u-8x8) defaultitem="6 $msg_ibm_866u" ;;
|
||||
cp1251-8x8) defaultitem="7 $msg_ibm_1251" ;;
|
||||
iso-8x8) defaultitem="8 $msg_iso_8859_1" ;;
|
||||
iso02-8x8) defaultitem="9 $msg_iso_8859_2" ;;
|
||||
iso04-8x8) defaultitem="a $msg_iso_8859_4" ;;
|
||||
iso07-8x8) defaultitem="b $msg_iso_8859_7" ;;
|
||||
iso08-8x8) defaultitem="c $msg_iso_8859_8" ;;
|
||||
iso15-8x8) defaultitem="d $msg_iso_8859_15" ;;
|
||||
swiss-8x8) defaultitem="e $msg_swiss" ;;
|
||||
esac
|
||||
|
||||
local menu_choice
|
||||
menu_choice=$( eval $DIALOG \
|
||||
--title \"\$DIALOG_TITLE\" \
|
||||
--backtitle \"\$DIALOG_BACKTITLE\" \
|
||||
--hline \"\$hline\" \
|
||||
--ok-label \"\$msg_ok\" \
|
||||
--cancel-label \"\$msg_cancel\" \
|
||||
--default-item \"\$defaultitem\" \
|
||||
--menu \"\$prompt\" \
|
||||
$height $width $rows \
|
||||
$menu_list \
|
||||
2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD
|
||||
)
|
||||
local retval=$?
|
||||
f_dialog_menutag_store -s "$menu_choice"
|
||||
return $retval
|
||||
}
|
||||
|
||||
############################################################ MAIN
|
||||
|
||||
# Incorporate rc-file if it exists
|
||||
[ -f "$HOME/.bsdconfigrc" ] && f_include "$HOME/.bsdconfigrc"
|
||||
|
||||
#
|
||||
# Process command-line arguments
|
||||
#
|
||||
while getopts h$GETOPTS_STDARGS flag; do
|
||||
case "$flag" in
|
||||
h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm" ;;
|
||||
esac
|
||||
done
|
||||
shift $(( $OPTIND - 1 ))
|
||||
|
||||
#
|
||||
# Initialize
|
||||
#
|
||||
f_dialog_title "$msg_system_console_font"
|
||||
f_dialog_backtitle "${ipgm:+bsdconfig }$pgm"
|
||||
f_mustberoot_init
|
||||
|
||||
#
|
||||
# Launch application main menu
|
||||
#
|
||||
dialog_menu_main || f_die
|
||||
f_dialog_menutag_fetch mtag
|
||||
|
||||
f8= f14= f16= mc_start=
|
||||
case "$mtag" in
|
||||
"1 $msg_none") # Use hardware default font
|
||||
f8="NO" f14="NO" f16="NO" ;;
|
||||
"2 $msg_ibm_437") # English and others, VGA default
|
||||
f8="cp437-8x8" f14="cp437-8x14" f16="cp437-8x16" ;;
|
||||
"3 $msg_ibm_850") # Western Europe, IBM encoding
|
||||
f8="cp850-8x8" f14="cp850-8x14" f16="cp850-8x16" ;;
|
||||
"4 $msg_ibm_865") # Norwegian, IBM encoding
|
||||
f8="cp865-8x8" f14="cp865-8x14" f16="cp865-8x16" ;;
|
||||
"5 $msg_ibm_866") # Russian, IBM encoding (use with KOI8-R screenmap)
|
||||
f8="cp866-8x8" f14="cp866-8x14" f16="cp866b-8x16" mc_start="3" ;;
|
||||
"6 $msg_ibm_866u") # Ukrainian, IBM encoding (use w/ KOI8-U screenmap)
|
||||
f8="cp866u-8x8" f14="cp866u-8x14" f16="cp866u-8x16" mc_start="3" ;;
|
||||
"7 $msg_ibm_1251") # Cyrillic, MS Windows encoding
|
||||
f8="cp1251-8x8" f14="cp1251-8x14" f16="cp1251-8x16" mc_start="3" ;;
|
||||
"8 $msg_iso_8859_1") # Western Europe, ISO encoding
|
||||
f8="iso-8x8" f14="iso-8x14" f16="iso-8x16" ;;
|
||||
"9 $msg_iso_8859_2") # Eastern Europe, ISO encoding
|
||||
f8="iso02-8x8" f14="iso02-8x14" f16="iso02-8x16" ;;
|
||||
"a $msg_iso_8859_4") # Baltic, ISO encoding
|
||||
f8="iso04-8x8" f14="iso04-8x14" f16="iso04-8x16" ;;
|
||||
"b $msg_iso_8859_7") # Greek, ISO encoding
|
||||
f8="iso07-8x8" f14="iso07-8x14" f16="iso07-8x16" ;;
|
||||
"c $msg_iso_8859_8") # Hebrew, ISO encoding
|
||||
f8="iso08-8x8" f14="iso08-8x14" f16="iso08-8x16" ;;
|
||||
"d $msg_iso_8859_15") # Europe, ISO encoding
|
||||
f8="iso15-8x8" f14="iso15-8x14" f16="iso15-8x16" ;;
|
||||
"e $msg_swiss") # English, better resolution
|
||||
f8="swiss-8x8" f14="NO" f16="swiss-8x16" ;;
|
||||
esac
|
||||
|
||||
[ "$f8" -a "$f14" -a "$f16" ] || f_die 1 "$msg_unknown_font_selection"
|
||||
|
||||
f_eval_catch "$0" f_sysrc_set 'f_sysrc_set font8x8 "%s"' "$f8" || f_die
|
||||
f_eval_catch "$0" f_sysrc_set 'f_sysrc_set font8x14 "%s"' "$f14" || f_die
|
||||
f_eval_catch "$0" f_sysrc_set 'f_sysrc_set font8x16 "%s"' "$f16" || f_die
|
||||
|
||||
if [ "$mc_start" ]; then
|
||||
f_eval_catch "$0" f_sysrc_set \
|
||||
'f_sysrc_set mousechar_start "%s"' "$mc_start" || f_die
|
||||
else
|
||||
f_eval_catch "$0" f_sysrc_delete \
|
||||
'f_sysrc_delete mousechar_start' || f_die
|
||||
fi
|
||||
|
||||
exit $SUCCESS
|
||||
|
||||
################################################################################
|
||||
# END
|
||||
################################################################################
|
6
bsdconfig/console/include/Makefile
Normal file
6
bsdconfig/console/include/Makefile
Normal file
@ -0,0 +1,6 @@
|
||||
# $FreeBSD$
|
||||
|
||||
FILESDIR= ${LIBEXECDIR}/bsdconfig/080.console/include
|
||||
FILES= messages.subr
|
||||
|
||||
.include <bsd.prog.mk>
|
11
bsdconfig/console/include/Makefile.depend
Normal file
11
bsdconfig/console/include/Makefile.depend
Normal file
@ -0,0 +1,11 @@
|
||||
# $FreeBSD$
|
||||
# Autogenerated - do NOT edit!
|
||||
|
||||
DIRDEPS = \
|
||||
|
||||
|
||||
.include <dirdeps.mk>
|
||||
|
||||
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
|
||||
# local dependencies - needed for -jN in clean tree
|
||||
.endif
|
270
bsdconfig/console/include/messages.subr
Normal file
270
bsdconfig/console/include/messages.subr
Normal file
@ -0,0 +1,270 @@
|
||||
# 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="Blank 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_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."
|
||||
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_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"
|
||||
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_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_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)"
|
||||
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_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"
|
||||
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_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_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"
|
||||
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_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"
|
||||
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_unknown_console_menu_selection="Unknown console menu selection"
|
||||
msg_unknown_font_selection="Unknown font selection"
|
||||
msg_unknown_keymap="Unknown keymap"
|
||||
msg_unknown_repeat_rate="Unknown repeat rate"
|
||||
msg_unknown_saver="Unknown saver"
|
||||
msg_unknown_screenmap_selection="Unknown screenmap selection"
|
||||
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"
|
338
bsdconfig/console/keymap
Executable file
338
bsdconfig/console/keymap
Executable file
@ -0,0 +1,338 @@
|
||||
#!/bin/sh
|
||||
#-
|
||||
# Copyright (c) 2012-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
|
||||
|
||||
BSDCFG_SHARE="/usr/share/bsdconfig"
|
||||
. $BSDCFG_SHARE/common.subr || exit 1
|
||||
f_dprintf "%s: loading includes..." "$0"
|
||||
f_include $BSDCFG_SHARE/dialog.subr
|
||||
f_include $BSDCFG_SHARE/mustberoot.subr
|
||||
f_include $BSDCFG_SHARE/sysrc.subr
|
||||
|
||||
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="080.console"
|
||||
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
|
||||
|
||||
f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" ipgm &&
|
||||
pgm="${ipgm:-$pgm}"
|
||||
|
||||
############################################################ 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 prompt="$msg_keymap_menu_text"
|
||||
local menu_list defaultitem= # Calculated below
|
||||
local hline="$hline_choose_a_keyboard_map"
|
||||
|
||||
#
|
||||
# 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"]
|
||||
}'
|
||||
)
|
||||
|
||||
local height width rows
|
||||
eval f_dialog_menu_size height width rows \
|
||||
\"\$DIALOG_TITLE\" \
|
||||
\"\$DIALOG_BACKTITLE\" \
|
||||
\"\$prompt\" \
|
||||
\"\$hline\" \
|
||||
$menu_list
|
||||
|
||||
case "$( f_sysrc_get keymap )" in
|
||||
be.iso) defaultitem="$msg_belgian" ;;
|
||||
br275.cp850) defaultitem="$msg_brazil_cp850" ;;
|
||||
br275.iso) defaultitem="$msg_brazil_iso" ;;
|
||||
br275.iso.acc) defaultitem="$msg_brazil_iso_accent" ;;
|
||||
bg.bds.ctrlcaps) defaultitem="$msg_bulgarian_bds" ;;
|
||||
bg.phonetic.ctrlcaps) defaultitem="$msg_bulgarian_phonetic" ;;
|
||||
ce.iso2) defaultitem="$msg_central_european_iso" ;;
|
||||
hr.iso) defaultitem="$msg_croatian_iso" ;;
|
||||
cs.latin2.qwertz) defaultitem="$msg_czech_iso_accent" ;;
|
||||
danish.cp865) defaultitem="$msg_danish_cp865" ;;
|
||||
danish.iso) defaultitem="$msg_danish_iso" ;;
|
||||
estonian.cp850) defaultitem="$msg_estonian_cp850" ;;
|
||||
estonian.iso) defaultitem="$msg_estonian_iso" ;;
|
||||
estonian.iso15) defaultitem="$msg_estonian_iso_15" ;;
|
||||
finnish.cp850) defaultitem="$msg_finnish_cp850" ;;
|
||||
finnish.iso) defaultitem="$msg_finnish_iso" ;;
|
||||
fr.iso) defaultitem="$msg_french_iso" ;;
|
||||
fr.iso.acc) defaultitem="$msg_french_iso_accent" ;;
|
||||
fr.macbook.acc) defaultitem="$msg_french_iso_macbook" ;;
|
||||
german.cp850) defaultitem="$msg_german_cp850" ;;
|
||||
german.iso) defaultitem="$msg_german_iso" ;;
|
||||
gr.us101.acc) defaultitem="$msg_greek_101" ;;
|
||||
el.iso07) defaultitem="$msg_greek_104" ;;
|
||||
gr.elot.acc) defaultitem="$msg_greek_elot" ;;
|
||||
hu.iso2.101keys) defaultitem="$msg_hungarian_101" ;;
|
||||
hu.iso2.102keys) defaultitem="$msg_hungarian_102" ;;
|
||||
icelandic.iso) defaultitem="$msg_icelandic" ;;
|
||||
icelandic.iso.acc) defaultitem="$msg_icelandic_accent" ;;
|
||||
it.iso) defaultitem="$msg_italian" ;;
|
||||
jp.106) defaultitem="$msg_japanese_106" ;;
|
||||
latinamerican) defaultitem="$msg_latin_american" ;;
|
||||
latinamerican.iso.acc) defaultitem="$msg_latin_american_accent" ;;
|
||||
norwegian.iso) defaultitem="$msg_norway_iso" ;;
|
||||
pl_PL.ISO8859-2) defaultitem="$msg_polish_iso" ;;
|
||||
pt.iso) defaultitem="$msg_portuguese" ;;
|
||||
pt.iso.acc) defaultitem="$msg_portuguese_accent" ;;
|
||||
ru.koi8-r) defaultitem="$msg_russia_koi8_r" ;;
|
||||
sk.iso2) defaultitem="$msg_slovak" ;;
|
||||
si.iso) defaultitem="$msg_slovenian" ;;
|
||||
spanish.iso) defaultitem="$msg_spanish" ;;
|
||||
spanish.iso.acc) defaultitem="$msg_spanish_accent" ;;
|
||||
swedish.cp850) defaultitem="$msg_swedish_cp850" ;;
|
||||
swedish.iso) defaultitem="$msg_swedish_iso" ;;
|
||||
swissfrench.cp850) defaultitem="$msg_swiss_french_cp850" ;;
|
||||
swissfrench.iso) defaultitem="$msg_swiss_french_iso" ;;
|
||||
swissfrench.iso.acc) defaultitem="$msg_swiss_french_iso_accent" ;;
|
||||
swissgerman.cp850) defaultitem="$msg_swiss_german_cp850" ;;
|
||||
swissgerman.iso) defaultitem="$msg_swiss_german_iso" ;;
|
||||
swissgerman.iso.acc) defaultitem="$msg_swiss_german_iso_accent" ;;
|
||||
uk.cp850) defaultitem="$msg_uk_cp850" ;;
|
||||
uk.iso) defaultitem="$msg_uk_iso" ;;
|
||||
ua.koi8-u) defaultitem="$msg_ukrainian_koi8_u" ;;
|
||||
ua.koi8-u.shift.alt) defaultitem="$msg_ukrainian_koi8_u_koi8_r" ;;
|
||||
us.ctrl) defaultitem="$msg_usa_capslock_ctrl" ;;
|
||||
us.pc-ctrl) defaultitem="$msg_usa_capslock_ctrl" ;;
|
||||
us.dvorak) defaultitem="$msg_usa_dvorak" ;;
|
||||
us.dvorakl) defaultitem="$msg_usa_dvorak_left" ;;
|
||||
us.dvorakr) defaultitem="$msg_usa_dvorak_right" ;;
|
||||
us.emacs) defaultitem="$msg_usa_emacs" ;;
|
||||
us.iso) defaultitem="$msg_usa_iso" ;;
|
||||
us.unix) defaultitem="$msg_usa_unix" ;;
|
||||
esac
|
||||
|
||||
# The defaultitem may have to be indented to match the menu_list
|
||||
if [ "$defaultitem" ]; then
|
||||
( eval set -- $menu_list
|
||||
while [ $# -gt 0 ]; do
|
||||
[ "$defaultitem" = "$1" ] && break
|
||||
[ " $defaultitem" = "$1" ] && exit 0
|
||||
shift 2 # tag/item
|
||||
done
|
||||
exit 1 # No modification needed
|
||||
) && defaultitem=" $defaultitem"
|
||||
fi
|
||||
|
||||
local menu_choice
|
||||
menu_choice=$( eval $DIALOG \
|
||||
--title \"\$DIALOG_TITLE\" \
|
||||
--backtitle \"\$DIALOG_BACKTITLE\" \
|
||||
--hline \"\$hline\" \
|
||||
--ok-label \"\$msg_ok\" \
|
||||
--cancel-label \"\$msg_cancel\" \
|
||||
--default-item \"\$defaultitem\" \
|
||||
--menu \"\$prompt\" \
|
||||
$height $width $rows \
|
||||
$menu_list \
|
||||
2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD
|
||||
)
|
||||
local retval=$?
|
||||
f_dialog_menutag_store -s "$menu_choice"
|
||||
return $retval
|
||||
}
|
||||
|
||||
############################################################ MAIN
|
||||
|
||||
# Incorporate rc-file if it exists
|
||||
[ -f "$HOME/.bsdconfigrc" ] && f_include "$HOME/.bsdconfigrc"
|
||||
|
||||
#
|
||||
# Process command-line arguments
|
||||
#
|
||||
while getopts h$GETOPTS_STDARGS flag; do
|
||||
case "$flag" in
|
||||
h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm" ;;
|
||||
esac
|
||||
done
|
||||
shift $(( $OPTIND - 1 ))
|
||||
|
||||
#
|
||||
# Initialize
|
||||
#
|
||||
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 || f_die
|
||||
f_dialog_menutag_fetch mtag
|
||||
|
||||
#
|
||||
# Reverse the users choice into the variable name
|
||||
#
|
||||
keymap_name=
|
||||
mtag="${mtag# }" # remove single leading-space if-present
|
||||
for name in $KEYMAP_NAMES; do
|
||||
debug= f_getvar msg_$name msg
|
||||
[ "$msg" = "$mtag" ] && keymap_name="$name" break
|
||||
done
|
||||
|
||||
[ "$keymap_name" ] || continue
|
||||
|
||||
keymap_to_set=
|
||||
case "$keymap_name" in
|
||||
belgian) keymap_to_set="be.iso" ;;
|
||||
brazil_cp850) keymap_to_set="br275.cp850" ;;
|
||||
brazil_iso) keymap_to_set="br275.iso" ;;
|
||||
brazil_iso_accent) keymap_to_set="br275.iso.acc" ;;
|
||||
bulgarian_bds) keymap_to_set="bg.bds.ctrlcaps" ;;
|
||||
bulgarian_phonetic) keymap_to_set="bg.phonetic.ctrlcaps" ;;
|
||||
central_european_iso) keymap_to_set="ce.iso2" ;;
|
||||
croatian_iso) keymap_to_set="hr.iso" ;;
|
||||
czech_iso_accent) keymap_to_set="cs.latin2.qwertz" ;;
|
||||
danish_cp865) keymap_to_set="danish.cp865" ;;
|
||||
danish_iso) keymap_to_set="danish.iso" ;;
|
||||
estonian_cp850) keymap_to_set="estonian.cp850" ;;
|
||||
estonian_iso) keymap_to_set="estonian.iso" ;;
|
||||
estonian_iso_15) keymap_to_set="estonian.iso15" ;;
|
||||
finnish_cp850) keymap_to_set="finnish.cp850" ;;
|
||||
finnish_iso) keymap_to_set="finnish.iso" ;;
|
||||
french_iso) keymap_to_set="fr.iso" ;;
|
||||
french_iso_accent) keymap_to_set="fr.iso.acc" ;;
|
||||
french_iso_macbook) keymap_to_set="fr.macbook.acc" ;;
|
||||
german_cp850) keymap_to_set="german.cp850" ;;
|
||||
german_iso) keymap_to_set="german.iso" ;;
|
||||
greek_101) keymap_to_set="gr.us101.acc" ;;
|
||||
greek_104) keymap_to_set="el.iso07" ;;
|
||||
greek_elot) keymap_to_set="gr.elot.acc" ;;
|
||||
hungarian_101) keymap_to_set="hu.iso2.101keys" ;;
|
||||
hungarian_102) keymap_to_set="hu.iso2.102keys" ;;
|
||||
icelandic) keymap_to_set="icelandic.iso" ;;
|
||||
icelandic_accent) keymap_to_set="icelandic.iso.acc" ;;
|
||||
italian) keymap_to_set="it.iso" ;;
|
||||
japanese_106) keymap_to_set="jp.106" ;;
|
||||
latin_american) keymap_to_set="latinamerican" ;;
|
||||
latin_american_accent) keymap_to_set="latinamerican.iso.acc" ;;
|
||||
norway_iso) keymap_to_set="norwegian.iso" ;;
|
||||
polish_iso) keymap_to_set="pl_PL.ISO8859-2" ;;
|
||||
portuguese) keymap_to_set="pt.iso" ;;
|
||||
portuguese_accent) keymap_to_set="pt.iso.acc" ;;
|
||||
russia_koi8_r) keymap_to_set="ru.koi8-r" ;;
|
||||
slovak) keymap_to_set="sk.iso2" ;;
|
||||
slovenian) keymap_to_set="si.iso" ;;
|
||||
spanish) keymap_to_set="spanish.iso" ;;
|
||||
spanish_accent) keymap_to_set="spanish.iso.acc" ;;
|
||||
swedish_cp850) keymap_to_set="swedish.cp850" ;;
|
||||
swedish_iso) keymap_to_set="swedish.iso" ;;
|
||||
swiss_french_cp850) keymap_to_set="swissfrench.cp850" ;;
|
||||
swiss_french_iso) keymap_to_set="swissfrench.iso" ;;
|
||||
swiss_french_iso_accent) keymap_to_set="swissfrench.iso.acc" ;;
|
||||
swiss_german_cp850) keymap_to_set="swissgerman.cp850" ;;
|
||||
swiss_german_iso) keymap_to_set="swissgerman.iso" ;;
|
||||
swiss_german_iso_accent) keymap_to_set="swissgerman.iso.acc" ;;
|
||||
uk_cp850) keymap_to_set="uk.cp850" ;;
|
||||
uk_iso) keymap_to_set="uk.iso" ;;
|
||||
ukrainian_koi8_u) keymap_to_set="ua.koi8-u" ;;
|
||||
ukrainian_koi8_u_koi8_r) keymap_to_set="ua.koi8-u.shift.alt" ;;
|
||||
usa_capslock_ctrl)
|
||||
case "$( sysctl -n kern.vty )" in
|
||||
vt) keymap_to_set="us.ctrl" ;;
|
||||
*) keymap_to_set="us.pc-ctrl" ;;
|
||||
esac
|
||||
;;
|
||||
usa_dvorak) keymap_to_set="us.dvorak" ;;
|
||||
usa_dvorak_left) keymap_to_set="us.dvorakl" ;;
|
||||
usa_dvorak_right) keymap_to_set="us.dvorakr" ;;
|
||||
usa_emacs) keymap_to_set="us.emacs" ;;
|
||||
usa_iso) keymap_to_set="us.iso" ;;
|
||||
usa_unix) keymap_to_set="us.unix" ;;
|
||||
esac
|
||||
|
||||
if [ "$keymap_to_set" ]; then
|
||||
f_eval_catch "$0" f_sysrc_set \
|
||||
'f_sysrc_set keymap "%s"' "$keymap_to_set" || f_die
|
||||
break
|
||||
else
|
||||
f_die 1 "$msg_unknown_keymap"
|
||||
fi
|
||||
done
|
||||
|
||||
exit $SUCCESS
|
||||
|
||||
################################################################################
|
||||
# END
|
||||
################################################################################
|
143
bsdconfig/console/repeat
Executable file
143
bsdconfig/console/repeat
Executable file
@ -0,0 +1,143 @@
|
||||
#!/bin/sh
|
||||
#-
|
||||
# Copyright (c) 2012-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
|
||||
|
||||
BSDCFG_SHARE="/usr/share/bsdconfig"
|
||||
. $BSDCFG_SHARE/common.subr || exit 1
|
||||
f_dprintf "%s: loading includes..." "$0"
|
||||
f_include $BSDCFG_SHARE/dialog.subr
|
||||
f_include $BSDCFG_SHARE/mustberoot.subr
|
||||
f_include $BSDCFG_SHARE/sysrc.subr
|
||||
|
||||
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="080.console"
|
||||
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
|
||||
|
||||
f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" ipgm &&
|
||||
pgm="${ipgm:-$pgm}"
|
||||
|
||||
############################################################ FUNCTIONS
|
||||
|
||||
# dialog_menu_main
|
||||
#
|
||||
# Display the dialog(1)-based application main menu.
|
||||
#
|
||||
dialog_menu_main()
|
||||
{
|
||||
local prompt="$msg_repeat_menu_text"
|
||||
local menu_list="
|
||||
'$msg_default' '$msg_default_desc'
|
||||
'$msg_slow' '$msg_slow_desc'
|
||||
'$msg_normal' '$msg_normal_desc'
|
||||
'$msg_fast' '$msg_fast_desc'
|
||||
" # END-QUOTE
|
||||
local defaultitem= # Calculated below
|
||||
local hline="$hline_choose_a_keyboard_repeat_rate"
|
||||
|
||||
local height width rows
|
||||
eval f_dialog_menu_size height width rows \
|
||||
\"\$DIALOG_TITLE\" \
|
||||
\"\$DIALOG_BACKTITLE\" \
|
||||
\"\$prompt\" \
|
||||
\"\$hline\" \
|
||||
$menu_list
|
||||
|
||||
case "$( f_sysrc_get keyrate )" in
|
||||
[Nn][Oo]|'') defaultitem="$msg_default" ;;
|
||||
slow) defaultitem="$msg_slow" ;;
|
||||
normal) defaultitem="$msg_normal" ;;
|
||||
fast) defaultitem="$msg_fast" ;;
|
||||
esac
|
||||
|
||||
local menu_choice
|
||||
menu_choice=$( eval $DIALOG \
|
||||
--title \"\$DIALOG_TITLE\" \
|
||||
--backtitle \"\$DIALOG_BACKTITLE\" \
|
||||
--hline \"\$hline\" \
|
||||
--ok-label \"\$msg_ok\" \
|
||||
--cancel-label \"\$msg_cancel\" \
|
||||
--default-item \"\$defaultitem\" \
|
||||
--menu \"\$prompt\" \
|
||||
$height $width $rows \
|
||||
$menu_list \
|
||||
2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD
|
||||
)
|
||||
local retval=$?
|
||||
f_dialog_menutag_store -s "$menu_choice"
|
||||
return $retval
|
||||
}
|
||||
|
||||
############################################################ MAIN
|
||||
|
||||
# Incorporate rc-file if it exists
|
||||
[ -f "$HOME/.bsdconfigrc" ] && f_include "$HOME/.bsdconfigrc"
|
||||
|
||||
#
|
||||
# Process command-line arguments
|
||||
#
|
||||
while getopts h$GETOPTS_STDARGS flag; do
|
||||
case "$flag" in
|
||||
h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm" ;;
|
||||
esac
|
||||
done
|
||||
shift $(( $OPTIND - 1 ))
|
||||
|
||||
#
|
||||
# Initialize
|
||||
#
|
||||
f_dialog_title "$msg_system_console_keyboard_repeat_rate"
|
||||
f_dialog_backtitle "${ipgm:+bsdconfig }$pgm"
|
||||
f_mustberoot_init
|
||||
|
||||
#
|
||||
# Launch application main menu
|
||||
#
|
||||
dialog_menu_main || f_die
|
||||
f_dialog_menutag_fetch mtag
|
||||
|
||||
repeat_rate_to_set=
|
||||
case "$mtag" in
|
||||
"$msg_default") repeat_rate_to_set="NO" ;; # Use default repeat rate
|
||||
"$msg_slow") repeat_rate_to_set="slow" ;; # Slow keyboard repeat rate
|
||||
"$msg_normal") repeat_rate_to_set="normal" ;; # "Normal" keyboard repeat rate
|
||||
"$msg_fast") repeat_rate_to_set="fast" ;; # Fast keyboard repeat rate
|
||||
esac
|
||||
|
||||
if [ "$repeat_rate_to_set" ]; then
|
||||
f_eval_catch "$0" f_sysrc_set \
|
||||
'f_sysrc_set keyrate "%s"' "$repeat_rate_to_set" || f_die
|
||||
break
|
||||
else
|
||||
f_die 1 "$msg_unknown_repeat_rate"
|
||||
fi
|
||||
|
||||
exit $SUCCESS
|
||||
|
||||
################################################################################
|
||||
# END
|
||||
################################################################################
|
195
bsdconfig/console/saver
Executable file
195
bsdconfig/console/saver
Executable file
@ -0,0 +1,195 @@
|
||||
#!/bin/sh
|
||||
#-
|
||||
# Copyright (c) 2012-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
|
||||
|
||||
BSDCFG_SHARE="/usr/share/bsdconfig"
|
||||
. $BSDCFG_SHARE/common.subr || exit 1
|
||||
f_dprintf "%s: loading includes..." "$0"
|
||||
f_include $BSDCFG_SHARE/dialog.subr
|
||||
f_include $BSDCFG_SHARE/mustberoot.subr
|
||||
f_include $BSDCFG_SHARE/sysrc.subr
|
||||
|
||||
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="080.console"
|
||||
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
|
||||
|
||||
f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" ipgm &&
|
||||
pgm="${ipgm:-$pgm}"
|
||||
|
||||
############################################################ FUNCTIONS
|
||||
|
||||
# dialog_menu_main
|
||||
#
|
||||
# Display the dialog(1)-based application main menu.
|
||||
#
|
||||
dialog_menu_main()
|
||||
{
|
||||
local prompt="$msg_saver_menu_text"
|
||||
local menu_list="
|
||||
'1 $msg_none' '$msg_none_saver_desc'
|
||||
'2 $msg_blank' '$msg_blank_desc'
|
||||
'3 $msg_beastie' '$msg_beastie_desc'
|
||||
'4 $msg_daemon' '$msg_daemon_desc'
|
||||
'5 $msg_dragon' '$msg_dragon_desc'
|
||||
'6 $msg_fade' '$msg_fade_desc'
|
||||
'7 $msg_fire' '$msg_fire_desc'
|
||||
'8 $msg_green' '$msg_green_desc'
|
||||
'9 $msg_logo' '$msg_logo_desc'
|
||||
'a $msg_rain' '$msg_rain_desc'
|
||||
'b $msg_snake' '$msg_snake_desc'
|
||||
'c $msg_star' '$msg_star_desc'
|
||||
'd $msg_warp' '$msg_warp_desc'
|
||||
'$msg_timeout' '$msg_timeout_desc'
|
||||
" # END-QUOTE
|
||||
local defaultitem= # Calculated below
|
||||
local hline="$hline_choose_a_screen_saver"
|
||||
|
||||
local height width rows
|
||||
eval f_dialog_menu_size height width rows \
|
||||
\"\$DIALOG_TITLE\" \
|
||||
\"\$DIALOG_BACKTITLE\" \
|
||||
\"\$prompt\" \
|
||||
\"\$hline\" \
|
||||
$menu_list
|
||||
|
||||
case "$( f_sysrc_get saver )" in
|
||||
[Nn][Oo]|'') defaultitem="1 $msg_none" ;;
|
||||
blank) defaultitem="2 $msg_blank" ;;
|
||||
beastie) defaultitem="3 $msg_beastie" ;;
|
||||
daemon) defaultitem="4 $msg_daemon" ;;
|
||||
dragon) defaultitem="5 $msg_dragon" ;;
|
||||
fade) defaultitem="6 $msg_fade" ;;
|
||||
fire) defaultitem="7 $msg_fire" ;;
|
||||
green) defaultitem="8 $msg_green" ;;
|
||||
logo) defaultitem="9 $msg_logo" ;;
|
||||
rain) defaultitem="a $msg_rain" ;;
|
||||
snake) defaultitem="b $msg_snake" ;;
|
||||
star) defaultitem="c $msg_star" ;;
|
||||
warp) defaultitem="d $msg_warp" ;;
|
||||
esac
|
||||
|
||||
local menu_choice
|
||||
menu_choice=$( eval $DIALOG \
|
||||
--title \"\$DIALOG_TITLE\" \
|
||||
--backtitle \"\$DIALOG_BACKTITLE\" \
|
||||
--hline \"\$hline\" \
|
||||
--ok-label \"\$msg_ok\" \
|
||||
--cancel-label \"\$msg_cancel\" \
|
||||
--default-item \"\$defaultitem\" \
|
||||
--menu \"\$prompt\" \
|
||||
$height $width $rows \
|
||||
$menu_list \
|
||||
2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD
|
||||
)
|
||||
local retval=$?
|
||||
f_dialog_menutag_store -s "$menu_choice"
|
||||
return $retval
|
||||
}
|
||||
|
||||
############################################################ MAIN
|
||||
|
||||
# Incorporate rc-file if it exists
|
||||
[ -f "$HOME/.bsdconfigrc" ] && f_include "$HOME/.bsdconfigrc"
|
||||
|
||||
#
|
||||
# Process command-line arguments
|
||||
#
|
||||
while getopts h$GETOPTS_STDARGS flag; do
|
||||
case "$flag" in
|
||||
h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm" ;;
|
||||
esac
|
||||
done
|
||||
shift $(( $OPTIND - 1 ))
|
||||
|
||||
#
|
||||
# Initialize
|
||||
#
|
||||
f_dialog_title "$msg_system_console_screen_saver"
|
||||
f_dialog_backtitle "${ipgm:+bsdconfig }$pgm"
|
||||
f_mustberoot_init
|
||||
|
||||
#
|
||||
# Launch application main menu
|
||||
#
|
||||
dialog_menu_main || f_die
|
||||
f_dialog_menutag_fetch mtag
|
||||
|
||||
case "$mtag" in
|
||||
"$msg_timeout") # Set the screen saver timeout interval
|
||||
f_dialog_title "$msg_value_required"
|
||||
f_dialog_input blanktime "$msg_enter_timeout_period" \
|
||||
"$( f_sysrc_get blanktime )" &&
|
||||
f_eval_catch "$0" f_sysrc_set \
|
||||
'f_sysrc_set blanktime "%s"' "$blanktime" || f_die
|
||||
f_dialog_title_restore
|
||||
exit $SUCCESS
|
||||
esac
|
||||
|
||||
saver_to_set=
|
||||
case "$mtag" in
|
||||
"1 $msg_none") # Disable the screensaver
|
||||
saver_to_set="NO" ;;
|
||||
"2 $msg_blank") # Simply blank the screen
|
||||
saver_to_set="blank" ;;
|
||||
"3 $msg_beastie") # "BSD Daemon" animated screen saver (graphics)
|
||||
saver_to_set="beastie" ;;
|
||||
"4 $msg_daemon") # "BSD Daemon" animated screen saver (text)
|
||||
saver_to_set="daemon" ;;
|
||||
"5 $msg_dragon") # Dragon screensaver (graphics)
|
||||
saver_to_set="dragon" ;;
|
||||
"6 $msg_fade") # Fade out effect screen saver
|
||||
saver_to_set="fade" ;;
|
||||
"7 $msg_fire") # Flames effect screen saver
|
||||
saver_to_set="fire" ;;
|
||||
"8 $msg_green") # "Green" power saving mode (if supported by monitor)
|
||||
saver_to_set="green" ;;
|
||||
"9 $msg_logo") # FreeBSD "logo" animated screen saver (graphics)
|
||||
saver_to_set="logo" ;;
|
||||
"a $msg_rain") # Rain drops screen saver
|
||||
saver_to_set="rain" ;;
|
||||
"b $msg_snake") # Draw a FreeBSD "snake" on your screen
|
||||
saver_to_set="snake" ;;
|
||||
"c $msg_star") # A "twinkling stars" effect
|
||||
saver_to_set="star" ;;
|
||||
"d $msg_warp") # A "stars warping" effect
|
||||
saver_to_set="warp" ;;
|
||||
esac
|
||||
|
||||
if [ "$saver_to_set" ]; then
|
||||
f_eval_catch "$0" f_sysrc_set \
|
||||
'f_sysrc_set saver "%s"' "$saver_to_set" || f_die
|
||||
break
|
||||
else
|
||||
f_die 1 "$msg_unknown_saver"
|
||||
fi
|
||||
|
||||
exit $SUCCESS
|
||||
|
||||
################################################################################
|
||||
# END
|
||||
################################################################################
|
155
bsdconfig/console/screenmap
Executable file
155
bsdconfig/console/screenmap
Executable file
@ -0,0 +1,155 @@
|
||||
#!/bin/sh
|
||||
#-
|
||||
# Copyright (c) 2012-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
|
||||
|
||||
BSDCFG_SHARE="/usr/share/bsdconfig"
|
||||
. $BSDCFG_SHARE/common.subr || exit 1
|
||||
f_dprintf "%s: loading includes..." "$0"
|
||||
f_include $BSDCFG_SHARE/dialog.subr
|
||||
f_include $BSDCFG_SHARE/mustberoot.subr
|
||||
f_include $BSDCFG_SHARE/sysrc.subr
|
||||
|
||||
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="080.console"
|
||||
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
|
||||
|
||||
f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" ipgm &&
|
||||
pgm="${ipgm:-$pgm}"
|
||||
|
||||
############################################################ FUNCTIONS
|
||||
|
||||
# dialog_menu_main
|
||||
#
|
||||
# Display the dialog(1)-based application main menu.
|
||||
#
|
||||
dialog_menu_main()
|
||||
{
|
||||
local prompt="$msg_screenmap_menu_text"
|
||||
local 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
|
||||
local defaultitem= # Calculated below
|
||||
local hline="$hline_choose_a_screen_map"
|
||||
|
||||
local height width rows
|
||||
eval f_dialog_menu_size height width rows \
|
||||
\"\$DIALOG_TITLE\" \
|
||||
\"\$DIALOG_BACKTITLE\" \
|
||||
\"\$prompt\" \
|
||||
\"\$hline\" \
|
||||
$menu_list
|
||||
|
||||
case "$( f_sysrc_get scrnmap )" in
|
||||
[Nn][Oo]|'') defaultitem="1 $msg_none" ;;
|
||||
iso-8859-1_to_cp437) defaultitem="2 $msg_iso_8859_1_to_ibm437" ;;
|
||||
iso-8859-7_to_cp437) defaultitem="3 $msg_iso_8859_7_to_ibm437" ;;
|
||||
us-ascii_to_cp437) defaultitem="4 $msg_us_ascii_to_ibm327" ;;
|
||||
koi8-r2cp866) defaultitem="5 $msg_koi8_r_to_ibm866" ;;
|
||||
koi8-u2cp866u) defaultitem="6 $msg_koi8_u_to_ibm866u" ;;
|
||||
esac
|
||||
|
||||
local menu_choice
|
||||
menu_choice=$( eval $DIALOG \
|
||||
--title \"\$DIALOG_TITLE\" \
|
||||
--backtitle \"\$DIALOG_BACKTITLE\" \
|
||||
--hline \"\$hline\" \
|
||||
--ok-label \"\$msg_ok\" \
|
||||
--cancel-label \"\$msg_cancel\" \
|
||||
--default-item \"\$defaultitem\" \
|
||||
--menu \"\$prompt\" \
|
||||
$height $width $rows \
|
||||
$menu_list \
|
||||
2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD
|
||||
)
|
||||
local retval=$?
|
||||
f_dialog_menutag_store -s "$menu_choice"
|
||||
return $retval
|
||||
}
|
||||
|
||||
############################################################ MAIN
|
||||
|
||||
# Incorporate rc-file if it exists
|
||||
[ -f "$HOME/.bsdconfigrc" ] && f_include "$HOME/.bsdconfigrc"
|
||||
|
||||
#
|
||||
# Process command-line arguments
|
||||
#
|
||||
while getopts h$GETOPTS_STDARGS flag; do
|
||||
case "$flag" in
|
||||
h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm" ;;
|
||||
esac
|
||||
done
|
||||
shift $(( $OPTIND - 1 ))
|
||||
|
||||
#
|
||||
# Initialize
|
||||
#
|
||||
f_dialog_title "$msg_system_console_screenmap"
|
||||
f_dialog_backtitle "${ipgm:+bsdconfig }$pgm"
|
||||
f_mustberoot_init
|
||||
|
||||
#
|
||||
# Launch application main menu
|
||||
#
|
||||
dialog_menu_main || f_die
|
||||
f_dialog_menutag_fetch mtag
|
||||
|
||||
scrnmap_to_set=
|
||||
case "$mtag" in
|
||||
"1 $msg_none") # No screenmap, don't touch font
|
||||
scrnmap_to_set="NO" ;;
|
||||
"2 $msg_iso_8859_1_to_ibm437") # W-Europe ISO 8859-1 to IBM 437 scrnmap
|
||||
scrnmap_to_set="iso-8859-1_to_cp437" ;;
|
||||
"3 $msg_iso_8859_7_to_ibm437") # Greek ISO 8859-7 to IBM 437 screenmap
|
||||
scrnmap_to_set="iso-8859-7_to_cp437" ;;
|
||||
"4 $msg_us_ascii_to_ibm327") # US-ASCII to IBM 437 screenmap
|
||||
scrnmap_to_set="us-ascii_to_cp437" ;;
|
||||
"5 $msg_koi8_r_to_ibm866") # Russian KOI8-R to IBM 866 screenmap
|
||||
scrnmap_to_set="koi8-r2cp866" ;;
|
||||
"6 $msg_koi8_u_to_ibm866u") # Ukrainian KOI8-U to IBM 866u screenmap
|
||||
scrnmap_to_set="koi8-u2cp866u" ;;
|
||||
esac
|
||||
|
||||
if [ "$scrnmap_to_set" ]; then
|
||||
f_eval_catch "$0" f_sysrc_set \
|
||||
'f_sysrc_set scrnmap "%s"' "$scrnmap_to_set" || f_die
|
||||
break
|
||||
else
|
||||
f_die 1 "$msg_unknown_screenmap_selection"
|
||||
fi
|
||||
|
||||
exit $SUCCESS
|
||||
|
||||
################################################################################
|
||||
# END
|
||||
################################################################################
|
207
bsdconfig/console/ttys
Executable file
207
bsdconfig/console/ttys
Executable file
@ -0,0 +1,207 @@
|
||||
#!/bin/sh
|
||||
#-
|
||||
# Copyright (c) 2012-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
|
||||
|
||||
BSDCFG_SHARE="/usr/share/bsdconfig"
|
||||
. $BSDCFG_SHARE/common.subr || exit 1
|
||||
f_dprintf "%s: loading includes..." "$0"
|
||||
f_include $BSDCFG_SHARE/dialog.subr
|
||||
f_include $BSDCFG_SHARE/mustberoot.subr
|
||||
f_include $BSDCFG_SHARE/sysrc.subr
|
||||
|
||||
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="080.console"
|
||||
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
|
||||
|
||||
f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" ipgm &&
|
||||
pgm="${ipgm:-$pgm}"
|
||||
|
||||
############################################################ CONFIGURATION
|
||||
|
||||
#
|
||||
# Location of ttys(5)
|
||||
#
|
||||
ETC_TTYS=/etc/ttys
|
||||
|
||||
############################################################ FUNCTIONS
|
||||
|
||||
# dialog_menu_main
|
||||
#
|
||||
# Display the dialog(1)-based application main menu.
|
||||
#
|
||||
dialog_menu_main()
|
||||
{
|
||||
local prompt="$msg_ttys_menu_text"
|
||||
local 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
|
||||
local hline="$hline_choose_a_terminal_type"
|
||||
|
||||
local height width rows
|
||||
eval f_dialog_menu_size height width rows \
|
||||
\"\$DIALOG_TITLE\" \
|
||||
\"\$DIALOG_BACKTITLE\" \
|
||||
\"\$prompt\" \
|
||||
\"\$hline\" \
|
||||
$menu_list
|
||||
|
||||
local menu_choice
|
||||
menu_choice=$( eval $DIALOG \
|
||||
--title \"\$DIALOG_TITLE\" \
|
||||
--backtitle \"\$DIALOG_BACKTITLE\" \
|
||||
--hline \"\$hline\" \
|
||||
--ok-label \"\$msg_ok\" \
|
||||
--cancel-label \"\$msg_cancel\" \
|
||||
--menu \"\$prompt\" \
|
||||
$height $width $rows \
|
||||
$menu_list \
|
||||
2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD
|
||||
)
|
||||
local retval=$?
|
||||
f_dialog_menutag_store -s "$menu_choice"
|
||||
|
||||
if [ $retval -eq $DIALOG_OK ]; then
|
||||
local item
|
||||
item=$( eval f_dialog_menutag2item \
|
||||
\"\$menu_choice\" $menu_list )
|
||||
f_dialog_menuitem_store "$item"
|
||||
fi
|
||||
|
||||
return $retval
|
||||
}
|
||||
|
||||
# ttys_set_type $consterm
|
||||
#
|
||||
# Set terminal type of `ttyv*' and `cons[0-9]' entries in ttys(5) to $consterm.
|
||||
#
|
||||
ttys_set_type()
|
||||
{
|
||||
local funcname=ttys_set_type
|
||||
local consterm="$1" err
|
||||
|
||||
#
|
||||
# Create new temporary file to write our ttys(5) update with new types.
|
||||
#
|
||||
local tmpfile
|
||||
f_eval_catch -k tmpfile $funcname mktemp 'mktemp -t "%s"' "$pgm" ||
|
||||
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 owner
|
||||
f_eval_catch -dk mode $funcname stat \
|
||||
'stat -f "%%#Lp" "%s"' "$ETC_TTYS" || mode=0644
|
||||
f_eval_catch -dk owner $funcname stat \
|
||||
'stat -f "%%u:%%g" "%s"' "$ETC_TTYS" || owner="root:wheel"
|
||||
f_eval_catch -d $funcname chmod 'chmod "%s" "%s"' "$mode" "$tmpfile"
|
||||
f_eval_catch -d $funcname chown 'chown "%s" "%s"' "$owner" "$tmpfile"
|
||||
|
||||
#
|
||||
# Operate on ttys(5), replacing only the types of `ttyv*' and
|
||||
# `cons[0-9]' terminals with the new type.
|
||||
#
|
||||
if ! err=$( 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" 2>&1 ); then
|
||||
f_dialog_msgbox "$err"
|
||||
return $FAILURE
|
||||
fi
|
||||
f_eval_catch $funcname mv 'mv -f "%s" "%s"' "$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 h$GETOPTS_STDARGS flag; do
|
||||
case "$flag" in
|
||||
h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm" ;;
|
||||
esac
|
||||
done
|
||||
shift $(( $OPTIND - 1 ))
|
||||
|
||||
#
|
||||
# Initialize
|
||||
#
|
||||
f_dialog_title "$msg_system_console_terminal_type"
|
||||
f_dialog_backtitle "${ipgm:+bsdconfig }$pgm"
|
||||
f_mustberoot_init
|
||||
|
||||
#
|
||||
# Launch application main menu
|
||||
#
|
||||
dialog_menu_main || f_die
|
||||
f_dialog_menutag_fetch mtag
|
||||
|
||||
[ "$mtag" = "1 $msg_none" ] && exit $SUCCESS
|
||||
|
||||
f_dialog_menuitem_fetch consterm
|
||||
ttys_set_type "$consterm" || f_die
|
||||
|
||||
exit $SUCCESS
|
||||
|
||||
################################################################################
|
||||
# END
|
||||
################################################################################
|
57
bsdconfig/diskmgmt/INDEX
Normal file
57
bsdconfig/diskmgmt/INDEX
Normal file
@ -0,0 +1,57 @@
|
||||
# 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 in the bsdconfig menu.
|
||||
#
|
||||
menu_title="Disk Management"
|
||||
|
||||
#
|
||||
# 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="Manage disk partitions and/or labels"
|
||||
|
||||
#
|
||||
# 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="diskmgmt|diskmgmt"
|
||||
|
||||
#
|
||||
# ------------ 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="diskmgmt"
|
11
bsdconfig/diskmgmt/Makefile
Normal file
11
bsdconfig/diskmgmt/Makefile
Normal file
@ -0,0 +1,11 @@
|
||||
# $FreeBSD$
|
||||
|
||||
SUBDIR= include
|
||||
|
||||
FILESDIR= ${LIBEXECDIR}/bsdconfig/050.diskmgmt
|
||||
FILES= INDEX USAGE
|
||||
|
||||
SCRIPTSDIR= ${FILESDIR}
|
||||
SCRIPTS= diskmgmt
|
||||
|
||||
.include <bsd.prog.mk>
|
11
bsdconfig/diskmgmt/Makefile.depend
Normal file
11
bsdconfig/diskmgmt/Makefile.depend
Normal file
@ -0,0 +1,11 @@
|
||||
# $FreeBSD$
|
||||
# Autogenerated - do NOT edit!
|
||||
|
||||
DIRDEPS = \
|
||||
|
||||
|
||||
.include <dirdeps.mk>
|
||||
|
||||
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
|
||||
# local dependencies - needed for -jN in clean tree
|
||||
.endif
|
37
bsdconfig/diskmgmt/USAGE
Normal file
37
bsdconfig/diskmgmt/USAGE
Normal file
@ -0,0 +1,37 @@
|
||||
# Copyright (c) 2012-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]
|
||||
|
||||
OPTIONS:
|
||||
-d Provide lots of debugging info on standard-out when running.
|
||||
-D file Send debugging info to file. If file begins with a plus-sign
|
||||
debug info is sent to both standard-out and file (minus the
|
||||
leading plus).
|
||||
-h Print this 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).
|
85
bsdconfig/diskmgmt/diskmgmt
Executable file
85
bsdconfig/diskmgmt/diskmgmt
Executable file
@ -0,0 +1,85 @@
|
||||
#!/bin/sh
|
||||
#-
|
||||
# Copyright (c) 2012-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
|
||||
|
||||
BSDCFG_SHARE="/usr/share/bsdconfig"
|
||||
. $BSDCFG_SHARE/common.subr || exit 1
|
||||
f_dprintf "%s: loading includes..." "$0"
|
||||
f_include $BSDCFG_SHARE/dialog.subr
|
||||
f_include $BSDCFG_SHARE/mustberoot.subr
|
||||
|
||||
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="050.diskmgmt"
|
||||
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
|
||||
|
||||
f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" ipgm &&
|
||||
pgm="${ipgm:-$pgm}"
|
||||
|
||||
############################################################ CONFIGURATION
|
||||
|
||||
#
|
||||
# If X11 is requested, which terminal and what options should we use?
|
||||
#
|
||||
X11TERM=xterm
|
||||
X11TERM_OPTS=
|
||||
|
||||
############################################################ MAIN
|
||||
|
||||
# Incorporate rc-file if it exists
|
||||
[ -f "$HOME/.bsdconfigrc" ] && f_include "$HOME/.bsdconfigrc"
|
||||
|
||||
#
|
||||
# Process command-line arguments
|
||||
#
|
||||
while getopts h$GETOPTS_STDARGS flag; do
|
||||
case "$flag" in
|
||||
h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm" ;;
|
||||
esac
|
||||
done
|
||||
shift $(( $OPTIND - 1 ))
|
||||
|
||||
#
|
||||
# Initialize
|
||||
#
|
||||
f_mustberoot_init
|
||||
|
||||
#
|
||||
# If Xdialog(1) is requested, we'll need to wrap bsdinstall(8) into xterm(1)
|
||||
#
|
||||
if [ "$USE_XDIALOG" ]; then
|
||||
f_have "$X11TERM" || f_die 1 \
|
||||
"$msg_no_such_file_or_directory" "$pgm" "$X11TERM"
|
||||
|
||||
exec $X11TERM $X11TERM_OPTS -e /usr/sbin/bsdinstall partedit
|
||||
else
|
||||
exec /usr/sbin/bsdinstall partedit
|
||||
fi
|
||||
|
||||
################################################################################
|
||||
# END
|
||||
################################################################################
|
6
bsdconfig/diskmgmt/include/Makefile
Normal file
6
bsdconfig/diskmgmt/include/Makefile
Normal file
@ -0,0 +1,6 @@
|
||||
# $FreeBSD$
|
||||
|
||||
FILESDIR= ${LIBEXECDIR}/bsdconfig/050.diskmgmt/include
|
||||
FILES= messages.subr
|
||||
|
||||
.include <bsd.prog.mk>
|
11
bsdconfig/diskmgmt/include/Makefile.depend
Normal file
11
bsdconfig/diskmgmt/include/Makefile.depend
Normal file
@ -0,0 +1,11 @@
|
||||
# $FreeBSD$
|
||||
# Autogenerated - do NOT edit!
|
||||
|
||||
DIRDEPS = \
|
||||
|
||||
|
||||
.include <dirdeps.mk>
|
||||
|
||||
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
|
||||
# local dependencies - needed for -jN in clean tree
|
||||
.endif
|
27
bsdconfig/diskmgmt/include/messages.subr
Normal file
27
bsdconfig/diskmgmt/include/messages.subr
Normal file
@ -0,0 +1,27 @@
|
||||
# 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$
|
||||
|
||||
msg_no_such_file_or_directory="%s: %s: No such file or directory"
|
57
bsdconfig/docsinstall/INDEX
Normal file
57
bsdconfig/docsinstall/INDEX
Normal file
@ -0,0 +1,57 @@
|
||||
# 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 in the bsdconfig menu.
|
||||
#
|
||||
menu_title="Documentation installation"
|
||||
|
||||
#
|
||||
# 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="Install FreeBSD Documentation set"
|
||||
|
||||
#
|
||||
# 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="docsinstall|docsinstall"
|
||||
|
||||
#
|
||||
# ------------ 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="docsinstall"
|
11
bsdconfig/docsinstall/Makefile
Normal file
11
bsdconfig/docsinstall/Makefile
Normal file
@ -0,0 +1,11 @@
|
||||
# $FreeBSD$
|
||||
|
||||
SUBDIR= include
|
||||
|
||||
FILESDIR= ${LIBEXECDIR}/bsdconfig/020.docsinstall
|
||||
FILES= INDEX USAGE
|
||||
|
||||
SCRIPTSDIR= ${FILESDIR}
|
||||
SCRIPTS= docsinstall
|
||||
|
||||
.include <bsd.prog.mk>
|
11
bsdconfig/docsinstall/Makefile.depend
Normal file
11
bsdconfig/docsinstall/Makefile.depend
Normal file
@ -0,0 +1,11 @@
|
||||
# $FreeBSD$
|
||||
# Autogenerated - do NOT edit!
|
||||
|
||||
DIRDEPS = \
|
||||
|
||||
|
||||
.include <dirdeps.mk>
|
||||
|
||||
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
|
||||
# local dependencies - needed for -jN in clean tree
|
||||
.endif
|
37
bsdconfig/docsinstall/USAGE
Normal file
37
bsdconfig/docsinstall/USAGE
Normal file
@ -0,0 +1,37 @@
|
||||
# Copyright (c) 2012-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]
|
||||
|
||||
OPTIONS:
|
||||
-d Provide lots of debugging info on standard-out when running.
|
||||
-D file Send debugging info to file. If file begins with a plus-sign
|
||||
debug info is sent to both standard-out and file (minus the
|
||||
leading plus).
|
||||
-h Print this 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).
|
97
bsdconfig/docsinstall/docsinstall
Executable file
97
bsdconfig/docsinstall/docsinstall
Executable file
@ -0,0 +1,97 @@
|
||||
#!/bin/sh
|
||||
#-
|
||||
# Copyright (c) 2012-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
|
||||
|
||||
BSDCFG_SHARE="/usr/share/bsdconfig"
|
||||
. $BSDCFG_SHARE/common.subr || exit 1
|
||||
f_dprintf "%s: loading includes..." "$0"
|
||||
f_include $BSDCFG_SHARE/dialog.subr
|
||||
f_include $BSDCFG_SHARE/mustberoot.subr
|
||||
|
||||
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="020.docsinstall"
|
||||
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
|
||||
|
||||
f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" ipgm &&
|
||||
pgm="${ipgm:-$pgm}"
|
||||
|
||||
############################################################ CONFIGURATION
|
||||
|
||||
#
|
||||
# If X11 is requested, which terminal and what options should we use?
|
||||
#
|
||||
X11TERM=xterm
|
||||
X11TERM_OPTS=
|
||||
|
||||
############################################################ MAIN
|
||||
|
||||
# Incorporate rc-file if it exists
|
||||
[ -f "$HOME/.bsdconfigrc" ] && f_include "$HOME/.bsdconfigrc"
|
||||
|
||||
#
|
||||
# Process command-line arguments
|
||||
#
|
||||
while getopts h$GETOPTS_STDARGS flag; do
|
||||
case "$flag" in
|
||||
h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm" ;;
|
||||
esac
|
||||
done
|
||||
shift $(( $OPTIND - 1 ))
|
||||
|
||||
#
|
||||
# Initialize
|
||||
#
|
||||
f_mustberoot_init
|
||||
|
||||
#
|
||||
# If Xdialog(1) is requested, we'll need to wrap bsdinstall(8) into xterm(1)
|
||||
#
|
||||
if [ "$USE_XDIALOG" ]; then
|
||||
#
|
||||
# Make sure $X11TERM exists and is executable
|
||||
#
|
||||
case "$X11TERM" in
|
||||
*/*)
|
||||
[ -e "$X11TERM" ] || f_die 1 \
|
||||
"$msg_no_such_file_or_directory" "$pgm" "$X11TERM"
|
||||
[ -x "$X11TERM" ] || f_die 1 \
|
||||
"$msg_permission_denied" "$pgm" "$X11TERM"
|
||||
;;
|
||||
*)
|
||||
f_have "$X11TERM" || f_die 1 \
|
||||
"$msg_no_such_file_or_directory" "$pgm" "$X11TERM"
|
||||
esac
|
||||
|
||||
exec $X11TERM $X11TERM_OPTS -e /usr/sbin/bsdinstall docsinstall
|
||||
else
|
||||
exec /usr/sbin/bsdinstall docsinstall
|
||||
fi
|
||||
|
||||
################################################################################
|
||||
# END
|
||||
################################################################################
|
6
bsdconfig/docsinstall/include/Makefile
Normal file
6
bsdconfig/docsinstall/include/Makefile
Normal file
@ -0,0 +1,6 @@
|
||||
# $FreeBSD$
|
||||
|
||||
FILESDIR= ${LIBEXECDIR}/bsdconfig/020.docsinstall/include
|
||||
FILES= messages.subr
|
||||
|
||||
.include <bsd.prog.mk>
|
11
bsdconfig/docsinstall/include/Makefile.depend
Normal file
11
bsdconfig/docsinstall/include/Makefile.depend
Normal file
@ -0,0 +1,11 @@
|
||||
# $FreeBSD$
|
||||
# Autogenerated - do NOT edit!
|
||||
|
||||
DIRDEPS = \
|
||||
|
||||
|
||||
.include <dirdeps.mk>
|
||||
|
||||
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
|
||||
# local dependencies - needed for -jN in clean tree
|
||||
.endif
|
28
bsdconfig/docsinstall/include/messages.subr
Normal file
28
bsdconfig/docsinstall/include/messages.subr
Normal file
@ -0,0 +1,28 @@
|
||||
# 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$
|
||||
|
||||
msg_no_such_file_or_directory="%s: %s: No such file or directory"
|
||||
msg_permission_denied="%s: %s: permission denied"
|
57
bsdconfig/dot/INDEX
Normal file
57
bsdconfig/dot/INDEX
Normal file
@ -0,0 +1,57 @@
|
||||
# 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 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="dot|dot"
|
||||
|
||||
#
|
||||
# ------------ 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=""
|
11
bsdconfig/dot/Makefile
Normal file
11
bsdconfig/dot/Makefile
Normal file
@ -0,0 +1,11 @@
|
||||
# $FreeBSD$
|
||||
|
||||
SUBDIR= include
|
||||
|
||||
FILESDIR= ${LIBEXECDIR}/bsdconfig/dot
|
||||
FILES= INDEX USAGE
|
||||
|
||||
SCRIPTSDIR= ${FILESDIR}
|
||||
SCRIPTS= dot
|
||||
|
||||
.include <bsd.prog.mk>
|
11
bsdconfig/dot/Makefile.depend
Normal file
11
bsdconfig/dot/Makefile.depend
Normal file
@ -0,0 +1,11 @@
|
||||
# $FreeBSD$
|
||||
# Autogenerated - do NOT edit!
|
||||
|
||||
DIRDEPS = \
|
||||
|
||||
|
||||
.include <dirdeps.mk>
|
||||
|
||||
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
|
||||
# local dependencies - needed for -jN in clean tree
|
||||
.endif
|
143
bsdconfig/dot/USAGE
Normal file
143
bsdconfig/dot/USAGE
Normal file
@ -0,0 +1,143 @@
|
||||
# Copyright (c) 2012-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]
|
||||
|
||||
OPTIONS:
|
||||
-h Print this usage statement and exit.
|
||||
-c Don't show command-line shortcut relationships.
|
||||
-d Don't show the date in the graph label.
|
||||
-i Don't show include relationships.
|
||||
|
||||
EXAMPLES:
|
||||
View dot(1) language output describing bsdconfig(8) layout/make-up:
|
||||
|
||||
bsdconfig @PROGRAM_NAME@ | less
|
||||
|
||||
Render dot(1) output in SVG format (displays in most modern browsers):
|
||||
|
||||
bsdconfig @PROGRAM_NAME@ | dot -Tsvg -o bsdconfig.svg
|
||||
|
||||
NOTE: Requires `graphics/graphviz' from ports/packages.
|
||||
|
||||
View the above-rendered SVG file using your favorite X11-based viewer:
|
||||
|
||||
gimmage bsdconfig.svg
|
||||
|
||||
NOTE: Requires `graphics/gimmage' from ports/packages.
|
||||
|
||||
or
|
||||
|
||||
gthumb bsdconfig.svg
|
||||
|
||||
NOTE: Image is scaled to fit window on launch.
|
||||
NOTE: Requires `graphics/gthumb' from ports/packages.
|
||||
|
||||
or
|
||||
|
||||
gqview bsdconfig.svg
|
||||
|
||||
NOTE: Requires `graphics/gqview' from ports/packages.
|
||||
|
||||
or
|
||||
|
||||
gx bsdconfig.svg
|
||||
|
||||
NOTE: Image is scaled to fit window on launch.
|
||||
NOTE: Requires `graphics/gx' from ports/packages.
|
||||
|
||||
or
|
||||
|
||||
eog bsdconfig.svg
|
||||
|
||||
NOTE: Requires `graphics/eog' from ports/packages.
|
||||
|
||||
Render dot(1) output as PostScript print output consisting of multiple
|
||||
US-Letter sized pages that can be assembled into a large poster (using
|
||||
traditional tools such as scissors and tape):
|
||||
|
||||
bsdconfig @PROGRAM_NAME@ | dot -Teps -o bsdconfig.eps
|
||||
poster -v -mLet -s1 -o bsdconfig.ps bsdconfig.eps
|
||||
|
||||
NOTE: Change "-s1" above to "-s0.5" to halve the size of the
|
||||
poster or "-s2", for example, to double the poster size.
|
||||
|
||||
NOTE: Requires both `graphics/graphviz' and `print/poster' from
|
||||
ports/packages.
|
||||
|
||||
Render dot(1) output as PostScript scaled to fit on a poster consisting
|
||||
of 2x-wide and 4x-tall US-Letter sized pages:
|
||||
|
||||
bsdconfig @PROGRAM_NAME@ | dot -Teps -o bsdconfig.eps
|
||||
poster -v -mLet -p2x4Letter -o bsdconfig.ps bsdconfig.eps
|
||||
|
||||
NOTE: Requires both `graphics/graphviz' and `print/poster' from
|
||||
ports/packages.
|
||||
|
||||
View the above-rendered PostScript poster using X11:
|
||||
|
||||
gsview bsdconfig.ps
|
||||
|
||||
NOTE: Requires `print/gsview' from ports/packages.
|
||||
|
||||
or
|
||||
|
||||
convert bsdconfig.ps bsdconfig.pdf
|
||||
xpdf bsdconfig.pdf
|
||||
|
||||
NOTE: Requires both `graphics/ImageMagick' and
|
||||
`graphics/xdpf' from ports/packages.
|
||||
|
||||
NOTE: The converted PDF file is not suitable for
|
||||
printing due to loss of quality during the
|
||||
conversion process.
|
||||
|
||||
Print the above-rendered PostScript poster:
|
||||
|
||||
lpr -h bsdconfig.ps
|
||||
|
||||
NOTE: Requires configuration of a printer in `/etc/printcap'.
|
||||
|
||||
Extract each page of the poster into a separate PNG file:
|
||||
|
||||
gs -q -dNOPAUSE -dBATCH -sPAPERSIZE=letter \
|
||||
-dTextAlphaBits=4 -dGraphicsAlphaBits=4 \
|
||||
-sDEVICE=png16m -sOutputFile=bsdconfig%03d.png \
|
||||
bsdconfig.ps
|
||||
|
||||
NOTE: Requires `print/ghostscript9' from ports/packages.
|
||||
|
||||
NOTE: The converted PNG files are not suitable for printing
|
||||
due to loss of quality during the conversion process.
|
||||
|
||||
Extract a single page of the poster into a separate PostScript file for
|
||||
printing individual pages from the command-line:
|
||||
|
||||
psselect 1 bsdconfig.ps bsdconfig-page1.ps
|
||||
lpr -h bsdconfig-page1.ps
|
||||
|
||||
NOTE: Change "1" to "2" for the second page, ad-infinitum.
|
||||
NOTE: Requires `print/psutils-letter' from ports/packages.
|
678
bsdconfig/dot/dot
Executable file
678
bsdconfig/dot/dot
Executable file
@ -0,0 +1,678 @@
|
||||
#!/bin/sh
|
||||
#-
|
||||
# Copyright (c) 2012-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 so does not require 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="dot"
|
||||
f_include_lang $BSDCFG_LIBE/include/messages.subr
|
||||
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
|
||||
|
||||
f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" ipgm &&
|
||||
pgm="${ipgm:-$pgm}"
|
||||
|
||||
############################################################ CONFIGURATION
|
||||
|
||||
#
|
||||
# Location of bsdconfig(8)
|
||||
#
|
||||
BSDCONFIG=/usr/sbin/bsdconfig
|
||||
|
||||
############################################################ GLOBALS
|
||||
|
||||
#
|
||||
# Options
|
||||
#
|
||||
SHOW_GRAPH_LABEL_DATE=1
|
||||
SHOW_INCLUDES=1
|
||||
SHOW_CMDLINE=1
|
||||
|
||||
############################################################ FUNCTIONS
|
||||
|
||||
# begin_nodelist $shape $color $fillcolor $style
|
||||
#
|
||||
# Create a new multi-node list rendering nodes in a specific style described by
|
||||
# the arguments passed.
|
||||
#
|
||||
begin_nodelist()
|
||||
{
|
||||
local shape="$1" color="$2" fillcolor="$3" style="$4"
|
||||
|
||||
printf "\tnode [\n"
|
||||
[ "$shape" ] &&
|
||||
printf '\t\tshape = "%s",\n' "$shape"
|
||||
[ "$color" ] &&
|
||||
printf '\t\tcolor = "%s",\n' "$color"
|
||||
[ "$fillcolor" ] &&
|
||||
printf '\t\tfillcolor = "%s",\n' "$fillcolor"
|
||||
[ "$style" ] &&
|
||||
printf '\t\tstyle = "%s",\n' "$style"
|
||||
printf "\t] {\n"
|
||||
}
|
||||
|
||||
# print_node $node [$attributes ...]
|
||||
#
|
||||
# Print a node within a multi-node list.
|
||||
#
|
||||
print_node()
|
||||
{
|
||||
local node="$1"
|
||||
|
||||
shift 1 # node
|
||||
|
||||
case "$node" in
|
||||
edge) printf '\t\t%s' "$node" ;;
|
||||
*) printf '\t\t"%s"' "$node" ;;
|
||||
esac
|
||||
|
||||
if [ $# -gt 0 ]; then
|
||||
echo -n ' ['
|
||||
while [ $# -gt 0 ]; do
|
||||
printf " %s" "$1"
|
||||
shift 1
|
||||
[ $# -gt 0 ] && echo -n ","
|
||||
done
|
||||
echo -n " ]"
|
||||
fi
|
||||
|
||||
echo ";"
|
||||
}
|
||||
|
||||
# print_node2 $node $node [$attributes ...]
|
||||
#
|
||||
# Print a directed node-node connection within a multi-node list.
|
||||
#
|
||||
print_node2()
|
||||
{
|
||||
local node1="$1" node2="$2"
|
||||
|
||||
shift 2 # node1 node2
|
||||
|
||||
printf '\t\t"%s" -> "%s"' "$node1" "$node2"
|
||||
|
||||
if [ $# -gt 0 ]; then
|
||||
echo -n ' ['
|
||||
while [ $# -gt 0 ]; do
|
||||
printf " %s" "$1"
|
||||
shift 1
|
||||
[ $# -gt 0 ] && echo -n ","
|
||||
done
|
||||
echo -n " ]"
|
||||
fi
|
||||
|
||||
echo ";"
|
||||
}
|
||||
|
||||
# end_nodelist
|
||||
#
|
||||
# Close a multi-node list.
|
||||
#
|
||||
end_nodelist()
|
||||
{
|
||||
printf "\t};\n"
|
||||
}
|
||||
|
||||
############################################################ MAIN
|
||||
|
||||
# Incorporate rc-file if it exists
|
||||
[ -f "$HOME/.bsdconfigrc" ] && f_include "$HOME/.bsdconfigrc"
|
||||
|
||||
#
|
||||
# Process command-line arguments
|
||||
#
|
||||
while getopts cdhi flag; do
|
||||
case "$flag" in
|
||||
i) SHOW_INCLUDES= ;;
|
||||
d) SHOW_GRAPH_LABEL_DATE= ;;
|
||||
c) SHOW_CMDLINE= ;;
|
||||
h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm" ;;
|
||||
esac
|
||||
done
|
||||
shift $(( $OPTIND - 1 ))
|
||||
|
||||
cd $BSDCFG_LIBE || f_die # Pedantic
|
||||
|
||||
#
|
||||
# Get a list of menu programs
|
||||
#
|
||||
menu_program_list=
|
||||
for file in [0-9][0-9][0-9].*/INDEX; do
|
||||
menu_program_list="$menu_program_list $(
|
||||
tail -r "$file" | awk -v item="${file%%/*}" '
|
||||
/^[[:space:]]*menu_program="/ {
|
||||
sub(/^.*="/, "")
|
||||
sub(/"$/, "")
|
||||
if ( ! $0 ) next
|
||||
if ( $0 !~ "^/" ) sub(/^/, item "/")
|
||||
print; exit
|
||||
}'
|
||||
)"
|
||||
done
|
||||
|
||||
#
|
||||
# Get a list of submenu programs
|
||||
#
|
||||
submenu_program_list=
|
||||
for menu_program in $menu_program_list; do
|
||||
case "$menu_program" in
|
||||
[0-9][0-9][0-9].*/*) : fall-through ;;
|
||||
*) continue # No sub-menus we can process
|
||||
esac
|
||||
|
||||
submenu_program_list="$submenu_program_list $(
|
||||
awk -v menu_program="$menu_program" \
|
||||
-v item="${menu_program%%/*}" \
|
||||
'
|
||||
/^menu_selection="/ {
|
||||
sub(/.*\|/, "")
|
||||
sub(/"$/, "")
|
||||
if ( ! $0 ) next
|
||||
if ( $0 !~ "^/" )
|
||||
sub(/^/, item "/")
|
||||
if ( $0 == menu_program ) next
|
||||
print
|
||||
}
|
||||
' "${menu_program%%/*}/INDEX"
|
||||
)"
|
||||
done
|
||||
|
||||
#
|
||||
# Get a list of command-line programs
|
||||
#
|
||||
cmd_program_list=
|
||||
for file in */INDEX; do
|
||||
cmd_program_list="$cmd_program_list $(
|
||||
awk -v item="${file%%/*}" '
|
||||
/^menu_selection="/ {
|
||||
sub(/.*\|/, "")
|
||||
sub(/"$/, "")
|
||||
|
||||
if ( ! $0 ) next
|
||||
|
||||
if ( $0 !~ "^/" )
|
||||
sub(/^/, item "/")
|
||||
|
||||
print
|
||||
}
|
||||
' $file
|
||||
)"
|
||||
done
|
||||
|
||||
#
|
||||
# [Optionally] Calculate list of include files
|
||||
#
|
||||
if [ "$SHOW_INCLUDES" ]; then
|
||||
print_includes_awk='
|
||||
BEGIN { regex = "^f_include \\$BSDCFG_SHARE/" }
|
||||
( $0 ~ regex ) { sub(regex, ""); print }
|
||||
' # END-QUOTE
|
||||
|
||||
#
|
||||
# Build list of files in which to search for includes
|
||||
#
|
||||
file_list=$(
|
||||
for file in \
|
||||
$BSDCONFIG \
|
||||
$menu_program_list \
|
||||
$submenu_program_list \
|
||||
$cmd_program_list \
|
||||
$BSDCFG_SHARE/script.subr \
|
||||
; do
|
||||
[ -e "$file" ] && echo $file
|
||||
done | sort -u
|
||||
)
|
||||
|
||||
#
|
||||
# Build list of includes used by the above files
|
||||
#
|
||||
include_file_list=
|
||||
for file in $file_list; do
|
||||
include_file_list="$include_file_list $(
|
||||
awk "$print_includes_awk" $file
|
||||
)"
|
||||
done
|
||||
|
||||
#
|
||||
# Sort the list of includes and remove duplicate entries
|
||||
#
|
||||
include_file_list=$(
|
||||
for include_file in $include_file_list; do
|
||||
echo "$include_file"
|
||||
done | sort -u
|
||||
)
|
||||
|
||||
#
|
||||
# Search previously-discovered include files for further includes
|
||||
#
|
||||
before="$include_file_list"
|
||||
while :; do
|
||||
for file in $include_file_list; do
|
||||
include_file_list="$include_file_list $(
|
||||
awk "$print_includes_awk" $BSDCFG_SHARE/$file
|
||||
)"
|
||||
done
|
||||
|
||||
#
|
||||
# Sort list of includes and remove duplicate entries [again]
|
||||
#
|
||||
include_file_list=$(
|
||||
for include_file in $include_file_list; do
|
||||
echo "$include_file"
|
||||
done | sort -u
|
||||
)
|
||||
|
||||
[ "$include_file_list" = "$before" ] && break
|
||||
before="$include_file_list"
|
||||
done
|
||||
fi
|
||||
|
||||
#
|
||||
# Start the directional-graph (digraph) output
|
||||
#
|
||||
printf 'strict digraph "" { // Empty name to prevent SVG Auto-Tooltip\n'
|
||||
label_format="$msg_graph_label_with_command"
|
||||
[ "$SHOW_GRAPH_LABEL_DATE" ] &&
|
||||
label_format="$msg_graph_label_with_command_and_date"
|
||||
lang="${LANG:-$LC_ALL}"
|
||||
printf "\n\tlabel = \"$label_format\"\n" \
|
||||
"${lang:+LANG=${lang%%[$IFS]*} }bsdconfig $pgm${ARGV:+ $ARGV}" \
|
||||
"$( date +"%c %Z" )"
|
||||
|
||||
#
|
||||
# Print graph-specific properties
|
||||
#
|
||||
printf '\n\t/*\n\t * Graph setup and orientation\n\t */\n'
|
||||
printf '\tlabelloc = top;\t\t// display above label at top of graph\n'
|
||||
printf '\trankdir = LR;\t\t// create ranks left-to-right\n'
|
||||
printf '\torientation = portrait;\t// default\n'
|
||||
printf '\tratio = fill;\t\t// approximate aspect ratio\n'
|
||||
printf '\tcenter = 1;\t\t// center drawing on page\n'
|
||||
|
||||
#
|
||||
# Perform edge-concentration when displaying a lot of information
|
||||
#
|
||||
# NOTE: This is disabled because dot(1) version 2.28.0 (current) and older have
|
||||
# a bug that causes a crash when rankdir = LR and concentrate = true
|
||||
#
|
||||
# NOTE: Do not re-enable until said bug is fixed in some future revision.
|
||||
#
|
||||
#[ "$SHOW_INCLUDES" -a "$SHOW_CMDLINE" ] &&
|
||||
# printf '\tconcentrate = true;\t// enable edge concentrators\n'
|
||||
|
||||
#
|
||||
# Print font details for graph/cluster label(s)
|
||||
#
|
||||
printf '\n\t/*\n\t * Font details for graph/cluster label(s)\n\t */\n'
|
||||
printf '\tfontname = "Times-Italic";\n'
|
||||
printf '\tfontsize = 14;\n'
|
||||
|
||||
#
|
||||
# Print default node attributes
|
||||
#
|
||||
printf '\n\t/*\n\t * Default node attributes\n\t */\n'
|
||||
printf '\tnode [\n'
|
||||
printf '\t\tfontname = "Times-Roman",\n'
|
||||
printf '\t\tfontsize = 12,\n'
|
||||
printf '\t\twidth = 2.5, // arbitrary minimum width for all nodes\n'
|
||||
printf '\t\tfixedsize = true, // turn minimum width into exact width\n'
|
||||
printf '\t];\n'
|
||||
|
||||
#
|
||||
# Print top-level item(s)
|
||||
#
|
||||
printf '\n\t/*\n\t * bsdconfig(8)\n\t */\n'
|
||||
shape=circle color=black fillcolor=yellow style=filled
|
||||
begin_nodelist "$shape" "$color" "$fillcolor" "$style"
|
||||
print_node "bsdconfig" "fontname = \"Times-Bold\"" "fontsize = 16"
|
||||
end_nodelist
|
||||
|
||||
#
|
||||
# Print menus
|
||||
#
|
||||
printf '\n\t/*\n\t * Menu items\n\t */\n'
|
||||
shape=box color=black fillcolor=lightblue style=filled
|
||||
begin_nodelist "$shape" "$color" "$fillcolor" "$style"
|
||||
for menu_program in $menu_program_list; do
|
||||
print_node "$menu_program" "label = \"${menu_program#*/}\""
|
||||
done
|
||||
end_nodelist
|
||||
|
||||
#
|
||||
# Print sub-menus
|
||||
#
|
||||
printf '\n\t/*\n\t * Sub-menu items\n\t */\n'
|
||||
shape=box color=black fillcolor=lightblue style=filled
|
||||
begin_nodelist "$shape" "$color" "$fillcolor" "$style"
|
||||
for submenu_program in $submenu_program_list; do
|
||||
print_node "$submenu_program" "label = \"${submenu_program#*/}\""
|
||||
done
|
||||
end_nodelist
|
||||
|
||||
#
|
||||
# Print menu relationships
|
||||
#
|
||||
printf '\n\t/*\n\t * Menu item relationships\n\t */\n'
|
||||
shape=box color=black fillcolor=lightblue style=filled edge_color=blue
|
||||
begin_nodelist "$shape" "$color" "$fillcolor" "$style"
|
||||
print_node edge "penwidth = 5.0" "style = bold" "color = $edge_color"
|
||||
for menu_program in $menu_program_list; do
|
||||
print_node2 "bsdconfig" "$menu_program"
|
||||
done
|
||||
end_nodelist
|
||||
|
||||
#
|
||||
# Print sub-menu relationships
|
||||
#
|
||||
printf '\n\t/*\n\t * Sub-menu item relationships\n\t */\n'
|
||||
shape=box color=black fillcolor=lightblue style=filled edge_color=blue
|
||||
begin_nodelist "$shape" "$color" "$fillcolor" "$style"
|
||||
# Lock sub-menu headport to the West (unless `-c' was passed)
|
||||
[ "$SHOW_CMDLINE" -o ! "$SHOW_INCLUDES" ] && print_node edge "headport = w"
|
||||
print_node edge "style = bold" "color = $edge_color"
|
||||
for submenu_program in $submenu_program_list; do
|
||||
for menu_program in $menu_program_list; do
|
||||
case "$menu_program" in
|
||||
[0-9][0-9][0-9].*/*) : fall-through ;;
|
||||
*) continue # Not a menu item
|
||||
esac
|
||||
|
||||
# Continue if program directories do not match
|
||||
[ "${menu_program%%/*}" = "${submenu_program%%/*}" ] ||
|
||||
continue
|
||||
|
||||
print_node2 "$menu_program" "$submenu_program"
|
||||
break
|
||||
done
|
||||
done
|
||||
end_nodelist
|
||||
|
||||
#
|
||||
# [Optionally] Print include files
|
||||
#
|
||||
if [ "$SHOW_INCLUDES" ]; then
|
||||
printf '\n\t/*\n\t * Include files\n\t */\n'
|
||||
shape=oval color=black fillcolor=white style=filled
|
||||
begin_nodelist "$shape" "$color" "$fillcolor" "$style"
|
||||
printf '\t\tconstraint = false;\n'
|
||||
for include_file in $include_file_list; do
|
||||
print_node "$include_file" \
|
||||
"label = \"${include_file##*/}\""
|
||||
done
|
||||
end_nodelist
|
||||
fi
|
||||
|
||||
#
|
||||
# [Optionally] Print f_include() usage/relationships
|
||||
#
|
||||
if [ "$SHOW_INCLUDES" ]; then
|
||||
printf '\n\t/*\n\t * Include usage\n\t */\n'
|
||||
shape=oval color=black fillcolor=white style=filled edge_color=grey
|
||||
begin_nodelist "$shape" "$color" "$fillcolor" "$style"
|
||||
print_node edge "style = dashed" "color = $edge_color"
|
||||
#print_node edge "label = \"\\T\"" "fontsize = 9"
|
||||
# NOTE: Edge labels are buggy on large graphs
|
||||
file_list=$(
|
||||
for file in \
|
||||
$BSDCONFIG \
|
||||
$menu_program_list \
|
||||
$submenu_program_list \
|
||||
$cmd_program_list \
|
||||
$include_file_list \
|
||||
; do
|
||||
[ -f "$BSDCFG_SHARE/$file" ] &&
|
||||
echo $BSDCFG_SHARE/$file
|
||||
[ -e "$file" ] && echo $file
|
||||
done | sort -u
|
||||
)
|
||||
for file in $file_list; do
|
||||
# Skip binary files and text files that don't use f_include()
|
||||
grep -qlI f_include $file || continue
|
||||
|
||||
awk \
|
||||
-v file="${file#$BSDCFG_SHARE/}" \
|
||||
-v bsdconfig="$BSDCONFIG" \
|
||||
'
|
||||
BEGIN { regex = "^f_include \\$BSDCFG_SHARE/" }
|
||||
( $0 ~ regex ) {
|
||||
sub(regex, "")
|
||||
if ( file == bsdconfig ) sub(".*/", "", file)
|
||||
printf "\t\t\"%s\" -> \"%s\";\n", $0, file
|
||||
}
|
||||
' $file
|
||||
done | sort
|
||||
end_nodelist
|
||||
fi
|
||||
|
||||
#
|
||||
# Print command-line shortcuts
|
||||
#
|
||||
if [ "$SHOW_CMDLINE" ]; then
|
||||
printf '\n\t/*\n\t * Command-line shortcuts\n\t */\n'
|
||||
shape=parallelogram color=black fillcolor=lightseagreen style=filled
|
||||
begin_nodelist "$shape" "$color" "$fillcolor" "$style"
|
||||
for file in */INDEX; do
|
||||
awk -v item="${file%%/*}" '
|
||||
/^menu_selection="/ {
|
||||
sub(/^.*="/, "")
|
||||
sub(/\|.*/, "")
|
||||
printf "\t\t\"bsdconfig %s\"", $0
|
||||
printf " [ label = \"%s\" ];\n", $0
|
||||
}
|
||||
' $file
|
||||
done
|
||||
end_nodelist
|
||||
fi
|
||||
|
||||
#
|
||||
# Print command-line shortcut relationships
|
||||
#
|
||||
if [ "$SHOW_CMDLINE" ]; then
|
||||
printf '\n\t/*\n\t * Command-line shortcut relationships\n\t */\n'
|
||||
shape=box color=black fillcolor=lightseagreen style=filled
|
||||
begin_nodelist "$shape" "$color" "$fillcolor" "$style"
|
||||
print_node edge "headport = w" "weight = 100.0"
|
||||
print_node edge "style = bold" "color = $fillcolor"
|
||||
for file in */INDEX; do
|
||||
awk -v item="${file%%/*}" \
|
||||
-v node_fillcolor="$node_fillcolor" \
|
||||
-v edge_color="$edge_color" \
|
||||
'
|
||||
/^menu_selection="/ {
|
||||
sub(/^.*="/, "")
|
||||
sub(/"$/, "")
|
||||
|
||||
if ( ! $0 ) next
|
||||
|
||||
split($0, menusel, "|")
|
||||
if ( menusel[2] !~ "^/" )
|
||||
sub(/^/, item "/", menusel[2])
|
||||
|
||||
printf "\t\t\"bsdconfig %s\" -> \"%s\";\n",
|
||||
menusel[1], menusel[2]
|
||||
}
|
||||
' $file
|
||||
done
|
||||
end_nodelist
|
||||
fi
|
||||
|
||||
#
|
||||
# Print clusters
|
||||
#
|
||||
bgcolor_bsdconfig="lightyellow"
|
||||
bgcolor_includes="gray98"
|
||||
bgcolor_menuitem="aliceblue"
|
||||
bgcolor_shortcuts="honeydew"
|
||||
printf '\n\t/*\n\t * Clusters\n\t */\n'
|
||||
printf '\tsubgraph "cluster_bsdconfig" {\n'
|
||||
printf '\t\tbgcolor = "%s";\n' "$bgcolor_bsdconfig"
|
||||
printf '\t\tlabel = "bsdconfig(8)";\n'
|
||||
printf '\t\ttooltip = "bsdconfig(8)";\n'
|
||||
print_node "bsdconfig"
|
||||
end_nodelist
|
||||
if [ "$SHOW_INCLUDES" ]; then
|
||||
for include_file in $include_file_list; do
|
||||
echo $include_file
|
||||
done | awk \
|
||||
-v bgcolor="$bgcolor_bsdconfig" \
|
||||
-v msg_subroutines="$msg_subroutines" \
|
||||
'
|
||||
BEGIN { created = 0 }
|
||||
function end_subgraph() { printf "\t};\n" }
|
||||
( $0 !~ "/" ) {
|
||||
if ( ! created )
|
||||
{
|
||||
printf "\tsubgraph \"%s\" {\n",
|
||||
"cluster_bsdconfig_includes"
|
||||
printf "\t\tbgcolor = \"%s\";\n", bgcolor
|
||||
printf "\t\tlabel = \"bsdconfig %s\";\n",
|
||||
msg_subroutines
|
||||
created++
|
||||
}
|
||||
printf "\t\t\"%s\";\n", $1
|
||||
}
|
||||
END { created && end_subgraph() }
|
||||
' # END-QUOTE
|
||||
|
||||
for include_file in $include_file_list; do
|
||||
echo $include_file
|
||||
done | awk -v msg_subroutines="$msg_subroutines" '
|
||||
BEGIN { created = 0 }
|
||||
function end_subgraph() { printf "\t};\n" }
|
||||
( $0 ~ "/" ) {
|
||||
include_dir_tmp = $1
|
||||
sub("/[^/]*$", "", include_dir_tmp)
|
||||
gsub(/[^[:alnum:]_]/, "_", include_dir_tmp)
|
||||
|
||||
if ( created && include_dir != include_dir_tmp )
|
||||
{
|
||||
end_subgraph()
|
||||
created = 0
|
||||
}
|
||||
|
||||
if ( ! created )
|
||||
{
|
||||
include_dir = include_dir_tmp
|
||||
printf "\tsubgraph \"cluster_%s_includes\" {\n",
|
||||
include_dir
|
||||
printf "\t\tbgcolor = \"thistle\";\n"
|
||||
printf "\t\tlabel = \"%s %s\";\n", include_dir,
|
||||
msg_subroutines
|
||||
created++
|
||||
}
|
||||
|
||||
printf "\t\t\"%s\";\n", $1
|
||||
}
|
||||
END { created && end_subgraph() }'
|
||||
fi
|
||||
for INDEX in */INDEX; do
|
||||
menu_title=
|
||||
menu_help=
|
||||
f_include_lang "$INDEX"
|
||||
|
||||
item="${INDEX%%/*}"
|
||||
printf '\tsubgraph "cluster_%s" {\n' "$item"
|
||||
|
||||
case "$item" in
|
||||
[0-9][0-9][0-9].*) bgcolor="$bgcolor_menuitem" ;;
|
||||
*) bgcolor="$bgcolor_shortcuts"
|
||||
esac
|
||||
printf '\t\tbgcolor = "%s";\n' "$bgcolor"
|
||||
if [ "$menu_title" ]; then
|
||||
printf '\t\tlabel = "%s\\n\\"%s\\"";\n' "$item" "$menu_title"
|
||||
else
|
||||
printf '\t\tlabel = "%s";\n' "$item"
|
||||
fi
|
||||
printf '\t\ttooltip = "%s";\n' "${menu_help:-$item}"
|
||||
|
||||
program_list=$(
|
||||
for program in \
|
||||
$menu_program_list \
|
||||
$submenu_program_list \
|
||||
$cmd_program_list \
|
||||
; do
|
||||
echo "$program"
|
||||
done | sort -u
|
||||
)
|
||||
for program in $program_list; do
|
||||
case "$program" in "$item"/*)
|
||||
print_node "$program" "label = \"${program#*/}\""
|
||||
esac
|
||||
done
|
||||
|
||||
if [ "$SHOW_INCLUDES" ]; then
|
||||
item_include_list=
|
||||
[ -d "$item/include" ] &&
|
||||
item_include_list=$( find "$item/include" -type f )
|
||||
item_include_list=$(
|
||||
for item_include in $item_include_list; do
|
||||
for include_file in $include_file_list; do
|
||||
[ "$item_include" = "$include_file" ] ||
|
||||
continue
|
||||
echo "$item_include"; break
|
||||
done
|
||||
done
|
||||
)
|
||||
if [ "$item_include_list" ]; then
|
||||
printf '\t\tsubgraph "cluster_%s_includes" {\n' "$item"
|
||||
printf '\t\t\tbgcolor = "%s";\n' "$bgcolor_includes"
|
||||
printf '\t\t\tlabel = "%s";\n' "$msg_includes"
|
||||
fi
|
||||
for item_include in $item_include_list; do
|
||||
printf '\t\t\t"%s";\n' "$item_include"
|
||||
done
|
||||
[ "$item_include_list" ] && printf '\t\t};\n'
|
||||
fi
|
||||
|
||||
if [ "$SHOW_CMDLINE" ]; then
|
||||
printf '\t\tsubgraph "cluster_%s_shortcuts" {\n' "$item"
|
||||
printf '\t\t\tbgcolor = "%s";\n' "$bgcolor_shortcuts"
|
||||
printf '\t\t\tlabel = "%s";\n' "$msg_shortcuts"
|
||||
awk '/^menu_selection="/ {
|
||||
sub(/^.*="/, "")
|
||||
sub(/\|.*/, "")
|
||||
printf "\t\t\t\"bsdconfig %s\";\n", $0
|
||||
}' "$INDEX"
|
||||
printf '\t\t};\n'
|
||||
fi
|
||||
|
||||
end_nodelist
|
||||
done
|
||||
|
||||
printf '\n}\n'
|
||||
|
||||
################################################################################
|
||||
# END
|
||||
################################################################################
|
6
bsdconfig/dot/include/Makefile
Normal file
6
bsdconfig/dot/include/Makefile
Normal file
@ -0,0 +1,6 @@
|
||||
# $FreeBSD$
|
||||
|
||||
FILESDIR= ${LIBEXECDIR}/bsdconfig/dot/include
|
||||
FILES= messages.subr
|
||||
|
||||
.include <bsd.prog.mk>
|
11
bsdconfig/dot/include/Makefile.depend
Normal file
11
bsdconfig/dot/include/Makefile.depend
Normal file
@ -0,0 +1,11 @@
|
||||
# $FreeBSD$
|
||||
# Autogenerated - do NOT edit!
|
||||
|
||||
DIRDEPS = \
|
||||
|
||||
|
||||
.include <dirdeps.mk>
|
||||
|
||||
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
|
||||
# local dependencies - needed for -jN in clean tree
|
||||
.endif
|
31
bsdconfig/dot/include/messages.subr
Normal file
31
bsdconfig/dot/include/messages.subr
Normal file
@ -0,0 +1,31 @@
|
||||
# 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$
|
||||
|
||||
msg_graph_label_with_command="bsdconfig(8)\\\ndot(1) output generated by \`\`%s''"
|
||||
msg_graph_label_with_command_and_date="bsdconfig(8)\\\ndot(1) output generated by \`\`%s'' on\\\n%s"
|
||||
msg_includes="Includes"
|
||||
msg_shortcuts="Shortcuts"
|
||||
msg_subroutines="Subroutines"
|
6
bsdconfig/examples/Makefile
Normal file
6
bsdconfig/examples/Makefile
Normal file
@ -0,0 +1,6 @@
|
||||
# $FreeBSD$
|
||||
|
||||
FILESDIR= ${SHAREDIR}/examples/bsdconfig
|
||||
FILES= add_some_packages.sh browse_packages_http.sh bsdconfigrc
|
||||
|
||||
.include <bsd.prog.mk>
|
11
bsdconfig/examples/Makefile.depend
Normal file
11
bsdconfig/examples/Makefile.depend
Normal file
@ -0,0 +1,11 @@
|
||||
# $FreeBSD$
|
||||
# Autogenerated - do NOT edit!
|
||||
|
||||
DIRDEPS = \
|
||||
|
||||
|
||||
.include <dirdeps.mk>
|
||||
|
||||
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
|
||||
# local dependencies - needed for -jN in clean tree
|
||||
.endif
|
13
bsdconfig/examples/add_some_packages.sh
Executable file
13
bsdconfig/examples/add_some_packages.sh
Executable file
@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD$
|
||||
#
|
||||
# This sample installs a short list of packages from the main HTTP site.
|
||||
#
|
||||
[ "$_SCRIPT_SUBR" ] || . /usr/share/bsdconfig/script.subr || exit 1
|
||||
nonInteractive=1
|
||||
_httpPath=http://pkg.freebsd.org
|
||||
mediaSetHTTP
|
||||
mediaOpen
|
||||
for package in wget bash rsync; do
|
||||
packageAdd
|
||||
done
|
32
bsdconfig/examples/browse_packages_http.sh
Executable file
32
bsdconfig/examples/browse_packages_http.sh
Executable file
@ -0,0 +1,32 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD$
|
||||
#
|
||||
# This sample downloads the package digests.txz and packagesite.txz files from
|
||||
# HTTP to /tmp (if they don't already exist) and then displays the package
|
||||
# configuration/management screen using the local files (resulting in faster
|
||||
# browsing of packages from-start since digests.txz/packagesite.txz can be
|
||||
# loaded from local media).
|
||||
#
|
||||
# NOTE: Packages cannot be installed unless staged to
|
||||
# /tmp/packages/$PKG_ABI/All
|
||||
#
|
||||
[ "$_SCRIPT_SUBR" ] || . /usr/share/bsdconfig/script.subr || exit 1
|
||||
nonInteractive=1
|
||||
f_musthavepkg_init # Make sure we have a usable pkg(8) with $PKG_ABI
|
||||
TMPDIR=/tmp
|
||||
PKGDIR=$TMPDIR/packages/$PKG_ABI
|
||||
[ -d "$PKGDIR" ] || mkdir -p "$PKGDIR" || exit 1
|
||||
for file in digests.txz packagesite.txz; do
|
||||
[ -s "$PKGDIR/$file" ] && continue
|
||||
if [ ! "$HTTP_INITIALIZED" ]; then
|
||||
_httpPath=http://pkg.freebsd.org
|
||||
mediaSetHTTP
|
||||
mediaOpen
|
||||
fi
|
||||
f_show_info "Downloading %s from\n %s" "$file" "$_httpPath"
|
||||
f_device_get device_media "/$PKG_ABI/latest/$file" > $PKGDIR/$file ||
|
||||
exit 1
|
||||
done
|
||||
_directoryPath=$TMPDIR
|
||||
mediaSetDirectory
|
||||
configPackages
|
42
bsdconfig/examples/bsdconfigrc
Normal file
42
bsdconfig/examples/bsdconfigrc
Normal file
@ -0,0 +1,42 @@
|
||||
# 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$
|
||||
|
||||
# This file allows you to customize the behavior of bsdconfig.
|
||||
# Copy it to your $HOME/.bsdconfigrc and edit to suit.
|
||||
|
||||
# Debugging aids for development
|
||||
#
|
||||
#debug=1
|
||||
#debugFile=$HOME/out
|
||||
#debugFile=+$HOME/out # includes debug to stdout
|
||||
|
||||
# Optionally override functions to be more verbose (like including the date)
|
||||
#
|
||||
# f_dprintf() {
|
||||
# local format="$1"; shift
|
||||
# printf "$(date):$pgm:$format\n" "$@" >> $HOME/out
|
||||
# }
|
7
bsdconfig/include/Makefile
Normal file
7
bsdconfig/include/Makefile
Normal file
@ -0,0 +1,7 @@
|
||||
# $FreeBSD$
|
||||
|
||||
FILESDIR= ${LIBEXECDIR}/bsdconfig/include
|
||||
FILES= bsdconfig.hlp media.hlp messages.subr network_device.hlp \
|
||||
options.hlp tcp.hlp usage.hlp
|
||||
|
||||
.include <bsd.prog.mk>
|
11
bsdconfig/include/Makefile.depend
Normal file
11
bsdconfig/include/Makefile.depend
Normal file
@ -0,0 +1,11 @@
|
||||
# $FreeBSD$
|
||||
# Autogenerated - do NOT edit!
|
||||
|
||||
DIRDEPS = \
|
||||
|
||||
|
||||
.include <dirdeps.mk>
|
||||
|
||||
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
|
||||
# local dependencies - needed for -jN in clean tree
|
||||
.endif
|
12
bsdconfig/include/bsdconfig.hlp
Normal file
12
bsdconfig/include/bsdconfig.hlp
Normal file
@ -0,0 +1,12 @@
|
||||
This menu allows you to configure your system after the installation
|
||||
process is complete. At the minimum, you should probably set the root
|
||||
password and the system time zone.
|
||||
|
||||
For extra goodies like bash, emacs, firefox, etc., you should look at
|
||||
the Packages item in this menu.
|
||||
|
||||
For setting the timezone after the system is installed, use the 'Time
|
||||
Zone' item in this menu.
|
||||
|
||||
For more information on the overall general system configuration, see
|
||||
the /etc/rc.conf and /etc/defaults/rc.conf files.
|
54
bsdconfig/include/media.hlp
Normal file
54
bsdconfig/include/media.hlp
Normal file
@ -0,0 +1,54 @@
|
||||
You can install from the following types of media:
|
||||
|
||||
CDROM requires one of the following supported CDROM drives:
|
||||
ATAPI - Any standard ATAPI CDROM drive hooked to
|
||||
a supported controller (see Hardware Guide).
|
||||
SCSI - Any standard SCSI CDROM drive hooked to
|
||||
a supported controller (see Hardware Guide).
|
||||
|
||||
|
||||
DOS A DOS primary partition with the required FreeBSD
|
||||
distribution files copied onto it (e.g. C:\FREEBSD\)
|
||||
|
||||
|
||||
UFS Assuming a disk or partition with an existing
|
||||
FreeBSD file system and distribution set on it,
|
||||
get the distribution files from there.
|
||||
|
||||
|
||||
Floppy Get distribution files from one or more DOS or UFS
|
||||
formatted floppies. Such floppies are assumed to
|
||||
contain the appropriate distribution pieces - see
|
||||
ABOUT.TXT for more information about making floppy
|
||||
distribution media.
|
||||
|
||||
|
||||
FTP Get the distribution files from an anonymous ftp server
|
||||
(you will be presented with a list). Please note that
|
||||
you may invoke FTP in "Active"/"Passive" auto-mode, or
|
||||
via an HTTP proxy.
|
||||
|
||||
By default, ftp(1) will automatically use the best mode
|
||||
for the server. Using an HTTP proxy is sometimes necessary
|
||||
for firewalls which block all FTP connections.
|
||||
|
||||
If you chose to enter your own URL in the FTP menu, please
|
||||
note that all paths are *relative* to the home directory
|
||||
of the user being logged in as. By default, this is the
|
||||
user "ftp" (anonymous ftp) but you may change this in the
|
||||
Options screen.
|
||||
|
||||
|
||||
HTTP Direct
|
||||
Get the distribution files directly from an HTTP server.
|
||||
|
||||
If you chose to enter your own URL in the HTTP Direct menu,
|
||||
please note that all paths are *relative* to the root
|
||||
directory of the web server.
|
||||
|
||||
|
||||
NFS Get the distribution files from an NFS server somewhere
|
||||
(make sure that permissions on the server allow this!).
|
||||
If this install method hangs on you or refuses to work
|
||||
properly, you may need to set some special options for
|
||||
your NFS server. See the Options screen for more details.
|
464
bsdconfig/include/messages.subr
Normal file
464
bsdconfig/include/messages.subr
Normal file
@ -0,0 +1,464 @@
|
||||
# Copyright (c) 2012 Ron McDowell
|
||||
# Copyright (c) 2012-2016 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$
|
||||
|
||||
field_password="Password:"
|
||||
field_username="Username:"
|
||||
hline_alnum_arrows_punc_tab_enter="Use alnum, arrows, punctuation, TAB or ENTER"
|
||||
hline_alnum_punc_tab_enter="Use alpha-numeric, punctuation, TAB or ENTER"
|
||||
hline_arrows_tab_enter="Press arrows, TAB or ENTER"
|
||||
hline_arrows_tab_punc_enter="Use arrows, TAB, punctuation, ENTER"
|
||||
hline_choose_help_for_more_information_on_media_types="Choose Help for more information on the various media types"
|
||||
msg_accept_continue="Accept/Continue"
|
||||
msg_accessibility_desc="Ports to help disabled users."
|
||||
msg_adding_package_as_a_dependency_from_media="Adding %s (as a dependency) from %s"
|
||||
msg_adding_package_from_media="Adding %s from %s"
|
||||
msg_afterstep_desc="Ports to support the AfterStep window manager."
|
||||
msg_all="All"
|
||||
msg_all_desc="All available packages in all categories."
|
||||
msg_always_try_sudo_when_run_as="Always try sudo(8) when run as %s"
|
||||
msg_an_unknown_error_occurred="An unknown error occurred"
|
||||
msg_arabic_desc="Ported software for Arab countries."
|
||||
msg_archivers_desc="Utilities for archiving and unarchiving data."
|
||||
msg_armenia="Armenia"
|
||||
msg_assume_network_is_already_configured="Running multi-user, assume that the network is already configured?"
|
||||
msg_assume_yes_to_all_non_critical_dialogs="Assume \"Yes\" answers to all non-critical dialogs"
|
||||
msg_astro_desc="Applications related to astronomy."
|
||||
msg_attempt_automatic_dhcp_configuration="Attempt automatic DHCP configuration of interfaces"
|
||||
msg_attempt_ipv6_configuration_of_interfaces="Attempt IPv6 configuration of interfaces"
|
||||
msg_attempting_to_update_repository_catalogue="Attempting to update repository catalogue from selected media."
|
||||
msg_audio_desc="Audio utilities - most require a supported sound card."
|
||||
msg_australia="Australia"
|
||||
msg_austria="Austria"
|
||||
msg_back="Back"
|
||||
msg_becoming_root_via_sudo="Becoming root via sudo(8)..."
|
||||
msg_benchmarks_desc="Utilities for measuring system performance."
|
||||
msg_biology_desc="Software related to biology."
|
||||
msg_bootstrapping_pkg="Bootstrapping pkg(8)..."
|
||||
msg_brazil="Brazil"
|
||||
msg_building_package_menus="Building package menu(s)..."
|
||||
msg_building_package_main_menu="Building package main menu..."
|
||||
msg_bulgaria="Bulgaria"
|
||||
msg_cad_desc="Computer Aided Design utilities."
|
||||
msg_canada="Canada"
|
||||
msg_cancel="Cancel"
|
||||
msg_cancel_exit="Cancel/Exit"
|
||||
msg_cannot_create_permission_denied="%s: cannot create %s: Permission denied"
|
||||
msg_cannot_edit_wireless_ssid="Cannot edit wireless configuration; no matches for\nSSID \`%s' in wpa_supplicants.conf(5)"
|
||||
msg_cannot_resolve_hostname="Cannot resolve \`%s'! Are you sure that your\nname server, gateway and network interface are correctly configured?"
|
||||
msg_cant_find_distribution="Warning: Can't find the \`%s' distribution on this\nFTP server. You may need to visit a different server for\nthe release you are trying to fetch or go to the Options\nmenu and set the release name to explicitly match what's\navailable on %s (or set to \"any\").\n\nWould you like to select another FTP server?"
|
||||
msg_cant_seem_to_write_out_resolv_conf="Can't seem to write out %s. Net cannot be used."
|
||||
msg_cant_start_wpa_supplicant="Can't start wpa_supplicant(8). Please create a wlan(4)\ninterface from the \`wlans' option after selecting your\nfavorite wireless adapter (i.e., %s)."
|
||||
msg_cd_dvd="CD/DVD"
|
||||
msg_cdrom="CDROM"
|
||||
msg_checking_access_to="Checking access to\n %s"
|
||||
msg_china="China"
|
||||
msg_chinese_desc="Ported software for the Chinese market."
|
||||
msg_choose_a_cd_dvd_type="Choose a CD/DVD type"
|
||||
msg_choose_a_dos_partition="Choose a DOS partition"
|
||||
msg_choose_a_floppy_drive="Choose a Floppy drive"
|
||||
msg_choose_a_ufs_partition="Choose a UFS partition"
|
||||
msg_choose_a_usb_drive="Choose a USB drive"
|
||||
msg_choose_installation_media="Choose Installation Media"
|
||||
msg_choose_installation_media_description="FreeBSD can be installed from a variety of different installation\nmedia, ranging from floppies to an Internet FTP server. If you're\ninstalling FreeBSD from a supported CD/DVD drive then this is generally\nthe best media to use if you have no overriding reason for using other\nmedia."
|
||||
msg_client_error="Client error, you could try an other server"
|
||||
msg_command_failed_rest_of_script_aborted="Command \`%s' failed - rest of script aborted."
|
||||
msg_comms_desc="Communications utilities."
|
||||
msg_configuration_for_interface="Configuration for Interface"
|
||||
msg_configured="Configured"
|
||||
msg_configured_lc="configured"
|
||||
msg_configured_ssids="Configured SSIDs"
|
||||
msg_converters_desc="Format conversion utilities."
|
||||
msg_could_not_unmount_the_cdrom_dvd="Could not unmount the CDROM/DVD from %s: %s"
|
||||
msg_could_not_unmount_the_dos_partition="Could not unmount the DOS partition from %s: %s"
|
||||
msg_could_not_unmount_the_nfs_partition="Could not unmount the NFS partition from %s: %s"
|
||||
msg_could_not_unmount_the_ufs_partition="Could not unmount the UFS partition from %s: %s"
|
||||
msg_couldnt_connect_to_ftp_server="Couldn't connect to FTP server"
|
||||
msg_couldnt_connect_to_proxy="Couldn't connect to proxy"
|
||||
msg_couldnt_connect_to_server="Couldn't connect to server"
|
||||
msg_couldnt_open_ftp_connection="Couldn't open FTP connection to %s:\n %s."
|
||||
msg_create_new="Create New"
|
||||
msg_created_path="Created %s"
|
||||
msg_czech_republic="Czech Republic"
|
||||
msg_databases_desc="Database software."
|
||||
msg_debugging="Debugging"
|
||||
msg_denmark="Denmark"
|
||||
msg_deskutils_desc="Various Desktop utilities."
|
||||
msg_destroy="Destroy"
|
||||
msg_details="Details"
|
||||
msg_devel_desc="Software development utilities and libraries."
|
||||
msg_device_is_not_configured="The %s device is not configured. You will need to do so\nin the Networking configuration menu before proceeding."
|
||||
msg_dhcp="DHCP"
|
||||
msg_dialog_mixedform_navigation_help="Use <up>/<down> arrows to navigate between fields, TAB to focus buttons, and Enter for OK/Cancel."
|
||||
msg_directory="Directory"
|
||||
msg_directory_not_found="%s: Directory not found."
|
||||
msg_directory_where_package_temporary_files_go="The directory where package temporary files should go"
|
||||
msg_discovered_ssids="Discovered SSIDs"
|
||||
msg_dns_desc="Domain Name Service tools."
|
||||
msg_docs_desc="Meta-ports for FreeBSD documentation."
|
||||
msg_done="Done"
|
||||
msg_dos="DOS"
|
||||
msg_editor="Editor"
|
||||
msg_editors_desc="Editors."
|
||||
msg_elisp_desc="Things related to Emacs Lisp."
|
||||
msg_emit_extra_debugging_output="Emit extra debugging output"
|
||||
msg_emulators_desc="Utilities for emulating other operating systems."
|
||||
msg_enlightenment_desc="Software for the Enlightenment Desktop Environment."
|
||||
msg_enter_a_fully_qualified_pathname_for_the_directory="Enter a fully qualified pathname for the directory\ncontaining the FreeBSD distribution files:"
|
||||
msg_enter_the_device_name_of_a_ufs_formatted_partition="Enter the device-name of a UFS formatted partition"
|
||||
msg_error="Error"
|
||||
msg_error_mounting_device="Error mounting %s on %s: %s"
|
||||
msg_error_mounting_floppy_device="Error mounting floppy %s (%s) on %s: %s"
|
||||
msg_error_mounting_usb_drive="Error mounting USB drive %s on %s: %s"
|
||||
msg_error_when_requesting_url="Error when requesting %s, you could try an other server"
|
||||
msg_estonia="Estonia"
|
||||
msg_exit="Exit"
|
||||
msg_exit_bsdconfig="Exit bsdconfig"
|
||||
msg_extra_options_to_ifconfig="Extra options to ifconfig (usually empty):"
|
||||
msg_failed_to_add_default_route="Failed to add a default route; please check your network configuration"
|
||||
msg_failed_to_reach_wpa_supplicant="Failed to reach wpa_supplicant: %s"
|
||||
msg_file_system="File System"
|
||||
msg_finance_desc="Monetary, financial and related applications."
|
||||
msg_finland="Finland"
|
||||
msg_floppy="Floppy"
|
||||
msg_forget_all="Forget All"
|
||||
msg_forget_all_confirm="WARNING! Are you really sure you want to forget all known networks\nby re-initializing wpa_supplicants.conf(5)? This cannot be undone."
|
||||
msg_forget_all_help="Reset wpa_supplicant(8) configuration, forgetting all known networks"
|
||||
msg_found="found"
|
||||
msg_france="France"
|
||||
msg_french_desc="Ported software for French countries."
|
||||
msg_ftp="FTP"
|
||||
msg_ftp_desc="FTP client and server utilities."
|
||||
msg_ftp_passive="FTP Passive"
|
||||
msg_ftp_username="FTP username"
|
||||
msg_generating_index_from_pkg_database="Generating INDEX from pkg(8) database\n(this can take a while)..."
|
||||
msg_geography_desc="Geography-related software."
|
||||
msg_german_desc="Ported software for Germanic countries."
|
||||
msg_germany="Germany"
|
||||
msg_gnome_desc="Components of the Gnome Desktop environment."
|
||||
msg_gnustep_desc="Software for GNUstep desktop environment."
|
||||
msg_graphics_desc="Graphics libraries and utilities."
|
||||
msg_greece="Greece"
|
||||
msg_hamradio_desc="Software for amateur radio."
|
||||
msg_haskell_desc="Software related to the Haskell language."
|
||||
msg_hebrew_desc="Ported software for Hebrew language."
|
||||
msg_help="Help"
|
||||
msg_host_name_including_domain="Host name (including domain)"
|
||||
msg_hostname_variable_not_set="WARNING: hostname variable not set and is a non-optional\nparameter. Please add this to your installation script\nor set the netInteractive variable (see bsdconfig man page)"
|
||||
msg_http_direct="HTTP Direct"
|
||||
msg_http_proxy="HTTP Proxy"
|
||||
msg_hungarian_desc="Ported software for the Hungarian market."
|
||||
msg_iceland="Iceland"
|
||||
msg_install_from_a_dos_partition="Install from a DOS partition"
|
||||
msg_install_from_a_floppy_disk_set="Install from a floppy disk set"
|
||||
msg_install_from_a_freebsd_cd_dvd="Install from a FreeBSD CD/DVD"
|
||||
msg_install_from_a_ufs_partition="Install from a UFS partition"
|
||||
msg_install_from_a_usb_drive="Install from a USB drive"
|
||||
msg_install_from_an_ftp_server="Install from an FTP server"
|
||||
msg_install_from_an_ftp_server_thru_firewall="Install from an FTP server through a firewall"
|
||||
msg_install_from_an_ftp_server_thru_proxy="Install from an FTP server through an HTTP proxy"
|
||||
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_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"
|
||||
msg_invalid_name_server_ip_address_specified="Invalid name server IP address specified"
|
||||
msg_invalid_netmask_value="Invalid netmask value"
|
||||
msg_invalid_nfs_path_specification="Invalid NFS path specification. Must be of the form:\nhost:/full/pathname/to/FreeBSD/distdir"
|
||||
msg_io_error_while_reading_in_the_package="I/O error while reading in the %s package."
|
||||
msg_io_or_format_error_on_index_file="I/O or format error on INDEX file.\nPlease verify media (or path to media) and try again."
|
||||
msg_ipv4_address="IPv4 Address"
|
||||
msg_ipv4_gateway="IPv4 Gateway"
|
||||
msg_ipv6="IPv6"
|
||||
msg_ipv6_desc="IPv6-related software."
|
||||
msg_ipv6_ready="IPv6 ready"
|
||||
msg_irc_desc="Internet Relay Chat utilities."
|
||||
msg_ireland="Ireland"
|
||||
msg_israel="Israel"
|
||||
msg_japan="Japan"
|
||||
msg_japanese_desc="Ported software for the Japanese market."
|
||||
msg_java_desc="Java language support."
|
||||
msg_kde_desc="Software for the K Desktop Environment."
|
||||
msg_kld_desc="Kernel loadable modules."
|
||||
msg_korea="Korea"
|
||||
msg_korean_desc="Ported software for the Korean market."
|
||||
msg_lang_desc="Computer languages."
|
||||
msg_latvia="Latvia"
|
||||
msg_length_of_specified_url_is_too_long="Length of specified URL is %u characters. Allowable maximum is %u."
|
||||
msg_linux_desc="Linux programs that can run under binary compatibility."
|
||||
msg_lisp_desc="Software related to the Lisp language."
|
||||
msg_lithuania="Lithuania"
|
||||
msg_loading_of_dependent_package_failed="Loading of dependent package %s failed"
|
||||
msg_loading_wireless_menu="Loading Wireless Menu..."
|
||||
msg_logging_in_to_user_at_host="Logging in to %s@%s.."
|
||||
msg_looking_for_keymap_files="Looking for keymap files..."
|
||||
msg_looking_up_host="Looking up host %s"
|
||||
msg_mail_desc="Electronic mail packages and utilities."
|
||||
msg_main_menu="Main Menu"
|
||||
msg_main_site="Main Site"
|
||||
msg_manually_connect="Manually Connect"
|
||||
msg_manually_connect_help="Connect to a wireless network that may be unlisted"
|
||||
msg_math_desc="Mathematical computation software."
|
||||
msg_mbone_desc="Applications and utilities for the MBONE."
|
||||
msg_media_timeout="Media Timeout"
|
||||
msg_media_type="Media Type"
|
||||
msg_menu_text="If you've already installed FreeBSD, you may use\nthis menu to customize it somewhat to suit your\nparticular configuration. Most importantly, you\ncan use the Packages utility to load extra '3rd\nparty' software not provided in the base\ndistributions."
|
||||
msg_misc_desc="Miscellaneous utilities."
|
||||
msg_missing_ftp_host_or_directory="Missing FTP host or directory specification. FTP media not initialized."
|
||||
msg_multimedia_desc="Multimedia software."
|
||||
msg_must_be_root_to_execute="%s: must be root to execute"
|
||||
msg_must_have_pkg_to_execute="%s: must have pkg(8) to execute"
|
||||
msg_must_specify_a_host_name_of_some_sort="Must specify a host name of some sort!"
|
||||
msg_name_server="Name server"
|
||||
msg_net_desc="Networking utilities."
|
||||
msg_net_device_init_failed="Net device init failed."
|
||||
msg_net_im_desc="Instant messaging software."
|
||||
msg_net_mgmt_desc="Network management tools."
|
||||
msg_net_p2p_desc="Peer to peer network applications."
|
||||
msg_netherlands="Netherlands"
|
||||
msg_netmask="Netmask"
|
||||
msg_network_configuration="Network Configuration"
|
||||
msg_network_interface_information_required="Network interface information required"
|
||||
msg_new_zealand="New Zealand"
|
||||
msg_news_desc="USENET News support software."
|
||||
msg_next_page="Next page"
|
||||
msg_nfailed_attempts="%u incorrect password attempts"
|
||||
msg_nfs="NFS"
|
||||
msg_nfs_secure="NFS Secure"
|
||||
msg_nfs_server_talks_only_on_a_secure_port="NFS server talks only on a secure port"
|
||||
msg_nfs_slow="NFS Slow"
|
||||
msg_nfs_tcp="NFS TCP"
|
||||
msg_nfs_version_3="NFS version 3"
|
||||
msg_no="No"
|
||||
msg_no_cd_dvd_devices_found="No CD/DVD devices found! Please check that your system's\nconfiguration is correct and that the CD/DVD drive is of a\nsupported type. For more information, consult the hardware\nguide in the Doc menu."
|
||||
msg_no_description_provided="No description provided"
|
||||
msg_no_dos_primary_partitions_found="No DOS primary partitions found! This installation method is unavailable"
|
||||
msg_no_floppy_devices_found="No floppy devices found! Please check that your system's configuration\nis correct. For more information, consult the hardware guide in the Doc\nmenu."
|
||||
msg_no_gateway_has_been_set="No gateway has been set. You will be unable to access hosts\nnot on your local network"
|
||||
msg_no_network_devices="No network devices available!"
|
||||
msg_no_package_name_passed_in_package_variable="No package name passed in package variable"
|
||||
msg_no_packages_were_selected_for_extraction="No packages were selected for extraction."
|
||||
msg_no_pkg_database_found="No pkg(8) database found!"
|
||||
msg_no_such_file_or_directory="%s: %s: No such file or directory"
|
||||
msg_no_usb_devices_found="No USB devices found (try Options/Re-scan Devices)"
|
||||
msg_no_username="No username provided!"
|
||||
msg_norway="Norway"
|
||||
msg_not_a_directory="%s: %s: Not a directory"
|
||||
msg_not_found="not found"
|
||||
msg_not_yet_set="not yet set"
|
||||
msg_ok="OK"
|
||||
msg_options="Options"
|
||||
msg_options_editor="Options Editor"
|
||||
msg_other="other"
|
||||
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"
|
||||
msg_package_was_added_successfully="Package %s was added successfully"
|
||||
msg_packages="packages"
|
||||
msg_page_of_npages="(Page %s of %s)"
|
||||
msg_palm_desc="Software support for the Palm(tm) series."
|
||||
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_pick_an_interface_to_destroy="Pick an interface to destroy"
|
||||
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_pkg_not_yet_installed_install_now="pkg(8) not yet installed. Install now?"
|
||||
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"
|
||||
msg_please_enter_password="Please enter your password for sudo(8):"
|
||||
msg_please_enter_the_address_of_the_http_proxy="Please enter the address of the HTTP proxy in this format:\n hostname:port (the ':port' is optional, default is 3128)"
|
||||
msg_please_enter_the_full_nfs_file_specification="Please enter the full NFS file specification for the remote\nhost and directory containing the FreeBSD distribution files.\nThis should be in the format: hostname:/some/freebsd/dir"
|
||||
msg_please_enter_the_password_for_this_user="Please enter the password for this user:"
|
||||
msg_please_enter_the_username_you_wish_to_login_as="Please enter the username you wish to login as:"
|
||||
msg_please_enter_username_password="Please enter a username and password for sudo(8):"
|
||||
msg_please_insert_floppy_containing="Please insert floppy containing %s in %s"
|
||||
msg_please_insert_floppy_in_drive="Please insert floppy in %s"
|
||||
msg_please_select_a_category_to_display="Please select a category to display."
|
||||
msg_please_select_a_cd_dvd_drive="FreeBSD can be installed directly from a CD/DVD containing a valid\nFreeBSD distribution. If you are seeing this menu it is because\nmore than one CD/DVD drive was found on your system. Please select\none of the following CD/DVD drives as your installation drive."
|
||||
msg_please_select_a_floppy_drive="You have more than one floppy drive. Please choose which drive\nyou would like to use."
|
||||
msg_please_select_a_freebsd_ftp_distribution_site="Please select a FreeBSD FTP distribution site"
|
||||
msg_please_select_a_freebsd_http_distribution_site="Please select a FreeBSD HTTP distribution site"
|
||||
msg_please_select_a_usb_drive="You have more than one USB drive. Please choose which drive\nyou would like to use."
|
||||
msg_please_select_dos_partition="FreeBSD can be installed directly from a DOS partition assuming,\nof course, that you have copied the relevant distributions into\nyour DOS partition before starting this installation. If this is\nnot the case then you should reboot DOS at this time and copy the\ndistributions you wish to install into a \"FREEBSD\" subdirectory\non one of your DOS partitions. Otherwise, please select the DOS\npartition containing the FreeBSD distribution files."
|
||||
msg_please_select_ethernet_device_to_configure="Please select the ethernet or PLIP device to configure."
|
||||
msg_please_select_the_site_closest_to_you_or_other="Please select the site closest to you or \"other\" if you'd like to\nspecify a different choice. Also note that not every site listed here\ncarries more than the base distribution kits. Only Primary sites are\nguaranteed to carry the full range of possible distributions."
|
||||
msg_please_select_ufs_partition="FreeBSD can be installed directly from another FreeBSD partition\nthat is UFS formatted assuming, of course, that you have copied\nthe relevant distributions into said partition before starting\ninstallation."
|
||||
msg_please_specify_a_temporary_directory="Please specify a temporary directory with lots of free space:"
|
||||
msg_please_specify_the_name_of_the_text_editor="Please specify the name of the text editor you wish to use:"
|
||||
msg_please_specify_the_number_of_seconds_to_wait="Please specify the number of seconds to wait for slow media:"
|
||||
msg_please_specify_the_release_you_wish_to_load="Please specify the release you wish to load or\n\"any\" for a generic release install:"
|
||||
msg_please_specify_url_of_a_freebsd_distribution="Please specify the URL of a FreeBSD distribution on a\nremote ftp site. This site must accept either anonymous\nftp or you should have set an ftp username and password\nin the Options screen.\n\nA URL looks like this: ftp://<hostname>/<path>\nWhere <path> is relative to the anonymous ftp directory or the\nhome directory of the user being logged in as."
|
||||
msg_please_specify_url_of_freebsd_http_distribution="Please specify the URL of a FreeBSD distribution on a\nremote http site.\nA URL looks like this: http://<hostname>/<path>"
|
||||
msg_poland="Poland"
|
||||
msg_polish_desc="Ported software for the Polish market."
|
||||
msg_ports_mgmt_desc="Utilities for managing ports and packages."
|
||||
msg_portuguese_desc="Ported software for the Portuguese market."
|
||||
msg_previous_page="Previous page"
|
||||
msg_previous_syntax_errors="%s: Not overwriting \`%s' due to previous syntax errors"
|
||||
msg_primary="Primary"
|
||||
msg_print_desc="Utilities for dealing with printing."
|
||||
msg_probing_devices_please_wait_this_can_take_a_while="Probing devices, please wait (this can take a while)..."
|
||||
msg_proceed="Proceed"
|
||||
msg_processing_selection="Processing selection..."
|
||||
msg_python_desc="Software related to the Python language."
|
||||
msg_quick_start_how_to_use_this_menu_system="Quick start - How to use this menu system"
|
||||
msg_reading_package_index_data="Reading package index data"
|
||||
msg_reinstall="Reinstall"
|
||||
msg_reinstall_desc="Mark this package for reinstall"
|
||||
msg_release_name="Release Name"
|
||||
msg_required_package_not_found="Warning: %s is a required package but was not found."
|
||||
msg_rerun_bsdconfig_initial_device_probe="Re-run bsdconfig initial device probe"
|
||||
msg_rescan_wireless="Rescan Wireless"
|
||||
msg_rescan_wireless_help="Scan for new wireless networks"
|
||||
msg_rescan_devices="Re-scan Devices"
|
||||
msg_reset="RESET!"
|
||||
msg_reset_all_values_to_startup_defaults="Reset all values to startup defaults"
|
||||
msg_return_to_previous_menu="Return to previous menu"
|
||||
msg_reuse_old_ftp_site_selection_values="Re-use old FTP site selection values?"
|
||||
msg_reuse_old_http_site_settings="Re-use old HTTP site settings?"
|
||||
msg_review="Review"
|
||||
msg_review_desc="Review/perform pending actions"
|
||||
msg_review_help="Install, Re-Install, or Un-install selected packages and dependencies"
|
||||
msg_reviewing_selected_packages="Reviewing %u selected packages:"
|
||||
msg_ruby_desc="Software related to the Ruby language."
|
||||
msg_rubygems_desc="Ports of RubyGems packages."
|
||||
msg_russia="Russia"
|
||||
msg_russian_desc="Ported software for the Russian market."
|
||||
msg_scanning_for_dhcp_servers="Scanning for DHCP servers..."
|
||||
msg_scanning_for_ra_servers="Scanning for RA servers..."
|
||||
msg_scanning_wireless_pausing="Scanning Wireless... (pausing for %i seconds)"
|
||||
msg_scheme_desc="Software related to the Scheme language."
|
||||
msg_science_desc="Scientific software."
|
||||
msg_secure_mode_requires_root="Secure-mode requires root-access!"
|
||||
msg_secure_mode_requires_x11="Secure-mode requires X11 (use \`-X')!"
|
||||
msg_security_desc="System security software."
|
||||
msg_select="Select"
|
||||
msg_select_a_site_thats_close="Select a site that's close!"
|
||||
msg_select_the_configuration_you_would_like="Select the configuration you would like to edit:\nAddional network information displayed in help line."
|
||||
msg_select_wlan_interfaces_for="Select wlan interfaces for %s:"
|
||||
msg_selected="selected"
|
||||
msg_server_error_when_requesting_url="Server error when requesting %s, you could try an other server"
|
||||
msg_shells_desc="Various shells (tcsh, bash, etc)."
|
||||
msg_show_all="Show All"
|
||||
msg_show_all_help="Show wireless networks without an SSID and all BSSIDs"
|
||||
msg_show_configured="Show Configured"
|
||||
msg_show_configured_help="Show networks configured in wpa_supplicants.conf(5)"
|
||||
msg_show_scan_results="Show Scan Results"
|
||||
msg_show_scan_results_help="Show wpa_cli(8) scan results"
|
||||
msg_skip="Skip"
|
||||
msg_slovak_republic="Slovak Republic"
|
||||
msg_slovenia="Slovenia"
|
||||
msg_sorry_invalid_url="Sorry, %s is an invalid URL!"
|
||||
msg_sorry_package_was_not_found_in_the_index="Sorry, package %s was not found in the INDEX."
|
||||
msg_sorry_try_again="Sorry, try again."
|
||||
msg_south_africa="South Africa"
|
||||
msg_spain="Spain"
|
||||
msg_spanish_desc="Ported software for the Spanish market."
|
||||
msg_specify_some_other_ftp_site="Specify some other ftp site by URL"
|
||||
msg_specify_some_other_http_site="Specify some other http site by URL"
|
||||
msg_sweden="Sweden"
|
||||
msg_switzerland="Switzerland"
|
||||
msg_sysutils_desc="Various system utilities."
|
||||
msg_taiwan="Taiwan"
|
||||
msg_tcl_desc="TCL and packages that depend on it."
|
||||
msg_textproc_desc="Text processing/search utilities."
|
||||
msg_the_current_installation_media_type="The current installation media type."
|
||||
msg_timeout_value_in_seconds_for_slow_media="Timeout value in seconds for slow media."
|
||||
msg_tk_desc="Tk and packages that depend on it."
|
||||
msg_try_dhcp_configuration="Do you want to try DHCP configuration of the interface?"
|
||||
msg_try_ipv6_configuration="Do you want to try IPv6 configuration of the interface?"
|
||||
msg_try_sudo_only_this_once="Try sudo(8) only this once"
|
||||
msg_ufs="UFS"
|
||||
msg_uk="UK"
|
||||
msg_ukraine="Ukraine"
|
||||
msg_ukrainian_desc="Ported software for the Ukrainian market."
|
||||
msg_unable_to_configure_device="Unable to configure the %s interface!\nThis installation method cannot be used."
|
||||
msg_unable_to_fetch_package_from_selected_media="Unable to fetch package %s from selected media.\nNo package add will be done."
|
||||
msg_unable_to_get_file_from_selected_media="Unable to get %s file from selected media.\n\nThis may be because the packages collection is not available\non the distribution media you've chosen, most likely an FTP site\nwithout the packages collection mirrored. Please verify that\nyour media, or your path to the media, is correct and try again."
|
||||
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_open="Unable to open %s"
|
||||
msg_unable_to_update_pkg_from_selected_media="Unable to update pkg(8) from selected media."
|
||||
msg_unconfigured="Unconfigured"
|
||||
msg_uninstall="Uninstall"
|
||||
msg_uninstall_desc="Mark this package for deletion"
|
||||
msg_uninstalling_package_waiting_for_pkg_delete="Uninstalling %s package - waiting for pkg-delete(8)"
|
||||
msg_unknown="unknown"
|
||||
msg_unknown_user="Unknown user: %s"
|
||||
msg_url_was_not_found="%s was not found,\nmaybe directory or release-version are wrong?"
|
||||
msg_usa="USA"
|
||||
msg_usage="Usage"
|
||||
msg_usb="USB"
|
||||
msg_use_defaults="Use Defaults"
|
||||
msg_use_nfs_version_3="Use NFS version 3"
|
||||
msg_use_tcp_protocol_for_nfs="Use TCP protocol for NFS"
|
||||
msg_user_disallowed="User disallowed: %s"
|
||||
msg_user_is_using_a_slow_pc_or_ethernet_card="User is using a slow PC or Ethernet card"
|
||||
msg_username_and_password_to_use="Username and password to use instead of anonymous"
|
||||
msg_using_interface="Using interface %s"
|
||||
msg_using_usb_device="Using USB device: %s"
|
||||
msg_vietnamese_desc="Ported software for the Vietnamese market."
|
||||
msg_view_set_various_media_options="View/Set various media options"
|
||||
msg_warning_no_wireless_devices="WARNING! No wireless devices found."
|
||||
msg_what_would_you_like_to_do_with="What would you like to do with %s?"
|
||||
msg_which_release_to_attempt_to_load="Which release to attempt to load from installation media"
|
||||
msg_which_text_editor_to_use="Which text editor to use during installation"
|
||||
msg_wireless_networks_text="Select an unmarked ([ ]) entry to join that network.\nSelect a marked ([X]) entry to edit that configuration."
|
||||
msg_windowmaker_desc="Ports to support the WindowMaker window manager."
|
||||
msg_wireless_network_configuration_for="Wireless network configuration for SSID \`%s'"
|
||||
msg_would_you_like_to_bring_interface_up="Would you like to bring the %s interface up right now?"
|
||||
msg_wpa_cli_ping_failed="wpa_cli(8) ping failed"
|
||||
msg_www_desc="Web utilities (browsers, HTTP servers, etc)."
|
||||
msg_x11_clocks_desc="X Window System based clocks."
|
||||
msg_x11_desc="X Window System based utilities."
|
||||
msg_x11_drivers_desc="X Window System drivers."
|
||||
msg_x11_fm_desc="X Window System based file managers."
|
||||
msg_x11_fonts_desc="X Window System fonts and font utilities."
|
||||
msg_x11_servers_desc="X Window System servers."
|
||||
msg_x11_themes_desc="X Window System themes."
|
||||
msg_x11_toolkits_desc="X Window System based development toolkits."
|
||||
msg_x11_wm_desc="X Window System window managers."
|
||||
msg_xfce_desc="Software related to the Xfce Desktop Environment."
|
||||
msg_yes="Yes"
|
||||
msg_yes_to_all="Yes to All"
|
||||
msg_you_are_not_root_but="You are not root but %s can use sudo(8).\nWhat would you like to do?"
|
||||
msg_you_may_remove_the_floppy="You may remove the floppy from %s"
|
||||
msg_youve_already_done_the_network_configuration="You've already done the network configuration once,\nwould you like to skip over it now?"
|
||||
msg_zope_desc="Software related to the Zope platform."
|
||||
tcplayout_extras_help="Any interface-specific options to ifconfig you would like to add"
|
||||
tcplayout_extras_help_for_plip="For PLIP configuration, you must enter the peer's IP address here."
|
||||
tcplayout_gateway_help="IPv4 address of host forwarding packets to non-local destinations"
|
||||
tcplayout_hostname_help="Your fully-qualified hostname, e.g. foo.example.com"
|
||||
tcplayout_ipaddr_help="The IPv4 address to be used for this interface"
|
||||
tcplayout_nameserver_help="IPv4 or IPv6 address of your local DNS server"
|
||||
tcplayout_netmask_help="The netmask for this interface, e.g. 255.255.255.0 for a class C network"
|
58
bsdconfig/include/network_device.hlp
Normal file
58
bsdconfig/include/network_device.hlp
Normal file
@ -0,0 +1,58 @@
|
||||
You can do network installations over 3 types of communications links:
|
||||
|
||||
Serial port: SLIP / PPP
|
||||
Parallel port: PLIP (laplink cable)
|
||||
Ethernet: A standard Ethernet controller (includes some
|
||||
PCMCIA networking cards).
|
||||
|
||||
SLIP support is rather primitive and limited primarily to directly
|
||||
connected links, such as a serial cable running between a laptop
|
||||
computer and another PC. The link must be hard-wired as the SLIP
|
||||
installation doesn't currently offer a dialing capability (that
|
||||
facility is offered by the PPP utility, which should be used in
|
||||
preference to SLIP whenever possible). When you choose the SLIP
|
||||
option, you'll be given the option of later editing the slattach
|
||||
command before it's run on the serial line. It is expected that
|
||||
you'll run slattach (or some equivalent command) on the other end of
|
||||
the link at that time and bring up the line. FreeBSD will then
|
||||
install itself at serial speeds of up to 115.2K/baud (the recommended
|
||||
speed for a hardwired cable).
|
||||
|
||||
If you're using a modem then PPP is almost certainly your only choice.
|
||||
Make sure that you have your service provider's information handy as
|
||||
you'll need to know it fairly early in the installation process. You
|
||||
will need to know your service provider's IP address, the IP address
|
||||
of your provider's DNS server, and possibly your own IP address unless
|
||||
your ISP supports dynamic negotiation, most do. If you do not choose
|
||||
a PAP or CHAP login you will also need to know how to use the various
|
||||
"AT commands" to dial the ISP with your particular brand of modem as
|
||||
the PPP dialer provides only a very simple terminal emulator and has no
|
||||
"modem capabilities database". If you choose a PAP or CHAP login you
|
||||
can simply enter `dial' (without the quotes) at the ppp prompt if your
|
||||
modem uses the Hayes compatible AT command set.
|
||||
|
||||
If a hard-wired connection to another FreeBSD (2.0R or later) machine
|
||||
is available, you might also consider installing over a "laplink"
|
||||
parallel port cable. The data rate over the parallel port is much
|
||||
higher than what is typically possible over a serial line, and speeds
|
||||
of over 50KB/sec are not uncommon.
|
||||
|
||||
Finally, for the fastest possible network installation, an Ethernet
|
||||
adaptor is always a good choice! FreeBSD supports most common PC
|
||||
Ethernet cards, a table of which is provided in the FreeBSD Hardware
|
||||
Guide (see the `Documentation' entry in the main menu). If you are
|
||||
using one of the supported PCMCIA Ethernet cards, also be sure that
|
||||
it's plugged in BEFORE the laptop is powered on! Sysinstall does not,
|
||||
unfortunately, currently support "hot insertion" of PCMCIA cards.
|
||||
|
||||
You will also need to know your IP address on the network, the
|
||||
"netmask" value for your address class, and the name of your machine.
|
||||
Your system administrator can tell you which values to use for your
|
||||
particular network setup. If you will be referring to other hosts by
|
||||
name rather than IP address, you'll also need a name server and
|
||||
possibly the address of a gateway (if you're using PPP, it's your
|
||||
provider's IP address) to use in talking to it. If you do not know
|
||||
the answers to all or most of these questions then you should really
|
||||
probably talk to your system administrator FIRST before trying this
|
||||
type of installation! Choosing the wrong IP address on a busy network
|
||||
will NOT make you popular with your systems administrator! :-)
|
115
bsdconfig/include/options.hlp
Normal file
115
bsdconfig/include/options.hlp
Normal file
@ -0,0 +1,115 @@
|
||||
The following options may be set from this screen.
|
||||
|
||||
NFS Secure: NFS server talks only on a secure port
|
||||
|
||||
This is most commonly used when talking to Sun workstations, which
|
||||
will not talk NFS over "non privileged" ports.
|
||||
|
||||
|
||||
NFS Slow: User is using a slow PC or Ethernet card
|
||||
|
||||
Use this option if you have a slow PC (386) or an Ethernet card
|
||||
with poor performance being "fed" by NFS on a higher-performance
|
||||
workstation. This will throttle the workstation back to prevent
|
||||
the PC from becoming swamped with data.
|
||||
|
||||
|
||||
NFS TCP: Use TCP for the NFS mount
|
||||
|
||||
This option can be used if your NFS server supports TCP
|
||||
connections; not all do! This may be useful if your NFS server
|
||||
is at a remote site in which case it may offer some additional
|
||||
stability.
|
||||
|
||||
|
||||
NFS version 3: Use NFS version 3
|
||||
|
||||
This option forces the use of NFS version 3 and is on by default.
|
||||
If your NFS server only supports NFS version 2, disable this option.
|
||||
|
||||
|
||||
Debugging: Turn on the extra debugging flag
|
||||
|
||||
This turns on a lot of extra noise in between dialogs (unless
|
||||
debugFile has been set, sending the data to a logfile instead).
|
||||
Optionally, if debugFile begins with a plus sign (`+'), output will
|
||||
occur both on standard output and to debugFile (minus leading plus).
|
||||
If your installation should fail for any reason, PLEASE turn this
|
||||
flag on when attempting to reproduce the problem. It will provide a
|
||||
lot of extra debugging at the failure point and may be very helpful
|
||||
to the developers in tracking such problems down!
|
||||
|
||||
|
||||
Yes To All: Assume "Yes" answers to all non-critical dialogs
|
||||
|
||||
This flag should be used with caution. It will essentially
|
||||
decide NOT to ask the user about any "boundary" conditions that
|
||||
might not constitute actual errors but may be warnings indicative
|
||||
of other problems. It's most useful to those who are doing unattended
|
||||
installs.
|
||||
|
||||
|
||||
DHCP: Enable DHCP configuration of interfaces
|
||||
|
||||
This option specifies whether DHCP configuration of interfaces
|
||||
may be attempted. The default setting is to interactively ask
|
||||
the user.
|
||||
|
||||
|
||||
IPv6: Enable IPv6 router solicitation configuration
|
||||
|
||||
This option specifies whether automatic configuration of IPv6
|
||||
interfaces may be attempted. This uses the router solicitation
|
||||
method of automatic configuration. The default setting is to
|
||||
interactively ask the user.
|
||||
|
||||
|
||||
FTP username: Specify username and password instead of anonymous.
|
||||
|
||||
By default, the installation attempts to log in as the
|
||||
anonymous user. If you wish to log in as someone else,
|
||||
specify the username and password with this option.
|
||||
|
||||
|
||||
Editor: Specify which screen editor to use.
|
||||
|
||||
At various points during the installation it may be necessary
|
||||
to customize some text file, at which point the user will be
|
||||
thrown unceremoniously into a screen editor. A relatively
|
||||
simplistic editor which shows its command set on-screen is
|
||||
selected by default, but UNIX purists may wish to change this
|
||||
setting to `/usr/bin/vi'.
|
||||
|
||||
|
||||
Release Name: Which release to attempt to load from installation media.
|
||||
|
||||
You should only change this option if you're really sure you know
|
||||
what you are doing! This will change the release name used by
|
||||
bsdconfig when fetching components of any distributions, and
|
||||
is a useful way of using a more recent installation boot floppy
|
||||
with an older release (say, on CDROM).
|
||||
|
||||
|
||||
Media Type: Which media type is being used.
|
||||
|
||||
This is mostly informational and indicates which media type (if any)
|
||||
was last selected in the Media menu. It's also a convenient short-cut
|
||||
to the media menu itself.
|
||||
|
||||
|
||||
Package Temp: Where package temporary files should go
|
||||
|
||||
Some packages, like emacs, can use a LOT of temporary space - up to
|
||||
20 or 30MB. If you are going to configure a small / directory and no
|
||||
separate /var (and hence a small /var/tmp), then you may wish to set
|
||||
this to point at another location (say, /usr/tmp).
|
||||
|
||||
|
||||
Re-scan Devices:
|
||||
|
||||
Reprobe the system for devices.
|
||||
|
||||
|
||||
Use Defaults: Use default values.
|
||||
|
||||
Reset all options back to their default values.
|
33
bsdconfig/include/tcp.hlp
Normal file
33
bsdconfig/include/tcp.hlp
Normal file
@ -0,0 +1,33 @@
|
||||
This screen allows you to set up your general network parameters
|
||||
(hostname, domain name, DNS server, etc) as well as the settings for a
|
||||
given interface (which was selected from the menu before this screen).
|
||||
|
||||
PLIP/SLIP users - please read through to the end of this doc!
|
||||
|
||||
The "options" field is kind of special (read: a hack :-):
|
||||
|
||||
Any valid options to ifconfig can be specified here, so if you need
|
||||
to do something "special" to get your interface working, then here
|
||||
is the place to do it.
|
||||
|
||||
If you're running SLIP or PLIP, you also need to use it for specifying
|
||||
the remote end of the link (simply type the foreign IP address in).
|
||||
In the specific case where you're running PLIP with a Linux host peer
|
||||
rather than a FreeBSD one, you also must add the "-link0" flag after the
|
||||
foreign address.
|
||||
|
||||
If you're dealing with an ethernet adaptor with multiple media
|
||||
connectors (e.g. AUI, 10BT, 10B2, etc), you can use this field to
|
||||
specify which one to use. Examples of valid strings include:
|
||||
|
||||
"media 10base5/AUI" - Select the AUI port.
|
||||
"media 10baseT/UTP" - Select the twisted pair port.
|
||||
"media 10base2/BNC" - Select the BNC connector.
|
||||
"media 100baseTX" - Select 100BaseT on a 100/10 dual adaptor.
|
||||
|
||||
If you have a wireless interface and must specify arguments such as a
|
||||
WEP key here, you may use something like:
|
||||
|
||||
"wepmode on wepkey 0xFEEDFACE"
|
||||
|
||||
When you're done with this form, select OK.
|
64
bsdconfig/include/usage.hlp
Normal file
64
bsdconfig/include/usage.hlp
Normal file
@ -0,0 +1,64 @@
|
||||
HOW TO USE THIS SYSTEM
|
||||
======================
|
||||
|
||||
[press the PageDown key to go to the next screen when you finish
|
||||
reading this one]
|
||||
|
||||
The following keys are recognized in most of the dialogs you'll
|
||||
encounter during this installation:
|
||||
|
||||
KEY ACTION
|
||||
--- ------
|
||||
SPACE Select or toggle the current item.
|
||||
ENTER Finish with a menu or item.
|
||||
UP ARROW Move to previous item (or up, in a text display box).
|
||||
DOWN ARROW Move to next item (or down, in a text display box).
|
||||
TAB Move to next item or group.
|
||||
RIGHT ARROW Move to next item or group (same as TAB).
|
||||
SHIFT-TAB Move to previous item or group.
|
||||
LEFT ARROW Move to previous item or group (same as SHIFT-TAB).
|
||||
PAGE UP In text display boxes, scrolls up one page.
|
||||
PAGE DOWN In text display boxes, scrolls down one page.
|
||||
F1 Display associated help text.
|
||||
|
||||
If you see small "^(-)" or "v(+)" symbols at the edges of a menu, it
|
||||
means that there are more items above or below the current one that
|
||||
aren't being shown (due to insufficient screen space). In text
|
||||
display boxes, the amount of text above the current point will be
|
||||
displayed as a percentage in the lower right corner. Using the
|
||||
Up/Down arrow keys will cause the object to scroll by line. The
|
||||
PageUp and PageDown keys will scroll by entire screens.
|
||||
|
||||
Selecting OK in a menu will confirm whatever action it's controlling.
|
||||
Selecting Cancel will cancel the operation and generally return you to
|
||||
the previous menu. Use TAB to move the cursor around and select the
|
||||
buttons.
|
||||
|
||||
Most screens offer a Help button - USE IT! It generally offers useful
|
||||
context-specific hints on what to do and if you're at all unsure about
|
||||
what to do at a given configuration menu, choose Help!
|
||||
|
||||
|
||||
SPECIAL FEATURES:
|
||||
=================
|
||||
|
||||
It is possible to select a menu item by typing the first character of
|
||||
its name, if unique. This will generally be an item number.
|
||||
|
||||
The console driver contains a scroll-back buffer for reviewing things
|
||||
that may have scrolled off the screen. To use scroll-back, press the
|
||||
"Scroll Lock" key on your keyboard and use the arrow or Page Up/Page
|
||||
Down keys to move through the saved text. To leave scroll-back mode,
|
||||
press the Scroll Lock key again. This feature is most useful for
|
||||
reading back through your boot messages (go ahead, try it now!) though
|
||||
it's also useful when dealing with sub-shells or other "expert modes"
|
||||
that don't use menus and tend to scroll their output off the top of
|
||||
the screen.
|
||||
|
||||
FreeBSD also supports multiple "virtual consoles" which you can use
|
||||
in order to have several active sessions at once. Use ALT-F<n> to
|
||||
switch between screens, where `F<n>' is the function key corresponding
|
||||
to the screen you wish to see. By default, the system comes with 8
|
||||
virtual consoles enabled - you can enable more by editing the
|
||||
/etc/ttys file and turning the "off" field to "on" in the relevant vty
|
||||
entries (up to 12).
|
57
bsdconfig/includes/INDEX
Normal file
57
bsdconfig/includes/INDEX
Normal file
@ -0,0 +1,57 @@
|
||||
# Copyright (c) 2013-2015 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"
|
||||
menu_selection="api|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=""
|
11
bsdconfig/includes/Makefile
Normal file
11
bsdconfig/includes/Makefile
Normal file
@ -0,0 +1,11 @@
|
||||
# $FreeBSD$
|
||||
|
||||
SUBDIR= include
|
||||
|
||||
FILESDIR= ${LIBEXECDIR}/bsdconfig/includes
|
||||
FILES= INDEX USAGE
|
||||
|
||||
SCRIPTSDIR= ${FILESDIR}
|
||||
SCRIPTS= includes.sh
|
||||
|
||||
.include <bsd.prog.mk>
|
11
bsdconfig/includes/Makefile.depend
Normal file
11
bsdconfig/includes/Makefile.depend
Normal file
@ -0,0 +1,11 @@
|
||||
# $FreeBSD$
|
||||
# Autogenerated - do NOT edit!
|
||||
|
||||
DIRDEPS = \
|
||||
|
||||
|
||||
.include <dirdeps.mk>
|
||||
|
||||
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
|
||||
# local dependencies - needed for -jN in clean tree
|
||||
.endif
|
71
bsdconfig/includes/USAGE
Normal file
71
bsdconfig/includes/USAGE
Normal 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
|
6
bsdconfig/includes/include/Makefile
Normal file
6
bsdconfig/includes/include/Makefile
Normal file
@ -0,0 +1,6 @@
|
||||
# $FreeBSD$
|
||||
|
||||
FILESDIR= ${LIBEXECDIR}/bsdconfig/includes/include
|
||||
FILES= messages.subr
|
||||
|
||||
.include <bsd.prog.mk>
|
11
bsdconfig/includes/include/Makefile.depend
Normal file
11
bsdconfig/includes/include/Makefile.depend
Normal file
@ -0,0 +1,11 @@
|
||||
# $FreeBSD$
|
||||
# Autogenerated - do NOT edit!
|
||||
|
||||
DIRDEPS = \
|
||||
|
||||
|
||||
.include <dirdeps.mk>
|
||||
|
||||
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
|
||||
# local dependencies - needed for -jN in clean tree
|
||||
.endif
|
28
bsdconfig/includes/include/messages.subr
Normal file
28
bsdconfig/includes/include/messages.subr
Normal 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':"
|
205
bsdconfig/includes/includes.sh
Executable file
205
bsdconfig/includes/includes.sh
Executable file
@ -0,0 +1,205 @@
|
||||
#!/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
|
||||
|
||||
f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" ipgm &&
|
||||
pgm="${ipgm:-$pgm}"
|
||||
|
||||
############################################################ 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)
|
||||
{
|
||||
k = nitems = 0;
|
||||
|
||||
# Copy src indices to dest and calculate array length
|
||||
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[1;31m%s[0m%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
|
||||
################################################################################
|
62
bsdconfig/mouse/INDEX
Normal file
62
bsdconfig/mouse/INDEX
Normal file
@ -0,0 +1,62 @@
|
||||
# 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 in the bsdconfig menu.
|
||||
#
|
||||
menu_title="Mouse"
|
||||
|
||||
#
|
||||
# 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="Configure the Mouse"
|
||||
|
||||
#
|
||||
# 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="mouse|mouse"
|
||||
menu_selection="mouse_enable|enable"
|
||||
menu_selection="mouse_type|type"
|
||||
menu_selection="mouse_port|port"
|
||||
menu_selection="mouse_flags|flags"
|
||||
menu_selection="mouse_disable|disable"
|
||||
|
||||
#
|
||||
# ------------ 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="mouse"
|
11
bsdconfig/mouse/Makefile
Normal file
11
bsdconfig/mouse/Makefile
Normal file
@ -0,0 +1,11 @@
|
||||
# $FreeBSD$
|
||||
|
||||
SUBDIR= include
|
||||
|
||||
FILESDIR= ${LIBEXECDIR}/bsdconfig/110.mouse
|
||||
FILES= INDEX USAGE
|
||||
|
||||
SCRIPTSDIR= ${FILESDIR}
|
||||
SCRIPTS= disable enable flags mouse port type
|
||||
|
||||
.include <bsd.prog.mk>
|
11
bsdconfig/mouse/Makefile.depend
Normal file
11
bsdconfig/mouse/Makefile.depend
Normal file
@ -0,0 +1,11 @@
|
||||
# $FreeBSD$
|
||||
# Autogenerated - do NOT edit!
|
||||
|
||||
DIRDEPS = \
|
||||
|
||||
|
||||
.include <dirdeps.mk>
|
||||
|
||||
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
|
||||
# local dependencies - needed for -jN in clean tree
|
||||
.endif
|
37
bsdconfig/mouse/USAGE
Normal file
37
bsdconfig/mouse/USAGE
Normal file
@ -0,0 +1,37 @@
|
||||
# Copyright (c) 2012-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]
|
||||
|
||||
OPTIONS:
|
||||
-d Provide lots of debugging info on standard-out when running.
|
||||
-D file Send debugging info to file. If file begins with a plus-sign
|
||||
debug info is sent to both standard-out and file (minus the
|
||||
leading plus).
|
||||
-h Print this 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).
|
97
bsdconfig/mouse/disable
Executable file
97
bsdconfig/mouse/disable
Executable file
@ -0,0 +1,97 @@
|
||||
#!/bin/sh
|
||||
#-
|
||||
# Copyright (c) 2012-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
|
||||
|
||||
BSDCFG_SHARE="/usr/share/bsdconfig"
|
||||
. $BSDCFG_SHARE/common.subr || exit 1
|
||||
f_dprintf "%s: loading includes..." "$0"
|
||||
f_include $BSDCFG_SHARE/dialog.subr
|
||||
f_include $BSDCFG_SHARE/mustberoot.subr
|
||||
f_include $BSDCFG_SHARE/sysrc.subr
|
||||
|
||||
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="110.mouse"
|
||||
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
|
||||
|
||||
f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" ipgm &&
|
||||
pgm="${ipgm:-$pgm}"
|
||||
|
||||
############################################################ CONFIGURATION
|
||||
|
||||
#
|
||||
# Location of moused(8) pidfile
|
||||
#
|
||||
MOUSED_PIDFILE=/var/run/moused.pid
|
||||
|
||||
############################################################ MAIN
|
||||
|
||||
# Incorporate rc-file if it exists
|
||||
[ -f "$HOME/.bsdconfigrc" ] && f_include "$HOME/.bsdconfigrc"
|
||||
|
||||
#
|
||||
# Process command-line arguments
|
||||
#
|
||||
while getopts h$GETOPTS_STDARGS flag; do
|
||||
case "$flag" in
|
||||
h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm" ;;
|
||||
esac
|
||||
done
|
||||
shift $(( $OPTIND - 1 ))
|
||||
|
||||
#
|
||||
# Initialize
|
||||
#
|
||||
f_dialog_title "$msg_mouse_disable"
|
||||
f_dialog_backtitle "${ipgm:+bsdconfig }$pgm"
|
||||
f_mustberoot_init
|
||||
|
||||
#
|
||||
# Stop the mouse daemon
|
||||
#
|
||||
if [ -r "$MOUSED_PIDFILE" ]; then
|
||||
f_eval_catch -dk pid "$0" cat 'cat "%s"' "$MOUSED_PIDFILE" &&
|
||||
f_isinteger "$pid" &&
|
||||
[ $pid -gt 0 ] &&
|
||||
f_eval_catch -d "$0" kill 'kill %s' $pid
|
||||
fi
|
||||
f_eval_catch "$0" f_sysrc_set 'f_sysrc_set moused_enable NO' || f_die
|
||||
f_eval_catch "$0" f_sysrc_set 'f_sysrc_set moused_type NO' || f_die
|
||||
f_eval_catch "$0" f_sysrc_delete 'f_sysrc_delete moused_port' || f_die
|
||||
f_eval_catch "$0" f_sysrc_delete 'f_sysrc_delete moused_flags' || f_die
|
||||
|
||||
#
|
||||
# Message box
|
||||
#
|
||||
f_dialog_title "$msg_message"
|
||||
f_dialog_msgbox "$msg_mouse_daemon_is_disabled" "$hline_press_enter_or_space"
|
||||
|
||||
exit $SUCCESS
|
||||
|
||||
################################################################################
|
||||
# END
|
||||
################################################################################
|
128
bsdconfig/mouse/enable
Executable file
128
bsdconfig/mouse/enable
Executable file
@ -0,0 +1,128 @@
|
||||
#!/bin/sh
|
||||
#-
|
||||
# Copyright (c) 2012-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
|
||||
|
||||
BSDCFG_SHARE="/usr/share/bsdconfig"
|
||||
. $BSDCFG_SHARE/common.subr || exit 1
|
||||
f_dprintf "%s: loading includes..." "$0"
|
||||
f_include $BSDCFG_SHARE/dialog.subr
|
||||
f_include $BSDCFG_SHARE/mustberoot.subr
|
||||
f_include $BSDCFG_SHARE/sysrc.subr
|
||||
|
||||
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="110.mouse"
|
||||
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
|
||||
|
||||
f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" ipgm &&
|
||||
pgm="${ipgm:-$pgm}"
|
||||
|
||||
############################################################ CONFIGURATION
|
||||
|
||||
#
|
||||
# Location of moused(8) pidfile
|
||||
#
|
||||
MOUSED_PIDFILE=/var/run/moused.pid
|
||||
|
||||
############################################################ MAIN
|
||||
|
||||
# Incorporate rc-file if it exists
|
||||
[ -f "$HOME/.bsdconfigrc" ] && f_include "$HOME/.bsdconfigrc"
|
||||
|
||||
#
|
||||
# Process command-line arguments
|
||||
#
|
||||
while getopts h$GETOPTS_STDARGS flag; do
|
||||
case "$flag" in
|
||||
h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm" ;;
|
||||
esac
|
||||
done
|
||||
shift $(( $OPTIND - 1 ))
|
||||
|
||||
#
|
||||
# Initialize
|
||||
#
|
||||
f_dialog_title "$msg_mouse_enable"
|
||||
f_dialog_backtitle "${ipgm:+bsdconfig }$pgm"
|
||||
f_mustberoot_init
|
||||
|
||||
#
|
||||
# Get the type, port, and flags
|
||||
#
|
||||
type=$( f_sysrc_get moused_type )
|
||||
case "$type" in
|
||||
[Nn][Oo]|"") f_die 1 "$msg_please_select_protocol_and_port_first" ;;
|
||||
esac
|
||||
port=$( f_sysrc_get moused_port )
|
||||
[ "$port" ] || f_die 1 "$msg_please_select_protocol_and_port_first"
|
||||
flags=$( f_sysrc_get moused_flags )
|
||||
|
||||
#
|
||||
# Start the mouse daemon
|
||||
#
|
||||
f_dialog_info "$msg_trying_to_start_the_mouse_daemon"
|
||||
if [ -r "$MOUSED_PIDFILE" ]; then
|
||||
f_eval_catch -dk pid "$0" cat 'cat "%s"' "$MOUSED_PIDFILE" &&
|
||||
f_isinteger "$pid" &&
|
||||
[ $pid -gt 0 ] &&
|
||||
f_eval_catch -d "$0" kill 'kill %s' $pid
|
||||
fi
|
||||
f_eval_catch -d "$0" vidcontrol 'vidcontrol -m on'
|
||||
f_eval_catch -d "$0" moused \
|
||||
'moused -t "%s" -p "%s" %s' "$type" "$port" "$flags"
|
||||
|
||||
#
|
||||
# Confirm with the user that the mouse is working
|
||||
#
|
||||
f_dialog_title "$msg_user_confirmation_requested"
|
||||
f_dialog_yesno "$msg_now_move_the_mouse"
|
||||
retval=$?
|
||||
f_dialog_title_restore
|
||||
|
||||
#
|
||||
# Stop the mouse daemon
|
||||
#
|
||||
f_eval_catch -d "$0" vidcontrol 'vidcontrol -m off'
|
||||
if [ $retval -eq $DIALOG_OK ]; then
|
||||
f_eval_catch "$0" f_sysrc_set 'f_sysrc_set moused_enable YES' || f_die
|
||||
f_eval_catch "$0" ln \
|
||||
'ln -fs /dev/sysmouse /dev/mouse' || f_die # backwards compat
|
||||
else
|
||||
if [ -r "$MOUSED_PIDFILE" ]; then
|
||||
f_eval_catch -dk pid "$0" cat 'cat "%s"' "$MOUSED_PIDFILE" &&
|
||||
f_isinteger "$pid" &&
|
||||
[ $pid -gt 0 ] &&
|
||||
f_eval_catch -d "$0" kill 'kill %s' $pid
|
||||
fi
|
||||
f_eval_catch "$0" f_sysrc_set 'f_sysrc_set moused_enable NO' || f_die
|
||||
fi
|
||||
|
||||
exit $SUCCESS
|
||||
|
||||
################################################################################
|
||||
# END
|
||||
################################################################################
|
95
bsdconfig/mouse/flags
Executable file
95
bsdconfig/mouse/flags
Executable file
@ -0,0 +1,95 @@
|
||||
#!/bin/sh
|
||||
#-
|
||||
# Copyright (c) 2012-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
|
||||
|
||||
BSDCFG_SHARE="/usr/share/bsdconfig"
|
||||
. $BSDCFG_SHARE/common.subr || exit 1
|
||||
f_dprintf "%s: loading includes..." "$0"
|
||||
f_include $BSDCFG_SHARE/dialog.subr
|
||||
f_include $BSDCFG_SHARE/mustberoot.subr
|
||||
f_include $BSDCFG_SHARE/sysrc.subr
|
||||
|
||||
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="110.mouse"
|
||||
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
|
||||
|
||||
f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" ipgm &&
|
||||
pgm="${ipgm:-$pgm}"
|
||||
|
||||
############################################################ CONFIGURATION
|
||||
|
||||
#
|
||||
# Location of moused(8) pidfile
|
||||
#
|
||||
MOUSED_PIDFILE=/var/run/moused.pid
|
||||
|
||||
############################################################ MAIN
|
||||
|
||||
# Incorporate rc-file if it exists
|
||||
[ -f "$HOME/.bsdconfigrc" ] && f_include "$HOME/.bsdconfigrc"
|
||||
|
||||
#
|
||||
# Process command-line arguments
|
||||
#
|
||||
while getopts h$GETOPTS_STDARGS flag; do
|
||||
case "$flag" in
|
||||
h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm" ;;
|
||||
esac
|
||||
done
|
||||
shift $(( $OPTIND - 1 ))
|
||||
|
||||
#
|
||||
# Initialize
|
||||
#
|
||||
f_dialog_title "$msg_mouse_flags"
|
||||
f_dialog_backtitle "${ipgm:+bsdconfig }$pgm"
|
||||
f_mustberoot_init
|
||||
|
||||
#
|
||||
# Get the current flags
|
||||
#
|
||||
flags=$( f_sysrc_get moused_flags )
|
||||
|
||||
#
|
||||
# Prompt the user with the current value
|
||||
#
|
||||
f_dialog_title "$msg_value_required"
|
||||
f_dialog_input flags "$msg_please_specify_the_mouse_daemon_flags" \
|
||||
"$flags" || f_die
|
||||
f_dialog_title_restore
|
||||
|
||||
#
|
||||
# Save the new value
|
||||
#
|
||||
f_eval_catch "$0" f_sysrc_set 'f_sysrc_set moused_flags "%s"' "$flags" || f_die
|
||||
|
||||
exit $SUCCESS
|
||||
|
||||
################################################################################
|
||||
# END
|
||||
################################################################################
|
6
bsdconfig/mouse/include/Makefile
Normal file
6
bsdconfig/mouse/include/Makefile
Normal file
@ -0,0 +1,6 @@
|
||||
# $FreeBSD$
|
||||
|
||||
FILESDIR= ${LIBEXECDIR}/bsdconfig/110.mouse/include
|
||||
FILES= messages.subr
|
||||
|
||||
.include <bsd.prog.mk>
|
11
bsdconfig/mouse/include/Makefile.depend
Normal file
11
bsdconfig/mouse/include/Makefile.depend
Normal file
@ -0,0 +1,11 @@
|
||||
# $FreeBSD$
|
||||
# Autogenerated - do NOT edit!
|
||||
|
||||
DIRDEPS = \
|
||||
|
||||
|
||||
.include <dirdeps.mk>
|
||||
|
||||
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
|
||||
# local dependencies - needed for -jN in clean tree
|
||||
.endif
|
91
bsdconfig/mouse/include/messages.subr
Normal file
91
bsdconfig/mouse/include/messages.subr
Normal file
@ -0,0 +1,91 @@
|
||||
# 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_press_enter_or_space="Press enter or space"
|
||||
msg_auto="Auto"
|
||||
msg_auto_desc="Bus mouse, PS/2 style mouse or PnP serial mouse"
|
||||
msg_cancel="Cancel"
|
||||
msg_com1="COM1"
|
||||
msg_com1_desc="Serial mouse on COM1 (/dev/cuau0)"
|
||||
msg_com2="COM2"
|
||||
msg_com2_desc="Serial mouse on COM2 (/dev/cuau1)"
|
||||
msg_com3="COM3"
|
||||
msg_com3_desc="Serial mouse on COM3 (/dev/cuau2)"
|
||||
msg_com4="COM4"
|
||||
msg_com4_desc="Serial mouse on COM4 (/dev/cuau3)"
|
||||
msg_disable="Disable"
|
||||
msg_disable_the_mouse_daemon="Disable the mouse daemon"
|
||||
msg_enable="Enable"
|
||||
msg_exit="Exit"
|
||||
msg_exit_this_menu="Exit this menu"
|
||||
msg_flags="Flags"
|
||||
msg_glidepoint="GlidePoint"
|
||||
msg_glidepoint_desc="ALPS GlidePoint pad (serial)"
|
||||
msg_hitachi="Hitachi"
|
||||
msg_hitachi_desc="Hitachi tablet (serial)"
|
||||
msg_intellimouse="IntelliMouse"
|
||||
msg_intellimouse_desc="Microsoft IntelliMouse (serial)"
|
||||
msg_logitech="Logitech"
|
||||
msg_logitech_desc="Logitech protocol (old models) (serial)"
|
||||
msg_menu_text="You can cut and paste text in the text console by running the mouse\ndaemon. Specify a port and a protocol type of your mouse and enable\nthe mouse daemon. If you don't want this feature, select 6 to disable\nthe daemon.\nOnce you've enabled the mouse daemon, you can specify \"/dev/sysmouse\"\nas your mouse device and \"SysMouse\" or \"MouseSystems\" as mouse\nprotocol when running the X configuration utility (see Configuration\nmenu)."
|
||||
msg_message="Message"
|
||||
msg_microsoft="Microsoft"
|
||||
msg_microsoft_desc="Microsoft protocol (serial)"
|
||||
msg_mm_series="MM Series"
|
||||
msg_mm_series_desc="MM Series 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"
|
||||
msg_please_select_protocol_and_port_first="Please select a mouse protocol and a port first."
|
||||
msg_please_specify_the_mouse_daemon_flags="Please specify the mouse daemon flags. If you would like to\nemulate 3 buttons, use -3 here.\n "
|
||||
msg_port="Port"
|
||||
msg_port_menu_text="The built-in pointing device of laptop/notebook computers is usually\na PS/2 style device."
|
||||
msg_protocol_menu_text="If your mouse is attached to the PS/2 mouse port or the bus mouse port,\nyou should always choose \"Auto\", regardless of the model and the brand\nof the mouse. All other protocol types are for serial mice and should\nnot be used with the PS/2 port mouse or the bus mouse. If you have\na serial mouse and are not sure about its protocol, you should also try\n\"Auto\". It may not work for the serial mouse if the mouse does not\nsupport the PnP standard. But, it won't hurt. Many 2-button serial mice\nare compatible with \"Microsoft\" or \"MouseMan\". 3-button serial mice\nmay be compatible with \"MouseSystems\" or \"MouseMan\". If the serial\nmouse has a wheel, it may be compatible with \"IntelliMouse\"."
|
||||
msg_ps2="PS/2"
|
||||
msg_ps2_desc="PS/2 style mouse (/dev/psm0)"
|
||||
msg_select_a_protocol_type_for_your_mouse="Select a protocol type for your mouse"
|
||||
msg_select_mouse_port="Select mouse port"
|
||||
msg_select_mouse_protocol_type="Select mouse protocol type"
|
||||
msg_select_your_mouse_port_from_the_following_menu="Select your mouse port from the following menu"
|
||||
msg_set_additional_flags="Set additional flags"
|
||||
msg_test_and_run_the_mouse_daemon="Test and run the mouse daemon"
|
||||
msg_thinkingmouse="ThinkingMouse"
|
||||
msg_thinkingmouse_desc="Kensington ThinkingMouse (serial)"
|
||||
msg_trying_to_start_the_mouse_daemon="Trying to start the mouse daemon..."
|
||||
msg_type="Type"
|
||||
msg_unknown_mouse_menu_selection="Unknown mouse menu selection"
|
||||
msg_unknown_mouse_port_selection="Unknown mouse port selection"
|
||||
msg_unknown_mouse_protocol_selection="Unknown mouse protocol selection"
|
||||
msg_user_confirmation_requested="User Confirmation Requested"
|
||||
msg_value_required="Value Required"
|
144
bsdconfig/mouse/mouse
Executable file
144
bsdconfig/mouse/mouse
Executable file
@ -0,0 +1,144 @@
|
||||
#!/bin/sh
|
||||
#-
|
||||
# Copyright (c) 2012-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
|
||||
|
||||
BSDCFG_SHARE="/usr/share/bsdconfig"
|
||||
. $BSDCFG_SHARE/common.subr || exit 1
|
||||
f_dprintf "%s: loading includes..." "$0"
|
||||
f_include $BSDCFG_SHARE/dialog.subr
|
||||
f_include $BSDCFG_SHARE/mustberoot.subr
|
||||
|
||||
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="110.mouse"
|
||||
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
|
||||
|
||||
f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" ipgm &&
|
||||
pgm="${ipgm:-$pgm}"
|
||||
|
||||
############################################################ FUNCTIONS
|
||||
|
||||
# dialog_menu_main
|
||||
#
|
||||
# Display the dialog(1)-based application main menu.
|
||||
#
|
||||
dialog_menu_main()
|
||||
{
|
||||
local prompt="$msg_menu_text"
|
||||
local menu_list="
|
||||
'X $msg_exit' '$msg_exit_this_menu'
|
||||
'2 $msg_enable' '$msg_test_and_run_the_mouse_daemon'
|
||||
'3 $msg_type' '$msg_select_mouse_protocol_type'
|
||||
'4 $msg_port' '$msg_select_mouse_port'
|
||||
'5 $msg_flags' '$msg_set_additional_flags'
|
||||
'6 $msg_disable' '$msg_disable_the_mouse_daemon'
|
||||
" # END-QUOTE
|
||||
local defaultitem= # Calculated below
|
||||
local hline=
|
||||
|
||||
local height width rows
|
||||
eval f_dialog_menu_size height width rows \
|
||||
\"\$DIALOG_TITLE\" \
|
||||
\"\$DIALOG_BACKTITLE\" \
|
||||
\"\$prompt\" \
|
||||
\"\$hline\" \
|
||||
$menu_list
|
||||
|
||||
# Obtain default-item from previously stored selection
|
||||
f_dialog_default_fetch defaultitem
|
||||
|
||||
local menu_choice
|
||||
menu_choice=$( eval $DIALOG \
|
||||
--title \"\$DIALOG_TITLE\" \
|
||||
--backtitle \"\$DIALOG_BACKTITLE\" \
|
||||
--hline \"\$hline\" \
|
||||
--ok-label \"\$msg_ok\" \
|
||||
--cancel-label \"\$msg_cancel\" \
|
||||
--default-item \"\$defaultitem\" \
|
||||
--menu \"\$prompt\" \
|
||||
$height $width $rows \
|
||||
$menu_list \
|
||||
2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD
|
||||
)
|
||||
local retval=$?
|
||||
f_dialog_data_sanitize menu_choice
|
||||
f_dialog_menutag_store "$menu_choice"
|
||||
f_dialog_default_store "$menu_choice"
|
||||
return $retval
|
||||
}
|
||||
|
||||
############################################################ MAIN
|
||||
|
||||
# Incorporate rc-file if it exists
|
||||
[ -f "$HOME/.bsdconfigrc" ] && f_include "$HOME/.bsdconfigrc"
|
||||
|
||||
#
|
||||
# Process command-line arguments
|
||||
#
|
||||
while getopts h$GETOPTS_STDARGS flag; do
|
||||
case "$flag" in
|
||||
h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm" ;;
|
||||
esac
|
||||
done
|
||||
shift $(( $OPTIND - 1 ))
|
||||
|
||||
#
|
||||
# Initialize
|
||||
#
|
||||
f_dialog_title "$msg_please_configure_your_mouse"
|
||||
f_dialog_backtitle "${ipgm:+bsdconfig }$pgm"
|
||||
f_mustberoot_init
|
||||
|
||||
#
|
||||
# Launch application main menu
|
||||
#
|
||||
while :; do
|
||||
dialog_menu_main || f_die
|
||||
f_dialog_menutag_fetch mtag
|
||||
|
||||
command=
|
||||
case "$mtag" in
|
||||
"X $msg_exit") break ;;
|
||||
"2 $msg_enable") command=enable ;; # Test and run the mouse daemon
|
||||
"3 $msg_type") command=type ;; # Select mouse protocol type
|
||||
"4 $msg_port") command=port ;; # Select mouse port
|
||||
"5 $msg_flags") command=flags ;; # Set additional flags
|
||||
"6 $msg_disable") command=disable ;; # Disable the mouse daemon
|
||||
esac
|
||||
|
||||
if [ "$command" ]; then
|
||||
$BSDCFG_LIBE/$APP_DIR/$command ${USE_XDIALOG:+-X}
|
||||
else
|
||||
f_die 1 "$msg_unknown_mouse_menu_selection"
|
||||
fi
|
||||
done
|
||||
|
||||
exit $SUCCESS
|
||||
|
||||
################################################################################
|
||||
# END
|
||||
################################################################################
|
150
bsdconfig/mouse/port
Executable file
150
bsdconfig/mouse/port
Executable file
@ -0,0 +1,150 @@
|
||||
#!/bin/sh
|
||||
#-
|
||||
# Copyright (c) 2012-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
|
||||
|
||||
BSDCFG_SHARE="/usr/share/bsdconfig"
|
||||
. $BSDCFG_SHARE/common.subr || exit 1
|
||||
f_dprintf "%s: loading includes..." "$0"
|
||||
f_include $BSDCFG_SHARE/dialog.subr
|
||||
f_include $BSDCFG_SHARE/mustberoot.subr
|
||||
f_include $BSDCFG_SHARE/sysrc.subr
|
||||
|
||||
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="110.mouse"
|
||||
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
|
||||
|
||||
f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" ipgm &&
|
||||
pgm="${ipgm:-$pgm}"
|
||||
|
||||
############################################################ FUNCTIONS
|
||||
|
||||
# dialog_menu_main
|
||||
#
|
||||
# Display the dialog(1)-based application main menu.
|
||||
#
|
||||
dialog_menu_main()
|
||||
{
|
||||
local prompt="$msg_port_menu_text"
|
||||
local menu_list="
|
||||
'1 $msg_ps2' '$msg_ps2_desc'
|
||||
'2 $msg_com1' '$msg_com1_desc'
|
||||
'3 $msg_com2' '$msg_com2_desc'
|
||||
'4 $msg_com3' '$msg_com3_desc'
|
||||
'5 $msg_com4' '$msg_com4_desc'
|
||||
" # END-QUOTE
|
||||
local defaultitem= # Calculated below
|
||||
local hline=
|
||||
|
||||
local height width rows
|
||||
eval f_dialog_menu_size height width rows \
|
||||
\"\$DIALOG_TITLE\" \
|
||||
\"\$DIALOG_BACKTITLE\" \
|
||||
\"\$prompt\" \
|
||||
\"\$hline\" \
|
||||
$menu_list
|
||||
|
||||
case "$( f_sysrc_get moused_port )" in
|
||||
/dev/psm0) defaultitem="1 $msg_ps2" ;;
|
||||
/dev/cuau0) defaultitem="2 $msg_com1" ;;
|
||||
/dev/cuau1) defaultitem="3 $msg_com2" ;;
|
||||
/dev/cuau2) defaultitem="4 $msg_com3" ;;
|
||||
/dev/cuau3) defaultitem="5 $msg_com4" ;;
|
||||
esac
|
||||
|
||||
local menu_choice
|
||||
menu_choice=$( eval $DIALOG \
|
||||
--title \"\$DIALOG_TITLE\" \
|
||||
--backtitle \"\$DIALOG_BACKTITLE\" \
|
||||
--hline \"\$hline\" \
|
||||
--ok-label \"\$msg_ok\" \
|
||||
--cancel-label \"\$msg_cancel\" \
|
||||
--default-item \"\$defaultitem\" \
|
||||
--menu \"\$prompt\" \
|
||||
$height $width $rows \
|
||||
$menu_list \
|
||||
2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD
|
||||
)
|
||||
local retval=$?
|
||||
f_dialog_menutag_store -s "$menu_choice"
|
||||
return $retval
|
||||
}
|
||||
|
||||
############################################################ MAIN
|
||||
|
||||
# Incorporate rc-file if it exists
|
||||
[ -f "$HOME/.bsdconfigrc" ] && f_include "$HOME/.bsdconfigrc"
|
||||
|
||||
#
|
||||
# Process command-line arguments
|
||||
#
|
||||
while getopts h$GETOPTS_STDARGS flag; do
|
||||
case "$flag" in
|
||||
h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm" ;;
|
||||
esac
|
||||
done
|
||||
shift $(( $OPTIND - 1 ))
|
||||
|
||||
#
|
||||
# Initialize
|
||||
#
|
||||
f_dialog_title "$msg_select_your_mouse_port_from_the_following_menu"
|
||||
f_dialog_backtitle "${ipgm:+bsdconfig }$pgm"
|
||||
f_mustberoot_init
|
||||
|
||||
#
|
||||
# Launch application main menu
|
||||
#
|
||||
dialog_menu_main || f_die
|
||||
f_dialog_menutag_fetch mtag
|
||||
|
||||
moused_port_to_set=
|
||||
case "$mtag" in
|
||||
"1 $msg_ps2") # PS/2 style mouse (/dev/psm0)
|
||||
moused_port_to_set="/dev/psm0" ;;
|
||||
"2 $msg_com1") # Serial mouse on COM1 (/dev/cuau0)
|
||||
moused_port_to_set="/dev/cuau0" ;;
|
||||
"3 $msg_com2") # Serial mouse on COM2 (/dev/cuau1)
|
||||
moused_port_to_set="/dev/cuau1" ;;
|
||||
"4 $msg_com3") # Serial mouse on COM3 (/dev/cuau2)
|
||||
moused_port_to_set="/dev/cuau2" ;;
|
||||
"5 $msg_com4") # Serial mouse on COM4 (/dev/cuau3)
|
||||
moused_port_to_set="/dev/cuau3" ;;
|
||||
esac
|
||||
|
||||
if [ "$moused_port_to_set" ]; then
|
||||
f_eval_catch "$0" f_sysrc_set \
|
||||
'f_sysrc_set moused_port "%s"' "$moused_port_to_set" || f_die
|
||||
else
|
||||
f_die 1 "$msg_unknown_mouse_port_selection"
|
||||
fi
|
||||
|
||||
exit $SUCCESS
|
||||
|
||||
################################################################################
|
||||
# END
|
||||
################################################################################
|
170
bsdconfig/mouse/type
Executable file
170
bsdconfig/mouse/type
Executable file
@ -0,0 +1,170 @@
|
||||
#!/bin/sh
|
||||
#-
|
||||
# Copyright (c) 2012-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
|
||||
|
||||
BSDCFG_SHARE="/usr/share/bsdconfig"
|
||||
. $BSDCFG_SHARE/common.subr || exit 1
|
||||
f_dprintf "%s: loading includes..." "$0"
|
||||
f_include $BSDCFG_SHARE/dialog.subr
|
||||
f_include $BSDCFG_SHARE/mustberoot.subr
|
||||
f_include $BSDCFG_SHARE/sysrc.subr
|
||||
|
||||
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="110.mouse"
|
||||
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
|
||||
|
||||
f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" ipgm &&
|
||||
pgm="${ipgm:-$pgm}"
|
||||
|
||||
############################################################ FUNCTIONS
|
||||
|
||||
# dialog_menu_main
|
||||
#
|
||||
# Display the dialog(1)-based application main menu.
|
||||
#
|
||||
dialog_menu_main()
|
||||
{
|
||||
local prompt="$msg_protocol_menu_text"
|
||||
local menu_list="
|
||||
'1 $msg_auto' '$msg_auto_desc'
|
||||
'2 $msg_glidepoint' '$msg_glidepoint_desc'
|
||||
'3 $msg_hitachi' '$msg_hitachi_desc'
|
||||
'4 $msg_intellimouse' '$msg_intellimouse_desc'
|
||||
'5 $msg_logitech' '$msg_logitech_desc'
|
||||
'6 $msg_microsoft' '$msg_microsoft_desc'
|
||||
'7 $msg_mm_series' '$msg_mm_series_desc'
|
||||
'8 $msg_mouseman' '$msg_mouseman_desc'
|
||||
'9 $msg_mousesystems' '$msg_mousesystems_desc'
|
||||
'A $msg_thinkingmouse' '$msg_thinkingmouse_desc'
|
||||
" # END-QUOTE
|
||||
local defaultitem= # Calculated below
|
||||
local hline=
|
||||
|
||||
local height width rows
|
||||
eval f_dialog_menu_size height width rows \
|
||||
\"\$DIALOG_TITLE\" \
|
||||
\"\$DIALOG_BACKTITLE\" \
|
||||
\"\$prompt\" \
|
||||
\"\$hline\" \
|
||||
$menu_list
|
||||
|
||||
case "$( f_sysrc_get moused_type )" in
|
||||
auto) defaultitem="1 $msg_auto" ;;
|
||||
glidepoint) defaultitem="2 $msg_glidepoint" ;;
|
||||
mmhittab) defaultitem="3 $msg_hitachi" ;;
|
||||
intellimouse) defaultitem="4 $msg_intellimouse" ;;
|
||||
logitech) defaultitem="5 $msg_logitech" ;;
|
||||
microsoft) defaultitem="6 $msg_microsoft" ;;
|
||||
mmseries) defaultitem="7 $msg_mm_series" ;;
|
||||
mouseman) defaultitem="8 $msg_mouseman" ;;
|
||||
mousesystems) defaultitem="9 $msg_mousesystems" ;;
|
||||
thinkingmouse) defaultitem="A $msg_thinkingmouse" ;;
|
||||
esac
|
||||
|
||||
local menu_choice
|
||||
menu_choice=$( eval $DIALOG \
|
||||
--title \"\$DIALOG_TITLE\" \
|
||||
--backtitle \"\$DIALOG_BACKTITLE\" \
|
||||
--hline \"\$hline\" \
|
||||
--ok-label \"\$msg_ok\" \
|
||||
--cancel-label \"\$msg_cancel\" \
|
||||
--default-item \"\$defaultitem\" \
|
||||
--menu \"\$prompt\" \
|
||||
$height $width $rows \
|
||||
$menu_list \
|
||||
2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD
|
||||
)
|
||||
local retval=$?
|
||||
f_dialog_menutag_store -s "$menu_choice"
|
||||
return $retval
|
||||
}
|
||||
|
||||
############################################################ MAIN
|
||||
|
||||
# Incorporate rc-file if it exists
|
||||
[ -f "$HOME/.bsdconfigrc" ] && f_include "$HOME/.bsdconfigrc"
|
||||
|
||||
#
|
||||
# Process command-line arguments
|
||||
#
|
||||
while getopts h$GETOPTS_STDARGS flag; do
|
||||
case "$flag" in
|
||||
h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm" ;;
|
||||
esac
|
||||
done
|
||||
shift $(( $OPTIND - 1 ))
|
||||
|
||||
#
|
||||
# Initialize
|
||||
#
|
||||
f_dialog_title "$msg_select_a_protocol_type_for_your_mouse"
|
||||
f_dialog_backtitle "${ipgm:+bsdconfig }$pgm"
|
||||
f_mustberoot_init
|
||||
|
||||
#
|
||||
# Launch application main menu
|
||||
#
|
||||
dialog_menu_main || f_die
|
||||
f_dialog_menutag_fetch mtag
|
||||
|
||||
moused_type_to_set=
|
||||
case "$mtag" in
|
||||
"1 $msg_auto") # Bus mouse, PS/2 style mouse or PnP serial mouse
|
||||
moused_type_to_set="auto" ;;
|
||||
"2 $msg_glidepoint") # ALPS GlidePoint pad (serial)
|
||||
moused_type_to_set="glidepoint" ;;
|
||||
"3 $msg_hitachi") # Hitachi tablet (serial)
|
||||
moused_type_to_set="mmhittab" ;;
|
||||
"4 $msg_intellimouse") # Microsoft Intellimouse (serial)
|
||||
moused_type_to_set="intellimouse" ;;
|
||||
"5 $msg_logitech") # Logitech protocol (old models) (serial)
|
||||
moused_type_to_set="logitech" ;;
|
||||
"6 $msg_microsoft") # Microsoft protocol (serial)
|
||||
moused_type_to_set="microsoft" ;;
|
||||
"7 $msg_mm_series") # MM Series protocol (serial)
|
||||
moused_type_to_set="mmseries" ;;
|
||||
"8 $msg_mouseman") # Logitech MouseMan/TrackMan models (serial)
|
||||
moused_type_to_set="mouseman" ;;
|
||||
"9 $msg_mousesystems") # MouseSystems protocol (serial)
|
||||
moused_type_to_set="mousesystems" ;;
|
||||
"A $msg_thinkingmouse") # Kensignton ThinkingMouse (serial)
|
||||
moused_type_to_set="thinkingmouse" ;;
|
||||
esac
|
||||
|
||||
if [ "$moused_type_to_set" ]; then
|
||||
f_eval_catch "$0" f_sysrc_set \
|
||||
'f_sysrc_set moused_type "%s"' "$moused_type_to_set" || f_die
|
||||
else
|
||||
f_die 1 "$msg_unknown_mouse_protocol_selection"
|
||||
fi
|
||||
|
||||
exit $SUCCESS
|
||||
|
||||
################################################################################
|
||||
# END
|
||||
################################################################################
|
64
bsdconfig/networking/INDEX
Normal file
64
bsdconfig/networking/INDEX
Normal file
@ -0,0 +1,64 @@
|
||||
# Copyright (c) 2012 Ron McDowell
|
||||
# Copyright (c) 2012-2016 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="Networking Management"
|
||||
|
||||
#
|
||||
# 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="Setup Networking interfaces, services, etc."
|
||||
|
||||
#
|
||||
# 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="networking|networking"
|
||||
menu_selection="defaultrouter|defaultrouter"
|
||||
menu_selection="hostname|hostname"
|
||||
menu_selection="nameservers|nameservers"
|
||||
menu_selection="netdev|devices"
|
||||
menu_selection="wireless|wlanconfig"
|
||||
menu_selection="wlan|wlanconfig"
|
||||
menu_selection="wifi|wlanconfig"
|
||||
|
||||
#
|
||||
# ------------ 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="networking"
|
12
bsdconfig/networking/Makefile
Normal file
12
bsdconfig/networking/Makefile
Normal file
@ -0,0 +1,12 @@
|
||||
# $FreeBSD$
|
||||
|
||||
SUBDIR= include share
|
||||
|
||||
FILESDIR= ${LIBEXECDIR}/bsdconfig/120.networking
|
||||
FILES= INDEX USAGE
|
||||
|
||||
SCRIPTSDIR= ${FILESDIR}
|
||||
SCRIPTS= defaultrouter devices hostname nameservers networking \
|
||||
wlanconfig
|
||||
|
||||
.include <bsd.prog.mk>
|
11
bsdconfig/networking/Makefile.depend
Normal file
11
bsdconfig/networking/Makefile.depend
Normal file
@ -0,0 +1,11 @@
|
||||
# $FreeBSD$
|
||||
# Autogenerated - do NOT edit!
|
||||
|
||||
DIRDEPS = \
|
||||
|
||||
|
||||
.include <dirdeps.mk>
|
||||
|
||||
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
|
||||
# local dependencies - needed for -jN in clean tree
|
||||
.endif
|
37
bsdconfig/networking/USAGE
Normal file
37
bsdconfig/networking/USAGE
Normal file
@ -0,0 +1,37 @@
|
||||
# Copyright (c) 2006-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]
|
||||
|
||||
OPTIONS:
|
||||
-d Provide lots of debugging info on standard-out when running.
|
||||
-D file Send debugging info to file. If file begins with a plus-sign
|
||||
debug info is sent to both standard-out and file (minus the
|
||||
leading plus).
|
||||
-h Print this 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).
|
76
bsdconfig/networking/defaultrouter
Executable file
76
bsdconfig/networking/defaultrouter
Executable file
@ -0,0 +1,76 @@
|
||||
#!/bin/sh
|
||||
#-
|
||||
# Copyright (c) 2006-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 device.subr (included indirectly) from auto scanning on load
|
||||
DEVICE_SELF_SCAN_ALL=NO
|
||||
|
||||
BSDCFG_SHARE="/usr/share/bsdconfig"
|
||||
. $BSDCFG_SHARE/common.subr || exit 1
|
||||
f_dprintf "%s: loading includes..." "$0"
|
||||
f_include $BSDCFG_SHARE/dialog.subr
|
||||
f_include $BSDCFG_SHARE/mustberoot.subr
|
||||
f_include $BSDCFG_SHARE/networking/routing.subr
|
||||
|
||||
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="120.networking"
|
||||
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
|
||||
|
||||
f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" ipgm &&
|
||||
pgm="${ipgm:-$pgm}"
|
||||
|
||||
############################################################ MAIN
|
||||
|
||||
# Incorporate rc-file if it exists
|
||||
[ -f "$HOME/.bsdconfigrc" ] && f_include "$HOME/.bsdconfigrc"
|
||||
|
||||
#
|
||||
# Process command-line arguments
|
||||
#
|
||||
while getopts h$GETOPTS_STDARGS flag; do
|
||||
case "$flag" in
|
||||
h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm" ;;
|
||||
esac
|
||||
done
|
||||
shift $(( $OPTIND - 1 ))
|
||||
|
||||
#
|
||||
# Initialize
|
||||
#
|
||||
f_dialog_title "$msg_default_router"
|
||||
f_dialog_backtitle "${ipgm:+bsdconfig }$pgm"
|
||||
f_mustberoot_init
|
||||
|
||||
#
|
||||
# Change the default router/gateway
|
||||
#
|
||||
f_dialog_input_defaultrouter
|
||||
|
||||
################################################################################
|
||||
# END
|
||||
################################################################################
|
164
bsdconfig/networking/devices
Executable file
164
bsdconfig/networking/devices
Executable file
@ -0,0 +1,164 @@
|
||||
#!/bin/sh
|
||||
#-
|
||||
# Copyright (c) 2006-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 device.subr (included indirectly) from auto scanning; this will be
|
||||
# performed indirectly later via f_dialog_menu_netdev() -- but only after we've
|
||||
# successfully completed f_mustberoot_init().
|
||||
#
|
||||
DEVICE_SELF_SCAN_ALL=NO
|
||||
|
||||
BSDCFG_SHARE="/usr/share/bsdconfig"
|
||||
. $BSDCFG_SHARE/common.subr || exit 1
|
||||
f_dprintf "%s: loading includes..." "$0"
|
||||
f_include $BSDCFG_SHARE/dialog.subr
|
||||
f_include $BSDCFG_SHARE/mustberoot.subr
|
||||
f_include $BSDCFG_SHARE/sysrc.subr
|
||||
f_include $BSDCFG_SHARE/media/tcpip.subr
|
||||
f_include $BSDCFG_SHARE/networking/device.subr
|
||||
f_include $BSDCFG_SHARE/networking/ipaddr.subr
|
||||
f_include $BSDCFG_SHARE/networking/media.subr
|
||||
f_include $BSDCFG_SHARE/networking/netmask.subr
|
||||
|
||||
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="120.networking"
|
||||
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
|
||||
|
||||
f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" ipgm &&
|
||||
pgm="${ipgm:-$pgm}"
|
||||
|
||||
############################################################ MAIN
|
||||
|
||||
# Incorporate rc-file if it exists
|
||||
[ -f "$HOME/.bsdconfigrc" ] && f_include "$HOME/.bsdconfigrc"
|
||||
|
||||
#
|
||||
# Process command-line options
|
||||
#
|
||||
while getopts h$GETOPTS_STDARGS flag; do
|
||||
case "$flag" in
|
||||
h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm" ;;
|
||||
esac
|
||||
done
|
||||
shift $(( $OPTIND - 1 ))
|
||||
|
||||
#
|
||||
# Initialize
|
||||
#
|
||||
f_dialog_title "$msg_networking_devices"
|
||||
f_dialog_backtitle "${ipgm:+bsdconfig }$pgm"
|
||||
f_mustberoot_init
|
||||
|
||||
#
|
||||
# Launch application main menu
|
||||
#
|
||||
defaultitem=
|
||||
while :; do
|
||||
f_dialog_menu_netdev "$defaultitem" || break
|
||||
f_dialog_menutag_fetch interface
|
||||
defaultitem="$interface"
|
||||
|
||||
#
|
||||
# dialog_menu_netdev adds an asterisk (*) to the right of the
|
||||
# device name if the interface is active. Remove the asterisk
|
||||
# from the device name if present.
|
||||
#
|
||||
case "$interface" in
|
||||
*\*) interface="${interface%?}" ;;
|
||||
esac
|
||||
|
||||
#
|
||||
# Obtain initial interface settings to be configured. These will be
|
||||
# passed to the f_dialog_menu_netdev_edit function-call below which
|
||||
# will block until the user has either cancelled or finished editing
|
||||
# the values.
|
||||
#
|
||||
# First, attempt to read stored configuration from rc.conf(5) and
|
||||
# fallback to reading the active configuration if not configured in
|
||||
# the rc.conf(5) file(s).
|
||||
#
|
||||
dhcp=
|
||||
_ipaddr=
|
||||
_netmask=
|
||||
_ifconfig=$( f_sysrc_get ifconfig_$interface )
|
||||
if [ "$_ifconfig" ]; then
|
||||
# If DHCP, get IP address/netmask later from ifconfig(8)
|
||||
glob="[Dd][Hh][Cc][Pp]"
|
||||
case "$_ifconfig" in
|
||||
$glob) dhcp=1 ;;
|
||||
[Ss][Yy][Nn][Cc]$glob) dhcp=1 ;;
|
||||
[Nn][Oo][Ss][Yy][Nn][Cc]$glob) dhcp=1 ;;
|
||||
*)
|
||||
#
|
||||
# Get IP address/netmask from rc.conf(5) configuration
|
||||
#
|
||||
dhcp=
|
||||
eval "$(
|
||||
exec 2> /dev/null
|
||||
set -- $_ifconfig
|
||||
while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
inet)
|
||||
shift 1
|
||||
echo "_ipaddr='$1'"
|
||||
;;
|
||||
netmask)
|
||||
shift 1
|
||||
echo "_netmask='$1'"
|
||||
;;
|
||||
esac
|
||||
shift 1
|
||||
done
|
||||
)"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
#
|
||||
# Fill in IP address/netmask from active settings if no
|
||||
# configuration could be extrapolated from rc.conf(5)
|
||||
#
|
||||
[ "$_ipaddr" ] || f_ifconfig_inet $interface _ipaddr
|
||||
[ "$_netmask" ] || f_ifconfig_netmask $interface _netmask
|
||||
|
||||
# Get the extra options (this always comes from rc.conf(5))
|
||||
_options=$( f_ifconfig_options $interface )
|
||||
|
||||
# Block on user-configuration of the probed settings
|
||||
f_dialog_menu_netdev_edit \
|
||||
"$interface" "$_ipaddr" "$_netmask" "$_options" $dhcp
|
||||
|
||||
# Return to root menu if above returns success
|
||||
[ $? -eq $DIALOG_OK ] && break
|
||||
done
|
||||
|
||||
exit $SUCCESS
|
||||
|
||||
################################################################################
|
||||
# END
|
||||
################################################################################
|
76
bsdconfig/networking/hostname
Executable file
76
bsdconfig/networking/hostname
Executable file
@ -0,0 +1,76 @@
|
||||
#!/bin/sh
|
||||
#-
|
||||
# Copyright (c) 2006-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 device.subr (included indirectly) from auto scanning on load
|
||||
DEVICE_SELF_SCAN_ALL=NO
|
||||
|
||||
BSDCFG_SHARE="/usr/share/bsdconfig"
|
||||
. $BSDCFG_SHARE/common.subr || exit 1
|
||||
f_dprintf "%s: loading includes..." "$0"
|
||||
f_include $BSDCFG_SHARE/dialog.subr
|
||||
f_include $BSDCFG_SHARE/mustberoot.subr
|
||||
f_include $BSDCFG_SHARE/networking/hostname.subr
|
||||
|
||||
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="120.networking"
|
||||
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
|
||||
|
||||
f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" ipgm &&
|
||||
pgm="${ipgm:-$pgm}"
|
||||
|
||||
############################################################ MAIN
|
||||
|
||||
# Incorporate rc-file if it exists
|
||||
[ -f "$HOME/.bsdconfigrc" ] && f_include "$HOME/.bsdconfigrc"
|
||||
|
||||
#
|
||||
# Process command-line arguments
|
||||
#
|
||||
while getopts h$GETOPTS_STDARGS flag; do
|
||||
case "$flag" in
|
||||
h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm" ;;
|
||||
esac
|
||||
done
|
||||
shift $(( $OPTIND - 1 ))
|
||||
|
||||
#
|
||||
# Initialize
|
||||
#
|
||||
f_dialog_title "$msg_hostname_domain"
|
||||
f_dialog_backtitle "${ipgm:+bsdconfig }$pgm"
|
||||
f_mustberoot_init
|
||||
|
||||
#
|
||||
# Change the local hostname
|
||||
#
|
||||
f_dialog_input_hostname
|
||||
|
||||
################################################################################
|
||||
# END
|
||||
################################################################################
|
6
bsdconfig/networking/include/Makefile
Normal file
6
bsdconfig/networking/include/Makefile
Normal file
@ -0,0 +1,6 @@
|
||||
# $FreeBSD$
|
||||
|
||||
FILESDIR= ${LIBEXECDIR}/bsdconfig/120.networking/include
|
||||
FILES= messages.subr
|
||||
|
||||
.include <bsd.prog.mk>
|
11
bsdconfig/networking/include/Makefile.depend
Normal file
11
bsdconfig/networking/include/Makefile.depend
Normal file
@ -0,0 +1,11 @@
|
||||
# $FreeBSD$
|
||||
# Autogenerated - do NOT edit!
|
||||
|
||||
DIRDEPS = \
|
||||
|
||||
|
||||
.include <dirdeps.mk>
|
||||
|
||||
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
|
||||
# local dependencies - needed for -jN in clean tree
|
||||
.endif
|
107
bsdconfig/networking/include/messages.subr
Normal file
107
bsdconfig/networking/include/messages.subr
Normal file
@ -0,0 +1,107 @@
|
||||
# Copyright (c) 2012-2016 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_alnum_punc_tab_enter="Use alpha-numeric, punctuation, TAB or ENTER"
|
||||
hline_arrows_tab_enter="Press arrows, TAB or ENTER"
|
||||
hline_num_punc_tab_enter="Use numbers, punctuation, TAB or ENTER"
|
||||
msg_activate_default_router="Would you like to activate the new defaultrouter right now?\nIf you choose NO or press ESC, changes will be applied\nduring the next boot.\n\n Current Default Router: %s\n New Default Router: %s\n"
|
||||
msg_activate_hostname="Would you like to activate the new hostname right now?\nIf you choose NO or press ESC, changes will be applied\nduring the next boot.\n\n Current Hostname: %s\n New Hostname: %s\n\nNOTE: Your shell prompt may still reflect the original\nhostname until your next login."
|
||||
msg_activate_hostname_x11warning="WARNING! Activating the new hostname during an X11-Forwarded\n ssh(1) session will cause an X11 authentication error.\n\n Current Hostname: %s\n New Hostname: %s\n\nNOTE: Settings will become active upon reboot or if you\n relaunch this utility either locally or on the console."
|
||||
msg_add="Add"
|
||||
msg_add_nameserver="Add a new nameserver"
|
||||
msg_bring_interface_up="Would you like to bring the %s interface up right now?"
|
||||
msg_cancel="Cancel"
|
||||
msg_current_default_router="Current Default Route/Gateway: %s"
|
||||
msg_current_dhcp_status="Current DHCP status for %s: %s"
|
||||
msg_current_ipaddr="Current IP Address for %s: %s"
|
||||
msg_current_options="Current Options for %s: %s"
|
||||
msg_current_subnet="Current Subnet Mask for %s: %s"
|
||||
msg_custom="Custom (Manual)"
|
||||
msg_default_router="Default Router/Gateway"
|
||||
msg_dhcp="DHCP"
|
||||
msg_disabled="Disabled"
|
||||
msg_dns_configuration="DNS Nameserver Configuration:\nChoose Exit when finished else Cancel."
|
||||
msg_dns_nameservers="DNS nameservers"
|
||||
msg_enabled="Enabled"
|
||||
msg_exit="Exit"
|
||||
msg_hostname_domain="Hostname/Domain"
|
||||
msg_hostname_exceeds_max_length="ERROR! The hostname entered exceeds the maximum length of\n255 characters.\n\nInvalid Hostname: %s"
|
||||
msg_hostname_label_contains_invalid_chars="ERROR! One or more individual labels within the hostname\n(separated by dots) contains one or more invalid characters.\nLabels are case-insensitive and must contain only 0-9, a-z,\n or dash (though must not begin with or end with a dash).\n\nInvalid Hostname: %s"
|
||||
msg_hostname_label_exceeds_max_length="ERROR! One or more individual labels within the hostname\n(separated by dots) exceeds the maximum of 63 characters.\n\nInvalid Hostname: %s"
|
||||
msg_hostname_label_is_null="ERROR! One or more individual labels within the hostname\n(separated by dots) are null.\n\nInvalid Hostname: %s"
|
||||
msg_hostname_label_starts_or_ends_with_hyphen="ERROR! One or more individual labels within the hostname\n(separated by dots) starts or ends with a hyphen (hyphens\nare allowed, but a label cannot begin or end with a hyphen).\n\nInvalid Hostname: %s"
|
||||
msg_internal_error_nsindex_value="FATAL! dialog_input_nameserver_edit_awk: variable\nnsindex must be a whole positive integer greater-\nthan or equal-to zero.\n\nInvalid nsindex: %s"
|
||||
msg_ipaddr4="ipaddr"
|
||||
msg_ipv4_addr_octet_contains_invalid_chars="ERROR! One or more individual octets within the IPv4 address\n(separated by dots) contains one or more invalid characters.\nOctets must contain only the characters 0-9.\n\nInvalid IP Address: %s"
|
||||
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_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"
|
||||
msg_network_management="Network Management"
|
||||
msg_networking_devices="Networking Devices"
|
||||
msg_nfs_mounts_may_cause_hang="WARNING! Changing this setting while NFS directories are\nmounted may cause the system to hang. Are you sure you\nwant to proceed?\n\n%s"
|
||||
msg_no_network_interfaces="No network interfaces detected."
|
||||
msg_no_options="No options (Default)"
|
||||
msg_ok="OK"
|
||||
msg_options="options"
|
||||
msg_please_enter_default_router="Please enter the IP address of your default\nrouter/gateway. The address entered will be\napplied as the default gateway for all interfaces\nusing route(4)."
|
||||
msg_please_enter_fqhn="Please enter your fully qualified hostname (e.g. full.example.com). The\ndomain portion of the hostname will be configured in resolv.conf(5)."
|
||||
msg_please_enter_mediaopts="Please enter additional network media options to be passed to ifconfig(8) for the %s interface:"
|
||||
msg_please_enter_nameserver="Please enter the new IP address of the DNS nameserver:"
|
||||
msg_please_enter_nameserver_existing="Please enter the new IP address of the DNS nameserver\n(set to the NULL string [Ctrl-U] to remove entry):"
|
||||
msg_please_enter_new_ip_addr="Please enter the new IP address of the %s interface:"
|
||||
msg_please_enter_subnet_mask="Please enter the new network subnet mask for the %s interface:"
|
||||
msg_probing_network_interfaces="Probing network interface devices..."
|
||||
msg_removing_nameserver="Removing DNS nameserver from resolv.conf(5)..."
|
||||
msg_resolv_conf_changed_while_editing="ERROR! resolv.conf(5) has changed while editing this\nvalue. Please try again after waiting a few seconds."
|
||||
msg_resolv_conf_entry_no_longer_exists="ERROR! The entry you are trying to edit no longer\nexists in resolv.conf(5). Please try again after\nwaiting a few seconds."
|
||||
msg_return_to_previous_menu="Return to previous menu"
|
||||
msg_save_exit="Save/Exit"
|
||||
msg_saving_default_router="Saving new default router/gateway settings..."
|
||||
msg_saving_hostname="Saving new hostname/domain settings..."
|
||||
msg_saving_nameserver="Saving new DNS nameserver to resolv.conf(5)..."
|
||||
msg_saving_nameserver_existing="Editing DNS nameserver in resolv.conf(5)..."
|
||||
msg_saving_network_interface="Saving %s network interface settings..."
|
||||
msg_scanning_for_dhcp="Scanning for DHCP servers on %s interface..."
|
||||
msg_select_network_interface="Select a network interface to configure.\n\n* Interface is marked as \"active\""
|
||||
msg_supported_media_options="Below is a list of supported media options for the %s interface. Please select the options that you would like to set for the %s network interface"
|
||||
msg_unknown_networking_menu_selection="Unknown networking menu selection"
|
||||
msg_wireless_networks="Wireless Networks"
|
||||
msg_wlans="wlans"
|
||||
xmsg_please_enter_fqhn="Please enter your fully qualified hostname (e.g. foo.bar.com).\n The domain portion of the hostname will be configured in resolv.conf(5)."
|
||||
xmsg_please_enter_nameserver_existing="Please enter the new IP address of the DNS nameserver\n(set to the NULL string to remove entry):"
|
||||
xmsg_supported_media_options="Below is a list of supported media options for the %s interface. Please\nselect the options that you would like to set for the %s network interface"
|
76
bsdconfig/networking/nameservers
Executable file
76
bsdconfig/networking/nameservers
Executable file
@ -0,0 +1,76 @@
|
||||
#!/bin/sh
|
||||
#-
|
||||
# Copyright (c) 2006-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 device.subr (included indirectly) from auto scanning on load
|
||||
DEVICE_SELF_SCAN_ALL=NO
|
||||
|
||||
BSDCFG_SHARE="/usr/share/bsdconfig"
|
||||
. $BSDCFG_SHARE/common.subr || exit 1
|
||||
f_dprintf "%s: loading includes..." "$0"
|
||||
f_include $BSDCFG_SHARE/dialog.subr
|
||||
f_include $BSDCFG_SHARE/mustberoot.subr
|
||||
f_include $BSDCFG_SHARE/networking/resolv.subr
|
||||
|
||||
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="120.networking"
|
||||
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
|
||||
|
||||
f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" ipgm &&
|
||||
pgm="${ipgm:-$pgm}"
|
||||
|
||||
############################################################ MAIN
|
||||
|
||||
# Incorporate rc-file if it exists
|
||||
[ -f "$HOME/.bsdconfigrc" ] && f_include "$HOME/.bsdconfigrc"
|
||||
|
||||
#
|
||||
# Process command-line arguments
|
||||
#
|
||||
while getopts h$GETOPTS_STDARGS flag; do
|
||||
case "$flag" in
|
||||
h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm" ;;
|
||||
esac
|
||||
done
|
||||
shift $(( $OPTIND - 1 ))
|
||||
|
||||
#
|
||||
# Initialize
|
||||
#
|
||||
f_dialog_title "$msg_dns_nameservers"
|
||||
f_dialog_backtitle "${ipgm:+bsdconfig }$pgm"
|
||||
f_mustberoot_init
|
||||
|
||||
#
|
||||
# Change the DNS nameservers
|
||||
#
|
||||
f_dialog_menu_nameservers
|
||||
|
||||
################################################################################
|
||||
# END
|
||||
################################################################################
|
153
bsdconfig/networking/networking
Executable file
153
bsdconfig/networking/networking
Executable file
@ -0,0 +1,153 @@
|
||||
#!/bin/sh
|
||||
#-
|
||||
# Copyright (c) 2006-2016 Devin Teske
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
# SUCH DAMAGE.
|
||||
#
|
||||
# $FreeBSD$
|
||||
#
|
||||
############################################################ INCLUDES
|
||||
|
||||
BSDCFG_SHARE="/usr/share/bsdconfig"
|
||||
. $BSDCFG_SHARE/common.subr || exit 1
|
||||
f_dprintf "%s: loading includes..." "$0"
|
||||
f_include $BSDCFG_SHARE/dialog.subr
|
||||
f_include $BSDCFG_SHARE/mustberoot.subr
|
||||
|
||||
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="120.networking"
|
||||
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
|
||||
|
||||
f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" ipgm &&
|
||||
pgm="${ipgm:-$pgm}"
|
||||
|
||||
############################################################ FUNCTIONS
|
||||
|
||||
# dialog_menu_main
|
||||
#
|
||||
# Display the dialog(1)-based application main menu.
|
||||
#
|
||||
dialog_menu_main()
|
||||
{
|
||||
local prompt=
|
||||
local menu_list="
|
||||
'X' '$msg_exit'
|
||||
'1' '$msg_hostname_domain'
|
||||
'2' '$msg_network_interfaces'
|
||||
'3' '$msg_wireless_networks'
|
||||
'4' '$msg_default_router'
|
||||
'5' '$msg_dns_nameservers'
|
||||
" # END-QUOTE
|
||||
local defaultitem= # Calculated below
|
||||
local hline="$hline_arrows_tab_enter"
|
||||
|
||||
local height width rows
|
||||
eval f_dialog_menu_size height width rows \
|
||||
\"\$DIALOG_TITLE\" \
|
||||
\"\$DIALOG_BACKTITLE\" \
|
||||
\"\$prompt\" \
|
||||
\"\$hline\" \
|
||||
$menu_list
|
||||
|
||||
# Obtain default-item from previously stored selection
|
||||
f_dialog_default_fetch defaultitem
|
||||
|
||||
local menu_choice
|
||||
menu_choice=$( eval $DIALOG \
|
||||
--title \"\$DIALOG_TITLE\" \
|
||||
--backtitle \"\$DIALOG_BACKTITLE\" \
|
||||
--hline \"\$hline\" \
|
||||
--ok-label \"\$msg_ok\" \
|
||||
--cancel-label \"\$msg_cancel\" \
|
||||
--default-item \"\$defaultitem\" \
|
||||
--menu \"\$prompt\" \
|
||||
$height $width $rows \
|
||||
$menu_list \
|
||||
2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD
|
||||
)
|
||||
local retval=$?
|
||||
f_dialog_data_sanitize menu_choice
|
||||
f_dialog_menutag_store "$menu_choice"
|
||||
f_dialog_default_store "$menu_choice"
|
||||
return $retval
|
||||
}
|
||||
|
||||
############################################################ MAIN
|
||||
|
||||
# Incorporate rc-file if it exists
|
||||
[ -f "$HOME/.bsdconfigrc" ] && f_include "$HOME/.bsdconfigrc"
|
||||
|
||||
#
|
||||
# Process command-line arguments
|
||||
#
|
||||
while getopts h$GETOPTS_STDARGS flag; do
|
||||
case "$flag" in
|
||||
h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm" ;;
|
||||
esac
|
||||
done
|
||||
shift $(( $OPTIND - 1 ))
|
||||
|
||||
#
|
||||
# Initialize
|
||||
#
|
||||
f_dialog_title "$msg_network_management"
|
||||
f_dialog_backtitle "${ipgm:+bsdconfig }$pgm"
|
||||
f_mustberoot_init
|
||||
|
||||
#
|
||||
# Launch application main menu
|
||||
#
|
||||
while :; do
|
||||
dialog_menu_main || f_die
|
||||
f_dialog_menutag_fetch mtag
|
||||
|
||||
command=
|
||||
case "$mtag" in
|
||||
X) break ;;
|
||||
1) command=hostname ;; # Hostname/Domain
|
||||
2) command=devices ;; # Network Interfaces
|
||||
3) command=wlanconfig ;; # Wireless Networks
|
||||
4) command=defaultrouter ;; # Default Router/Gateway
|
||||
5) command=nameservers ;; # DNS nameservers
|
||||
esac
|
||||
|
||||
if [ "$command" ]; then
|
||||
$BSDCFG_LIBE/$APP_DIR/$command ${USE_XDIALOG:+-X}
|
||||
else
|
||||
f_die 1 "$msg_unknown_networking_menu_selection"
|
||||
fi
|
||||
|
||||
if [ "$mtag" = "devices" ]; then
|
||||
#
|
||||
# Make subsequent uses of this menu faster by not performing
|
||||
# "ifconfig up" (limiting the pain one must endure). See also
|
||||
# `$BSDCFG_SHARE/networking/device.subr'.
|
||||
#
|
||||
export DIALOG_MENU_NETDEV_KICK_INTERFACES=
|
||||
fi
|
||||
done
|
||||
|
||||
exit $SUCCESS
|
||||
|
||||
################################################################################
|
||||
# END
|
||||
################################################################################
|
7
bsdconfig/networking/share/Makefile
Normal file
7
bsdconfig/networking/share/Makefile
Normal file
@ -0,0 +1,7 @@
|
||||
# $FreeBSD$
|
||||
|
||||
FILESDIR= ${SHAREDIR}/bsdconfig/networking
|
||||
FILES= common.subr device.subr hostname.subr ipaddr.subr media.subr \
|
||||
netmask.subr resolv.subr routing.subr services.subr
|
||||
|
||||
.include <bsd.prog.mk>
|
11
bsdconfig/networking/share/Makefile.depend
Normal file
11
bsdconfig/networking/share/Makefile.depend
Normal file
@ -0,0 +1,11 @@
|
||||
# $FreeBSD$
|
||||
# Autogenerated - do NOT edit!
|
||||
|
||||
DIRDEPS = \
|
||||
|
||||
|
||||
.include <dirdeps.mk>
|
||||
|
||||
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
|
||||
# local dependencies - needed for -jN in clean tree
|
||||
.endif
|
58
bsdconfig/networking/share/common.subr
Normal file
58
bsdconfig/networking/share/common.subr
Normal file
@ -0,0 +1,58 @@
|
||||
if [ ! "$_NETWORKING_COMMON_SUBR" ]; then _NETWORKING_COMMON_SUBR=1
|
||||
#
|
||||
# Copyright (c) 2006-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
|
||||
|
||||
BSDCFG_SHARE="/usr/share/bsdconfig"
|
||||
. $BSDCFG_SHARE/common.subr || exit 1
|
||||
|
||||
############################################################ FUNCTIONS
|
||||
|
||||
# f_jailed
|
||||
#
|
||||
# Returns true if the current process is jail(8)ed.
|
||||
#
|
||||
f_jailed()
|
||||
{
|
||||
! f_quietly ps 1
|
||||
}
|
||||
|
||||
# f_nfs_mounted
|
||||
#
|
||||
# Returns true if there are any NFS mounts currently active, otherwise false.
|
||||
#
|
||||
f_nfs_mounted()
|
||||
{
|
||||
[ "$( df -t nfs )" ]
|
||||
}
|
||||
|
||||
############################################################ MAIN
|
||||
|
||||
f_dprintf "%s: Successfully loaded." networking/common.subr
|
||||
|
||||
fi # ! $_NETWORKING_COMMON_SUBR
|
403
bsdconfig/networking/share/device.subr
Normal file
403
bsdconfig/networking/share/device.subr
Normal file
@ -0,0 +1,403 @@
|
||||
if [ ! "$_NETWORKING_DEVICE_SUBR" ]; then _NETWORKING_DEVICE_SUBR=1
|
||||
#
|
||||
# Copyright (c) 2006-2016 Devin Teske
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
# SUCH DAMAGE.
|
||||
#
|
||||
# $FreeBSD$
|
||||
#
|
||||
############################################################ INCLUDES
|
||||
|
||||
BSDCFG_SHARE="/usr/share/bsdconfig"
|
||||
. $BSDCFG_SHARE/common.subr || exit 1
|
||||
f_dprintf "%s: loading includes..." networking/device.subr
|
||||
f_include $BSDCFG_SHARE/device.subr
|
||||
f_include $BSDCFG_SHARE/dialog.subr
|
||||
f_include $BSDCFG_SHARE/media/tcpip.subr
|
||||
f_include $BSDCFG_SHARE/media/wlan.subr
|
||||
f_include $BSDCFG_SHARE/networking/common.subr
|
||||
f_include $BSDCFG_SHARE/networking/ipaddr.subr
|
||||
f_include $BSDCFG_SHARE/networking/media.subr
|
||||
f_include $BSDCFG_SHARE/networking/netmask.subr
|
||||
f_include $BSDCFG_SHARE/networking/resolv.subr
|
||||
f_include $BSDCFG_SHARE/networking/routing.subr
|
||||
f_include $BSDCFG_SHARE/strings.subr
|
||||
f_include $BSDCFG_SHARE/sysrc.subr
|
||||
|
||||
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="120.networking"
|
||||
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
|
||||
|
||||
############################################################ GLOBALS
|
||||
|
||||
#
|
||||
# Settings used while interacting with various dialog(1) menus
|
||||
#
|
||||
: ${DIALOG_MENU_NETDEV_KICK_INTERFACES=1}
|
||||
: ${DIALOG_MENU_NETDEV_SLEEP_AFTER_KICK=3}
|
||||
|
||||
############################################################ FUNCTIONS
|
||||
|
||||
# f_dialog_menu_netdev [$default]
|
||||
#
|
||||
# Display a list of network devices with descriptions. Optionally, if present
|
||||
# and non-NULL, initially highlight $default interface.
|
||||
#
|
||||
f_dialog_menu_netdev()
|
||||
{
|
||||
local menu_list # Calculated below
|
||||
local defaultitem="${1%\*}" # Trim trailing asterisk if present
|
||||
|
||||
#
|
||||
# Display a message to let the user know we're working...
|
||||
# (message will remain until we throw up the next dialog)
|
||||
#
|
||||
f_dialog_info "$msg_probing_network_interfaces"
|
||||
|
||||
#
|
||||
# Get list of usable network interfaces
|
||||
#
|
||||
local dev devs if iflist= # Calculated below
|
||||
f_device_rescan_network
|
||||
f_device_find "" $DEVICE_TYPE_NETWORK devs
|
||||
for dev in $devs; do
|
||||
f_struct "$dev" get name if || continue
|
||||
# Skip unsavory interfaces
|
||||
case "$if" in
|
||||
lo[0-9]*|ppp[0-9]*|sl[0-9]*) continue ;;
|
||||
esac
|
||||
iflist="$iflist $if"
|
||||
done
|
||||
iflist="${iflist# }"
|
||||
|
||||
#
|
||||
# Optionally kick interfaces in the head to get them to accurately
|
||||
# track the carrier status in realtime (required on FreeBSD).
|
||||
#
|
||||
if [ "$DIALOG_MENU_NETDEV_KICK_INTERFACES" ]; then
|
||||
DIALOG_MENU_NETDEV_KICK_INTERFACES=
|
||||
|
||||
for if in $iflist; do
|
||||
f_quietly ifconfig $if up
|
||||
done
|
||||
|
||||
if [ "$DIALOG_MENU_NETDEV_SLEEP_AFTER_KICK" ]; then
|
||||
# interfaces need time to update carrier status
|
||||
sleep $DIALOG_MENU_NETDEV_SLEEP_AFTER_KICK
|
||||
fi
|
||||
fi
|
||||
|
||||
#
|
||||
# Mark any "active" interfaces with an asterisk (*)
|
||||
# to the right of the device name.
|
||||
#
|
||||
menu_list=$(
|
||||
for if in $iflist; do
|
||||
f_device_desc $if $DEVICE_TYPE_NETWORK desc
|
||||
f_shell_escape "$desc" desc
|
||||
if f_device_is_active $if; then
|
||||
printf "'%s\*' '%s'\n" $if "$desc"
|
||||
else
|
||||
printf "'%s' '%s'\n" $if "$desc"
|
||||
fi
|
||||
done
|
||||
)
|
||||
if [ ! "$menu_list" ]; then
|
||||
f_show_msg "$msg_no_network_interfaces"
|
||||
return $DIALOG_CANCEL
|
||||
fi
|
||||
|
||||
# Maybe the default item was marked as active
|
||||
f_device_is_active "$defaultitem" && defaultitem="$defaultitem*"
|
||||
|
||||
#
|
||||
# Ask user to select an interface
|
||||
#
|
||||
local prompt="$msg_select_network_interface"
|
||||
local hline="$hline_arrows_tab_enter"
|
||||
local height width rows
|
||||
eval f_dialog_menu_size height width rows \
|
||||
\"\$DIALOG_TITLE\" \
|
||||
\"\$DIALOG_BACKTITLE\" \
|
||||
\"\$prompt\" \
|
||||
\"\$hline\" \
|
||||
$menu_list
|
||||
local menu_choice
|
||||
menu_choice=$( eval $DIALOG \
|
||||
--title \"\$DIALOG_TITLE\" \
|
||||
--backtitle \"\$DIALOG_BACKTITLE\" \
|
||||
--hline \"\$hline\" \
|
||||
--ok-label \"\$msg_ok\" \
|
||||
--cancel-label \"\$msg_cancel\" \
|
||||
--default-item \"\$defaultitem\" \
|
||||
--menu \"\$prompt\" \
|
||||
$height $width $rows \
|
||||
$menu_list \
|
||||
2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD
|
||||
)
|
||||
local retval=$?
|
||||
f_dialog_menutag_store -s "$menu_choice"
|
||||
return $retval
|
||||
}
|
||||
|
||||
# f_dialog_menu_netdev_edit $interface $ipaddr $netmask $options $dhcp
|
||||
#
|
||||
# Allow a user to edit network interface settings. Current values are not
|
||||
# probed but rather taken from the positional arguments.
|
||||
#
|
||||
f_dialog_menu_netdev_edit()
|
||||
{
|
||||
local funcname=f_dialog_menu_netdev_edit
|
||||
local interface="$1" ipaddr="$2" netmask="$3" options="$4" dhcp="$5"
|
||||
local prompt menu_list height width rows
|
||||
|
||||
#
|
||||
# Create a duplicate set of variables for change-tracking...
|
||||
#
|
||||
local ipaddr_orig="$2" \
|
||||
netmask_orig="$3" \
|
||||
options_orig="$4" \
|
||||
dhcp_orig="$5"
|
||||
|
||||
local hline="$hline_arrows_tab_enter"
|
||||
f_sprintf prompt "$msg_network_configuration" "$interface"
|
||||
|
||||
#
|
||||
# Loop forever until the user has finished configuring the different
|
||||
# components of the network interface.
|
||||
#
|
||||
# To apply the settings, we need to know each of the following:
|
||||
# - IP Address
|
||||
# - Network subnet mask
|
||||
# - Additional ifconfig(8) options
|
||||
#
|
||||
# It is only when we have all of the above values that we can make the
|
||||
# changes effective because all three options must be specified at-once
|
||||
# to ifconfig(8).
|
||||
#
|
||||
local defaultitem=
|
||||
local wlans wlan_status
|
||||
while :; do
|
||||
local dhcp_status="$msg_disabled"
|
||||
[ "$dhcp" ] && dhcp_status="$msg_enabled"
|
||||
|
||||
if f_device_is_wireless "$interface"; then
|
||||
wlans=$( f_sysrc_get "wlans_$interface" )
|
||||
wlan_status="$msg_unconfigured"
|
||||
[ -e "$( f_sysrc_get wpa_supplicant_conf_file )" ] &&
|
||||
wlan_status="$msg_configured"
|
||||
fi
|
||||
|
||||
#
|
||||
# Display configuration-edit menu
|
||||
#
|
||||
menu_list="
|
||||
'X $msg_save_exit' '$msg_return_to_previous_menu'
|
||||
" # END-QUOTE
|
||||
f_device_is_wireless "$interface" && menu_list="$menu_list
|
||||
'W $msg_wireless_networks' '$wlan_status'
|
||||
'1 $msg_wlans' '$wlans'
|
||||
" # END-QUOTE
|
||||
menu_list="$menu_list
|
||||
'2 $msg_dhcp' '$dhcp_status'
|
||||
'3 $msg_ipaddr4' '$ipaddr'
|
||||
'4 $msg_netmask' '$netmask'
|
||||
'5 $msg_options' '$options'
|
||||
" # END-QUOTE
|
||||
eval f_dialog_menu_size height width rows \
|
||||
\"\$DIALOG_TITLE\" \
|
||||
\"\$DIALOG_BACKTITLE\" \
|
||||
\"\$prompt\" \
|
||||
\"\$hline\" \
|
||||
$menu_list
|
||||
local tag
|
||||
tag=$( eval $DIALOG \
|
||||
--title \"\$DIALOG_TITLE\" \
|
||||
--backtitle \"\$DIALOG_BACKTITLE\" \
|
||||
--hline \"\$hline\" \
|
||||
--ok-label \"\$msg_ok\" \
|
||||
--cancel-label \"\$msg_cancel\" \
|
||||
--help-button \
|
||||
--help-label \"\$msg_help\" \
|
||||
${USE_XDIALOG:+--help \"\"} \
|
||||
--default-item \"\$defaultitem\" \
|
||||
--menu \"\$prompt\" \
|
||||
$height $width $rows \
|
||||
$menu_list \
|
||||
2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD
|
||||
)
|
||||
local retval=$?
|
||||
f_dialog_data_sanitize tag
|
||||
|
||||
if [ $retval -eq $DIALOG_HELP ]; then
|
||||
f_show_help "$TCP_HELPFILE"
|
||||
continue
|
||||
elif [ $retval -ne $DIALOG_OK ]; then
|
||||
return $retval
|
||||
else
|
||||
# Only update default-item on success
|
||||
defaultitem="$tag"
|
||||
fi
|
||||
|
||||
#
|
||||
# Call the below ``modifier functions'' whose job it is to take
|
||||
# input from the user and assign the newly-acquired values back
|
||||
# to the ipaddr, netmask, and options variables for us to re-
|
||||
# read and display in the summary dialog.
|
||||
#
|
||||
case "$tag" in
|
||||
X\ *) break ;;
|
||||
W\ *) f_dialog_menu_wireless_edit ;;
|
||||
1\ *) f_dialog_menu_wlandev_edit \
|
||||
"$interface" "${wlans%%[$IFS]*}" ;;
|
||||
2\ *) #
|
||||
# Proceed cautiously (confirm with the user) if/when NFS-
|
||||
# mounts are active. If the network on which these mounts
|
||||
# are made is changed parts of the system may hang.
|
||||
#
|
||||
if f_nfs_mounted && ! f_jailed; then
|
||||
local setting
|
||||
f_sprintf setting "$msg_current_dhcp_status" \
|
||||
"$interface" "$dhcp_status"
|
||||
f_noyes "$msg_nfs_mounts_may_cause_hang" "$setting" ||
|
||||
continue
|
||||
fi
|
||||
|
||||
#
|
||||
# Toggle DHCP status
|
||||
#
|
||||
if [ "$dhcp_status" = "$msg_enabled" ]; then
|
||||
dhcp=
|
||||
else
|
||||
trap - SIGINT
|
||||
( # Execute within sub-shell to allow/catch Ctrl-C
|
||||
trap 'exit $FAILURE' SIGINT
|
||||
f_sprintf msg "$msg_scanning_for_dhcp" "$interface"
|
||||
if [ "$USE_XDIALOG" ]; then
|
||||
(
|
||||
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"
|
||||
fi
|
||||
)
|
||||
retval=$?
|
||||
trap 'interrupt' SIGINT
|
||||
if [ $retval -eq $DIALOG_OK ]; then
|
||||
dhcp=1
|
||||
f_ifconfig_inet "$interface" ipaddr
|
||||
f_ifconfig_inet6 "$interface" ipaddr6
|
||||
f_ifconfig_netmask "$interface" netmask
|
||||
options=
|
||||
|
||||
# Fixup search/domain in resolv.conf(5)
|
||||
hostname=$( f_sysrc_get \
|
||||
'hostname:-$(hostname)' )
|
||||
f_dialog_resolv_conf_update "$hostname"
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
3\ *) f_dialog_input_ipaddr "$interface" "$ipaddr"
|
||||
[ $? -eq $DIALOG_OK ] && dhcp= ;;
|
||||
4\ *) f_dialog_input_netmask "$interface" "$netmask"
|
||||
[ $? -eq $DIALOG_OK -a "$_netmask" ] && dhcp= ;;
|
||||
5\ *) f_dialog_menu_media_options "$interface" "$options"
|
||||
[ $? -eq $DIALOG_OK ] && dhcp= ;;
|
||||
esac
|
||||
done
|
||||
|
||||
#
|
||||
# Save only if the user changed at least one feature of the interface
|
||||
#
|
||||
if [ "$ipaddr" != "$ipaddr_orig" -o \
|
||||
"$netmask" != "$netmask_orig" -o \
|
||||
"$options" != "$options_orig" -o \
|
||||
"$dhcp" != "$dhcp_orig" ]
|
||||
then
|
||||
f_show_info "$msg_saving_network_interface" "$interface"
|
||||
|
||||
local value=
|
||||
if [ "$dhcp" ]; then
|
||||
f_eval_catch $funcname f_sysrc_delete \
|
||||
'f_sysrc_delete defaultrouter'
|
||||
value=DHCP
|
||||
else
|
||||
value="inet $ipaddr netmask $netmask"
|
||||
value="$value${options:+ }$options"
|
||||
fi
|
||||
|
||||
f_eval_catch $funcname f_sysrc_set \
|
||||
'f_sysrc_set "ifconfig_%s" "%s"' "$interface" "$value"
|
||||
fi
|
||||
|
||||
#
|
||||
# Re/Apply the settings if desired
|
||||
#
|
||||
if [ ! "$dhcp" ]; then
|
||||
if f_yesno "$msg_bring_interface_up" "$interface"
|
||||
then
|
||||
f_show_info "$msg_bring_interface_up" "$interface"
|
||||
|
||||
local dr="$( f_sysrc_get defaultrouter )"
|
||||
if [ "$dr" = "NO" -o ! "$dr" ]; then
|
||||
f_route_get_default dr
|
||||
[ "$dr" ] && f_eval_catch \
|
||||
$funcname f_sysrc_set \
|
||||
'f_sysrc_set defaultrouter "%s"' "$dr"
|
||||
fi
|
||||
#
|
||||
# Make a backup of resolv.conf(5) before using
|
||||
# ifconfig(8) and then restore it afterward. This
|
||||
# allows preservation of nameservers acquired via
|
||||
# DHCP on FreeBSD-8.x (normally lost as ifconfig(8)
|
||||
# usage causes dhclient(8) to exit which scrubs
|
||||
# resolv.conf(5) by-default upon termination).
|
||||
#
|
||||
f_quietly cp -fp "$RESOLV_CONF" "$RESOLV_CONF.$$"
|
||||
if f_eval_catch $funcname ifconfig \
|
||||
'ifconfig "%s" inet "%s" netmask "%s" %s' \
|
||||
"$interface" "$ipaddr" "$netmask" "$options"
|
||||
then
|
||||
[ "$dr" -a "$dr" != "NO" ] &&
|
||||
f_eval_catch $funcname route \
|
||||
'route add default "%s"' "$dr"
|
||||
fi
|
||||
if cmp -s "$RESOLV_CONF" "$RESOLV_CONF.$$"; then
|
||||
f_quietly rm -f "$RESOLV_CONF.$$"
|
||||
else
|
||||
f_quietly mv -f "$RESOLV_CONF.$$" "$RESOLV_CONF"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
return $DIALOG_OK
|
||||
}
|
||||
|
||||
############################################################ MAIN
|
||||
|
||||
f_dprintf "%s: Successfully loaded." networking/device.subr
|
||||
|
||||
fi # ! $_NETWORKING_DEVICE_SUBR
|
162
bsdconfig/networking/share/hostname.subr
Normal file
162
bsdconfig/networking/share/hostname.subr
Normal file
@ -0,0 +1,162 @@
|
||||
if [ ! "$_NETWORKING_HOSTNAME_SUBR" ]; then _NETWORKING_HOSTNAME_SUBR=1
|
||||
#
|
||||
# Copyright (c) 2006-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
|
||||
|
||||
BSDCFG_SHARE="/usr/share/bsdconfig"
|
||||
. $BSDCFG_SHARE/common.subr || exit 1
|
||||
f_dprintf "%s: loading includes..." networking/hostname.subr
|
||||
f_include $BSDCFG_SHARE/dialog.subr
|
||||
f_include $BSDCFG_SHARE/networking/common.subr
|
||||
f_include $BSDCFG_SHARE/networking/resolv.subr
|
||||
f_include $BSDCFG_SHARE/sysrc.subr
|
||||
|
||||
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="120.networking"
|
||||
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
|
||||
|
||||
############################################################ FUNCTIONS
|
||||
|
||||
# f_dialog_hnerror $error $hostname
|
||||
#
|
||||
# Display a msgbox with the appropriate error message for an error returned by
|
||||
# the f_validate_hostname function.
|
||||
#
|
||||
f_dialog_hnerror()
|
||||
{
|
||||
local error="$1" fqhn="$2"
|
||||
|
||||
[ ${error:-0} -ne 0 ] || return $SUCCESS
|
||||
|
||||
case "$error" in
|
||||
1) f_show_msg "$msg_hostname_label_contains_invalid_chars" "$fqhn" ;;
|
||||
2) f_show_msg \
|
||||
"$msg_hostname_label_starts_or_ends_with_hyphen" "$fqhn" ;;
|
||||
3) f_show_msg "$msg_hostname_label_is_null" "$fqhn" ;;
|
||||
63) f_show_msg "$msg_hostname_label_exceeds_max_length" "$fqhn" ;;
|
||||
255) f_show_msg "$msg_hostname_exceeds_max_length" "$fqhn" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
# f_dialog_validate_hostname $hostname
|
||||
#
|
||||
# Returns zero if the given argument (a fully-qualified hostname) is compliant
|
||||
# with standards set-forth in RFC's 952 and 1123 of the Network Working Group:
|
||||
#
|
||||
# RFC 952 - DoD Internet host table specification
|
||||
# https://tools.ietf.org/html/rfc952
|
||||
#
|
||||
# RFC 1123 - Requirements for Internet Hosts - Application and Support
|
||||
# https://tools.ietf.org/html/rfc1123
|
||||
#
|
||||
# If the hostname is determined to be invalid, the appropriate error will be
|
||||
# displayed using the f_dialog_hnerror function above.
|
||||
#
|
||||
f_dialog_validate_hostname()
|
||||
{
|
||||
local fqhn="$1"
|
||||
|
||||
f_validate_hostname "$fqhn"
|
||||
local retval=$?
|
||||
|
||||
# Produce an appropriate error message if necessary.
|
||||
[ $retval -eq $SUCCESS ] || f_dialog_hnerror $retval "$fqhn"
|
||||
|
||||
return $retval
|
||||
}
|
||||
|
||||
# f_dialog_input_hostname
|
||||
#
|
||||
# Edits the current hostname.
|
||||
#
|
||||
f_dialog_input_hostname()
|
||||
{
|
||||
local funcname=f_dialog_input_hostname
|
||||
local hostname="$( f_sysrc_get 'hostname:-$(hostname)' )"
|
||||
local hostname_orig="$hostname" # for change-tracking
|
||||
|
||||
local msg
|
||||
if [ "$USE_XDIALOG" ]; then
|
||||
msg="$xmsg_please_enter_fqhn"
|
||||
else
|
||||
msg="$msg_please_enter_fqhn"
|
||||
fi
|
||||
|
||||
#
|
||||
# Loop until the user provides taint-free input.
|
||||
#
|
||||
while :; do
|
||||
f_dialog_input hostname "$msg" "$hostname" \
|
||||
"$hline_alnum_punc_tab_enter" || return $?
|
||||
# Taint-check the user's input
|
||||
f_dialog_validate_hostname "$hostname" && break
|
||||
done
|
||||
|
||||
#
|
||||
# Save hostname only if the user changed the hostname.
|
||||
#
|
||||
if [ "$hostname" != "$hostname_orig" ]; then
|
||||
f_dialog_info "$msg_saving_hostname"
|
||||
f_eval_catch $funcname f_sysrc_set \
|
||||
'f_sysrc_set hostname "%s"' "$hostname"
|
||||
fi
|
||||
|
||||
#
|
||||
# Update resolv.conf(5) search/domain directives
|
||||
#
|
||||
f_dialog_resolv_conf_update "$hostname"
|
||||
|
||||
#
|
||||
# Only ask to apply setting if the current hostname is different than
|
||||
# the stored configuration (in rc.conf(5)).
|
||||
#
|
||||
if [ "$( hostname )" != "$( f_sysrc_get hostname )" ]; then
|
||||
[ ! "$USE_XDIALOG" ] && f_dialog_clear
|
||||
|
||||
#
|
||||
# If connected via ssh(1) and performing X11-Forwarding, don't
|
||||
# allow the hostname to be changed to prevent the fatal error
|
||||
# "X11 connection rejected because of wrong authentication."
|
||||
#
|
||||
if [ "$USE_XDIALOG" -a "$SSH_CONNECTION" ]; then
|
||||
f_show_msg "$msg_activate_hostname_x11warning" \
|
||||
"$( hostname )" "$hostname"
|
||||
else
|
||||
f_yesno "$msg_activate_hostname" \
|
||||
"$( hostname )" "$hostname" \
|
||||
&& hostname "$hostname"
|
||||
fi
|
||||
fi
|
||||
|
||||
return $DIALOG_OK
|
||||
}
|
||||
|
||||
############################################################ MAIN
|
||||
|
||||
f_dprintf "%s: Successfully loaded." networking/hostname.subr
|
||||
|
||||
fi # ! $_NETWORKING_HOSTNAME_SUBR
|
219
bsdconfig/networking/share/ipaddr.subr
Normal file
219
bsdconfig/networking/share/ipaddr.subr
Normal file
@ -0,0 +1,219 @@
|
||||
if [ ! "$_NETWORKING_IPADDR_SUBR" ]; then _NETWORKING_IPADDR_SUBR=1
|
||||
#
|
||||
# Copyright (c) 2006-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
|
||||
|
||||
BSDCFG_SHARE="/usr/share/bsdconfig"
|
||||
. $BSDCFG_SHARE/common.subr || exit 1
|
||||
f_dprintf "%s: loading includes..." networking/ipaddr.subr
|
||||
f_include $BSDCFG_SHARE/dialog.subr
|
||||
f_include $BSDCFG_SHARE/networking/common.subr
|
||||
f_include $BSDCFG_SHARE/strings.subr
|
||||
|
||||
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="120.networking"
|
||||
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
|
||||
|
||||
############################################################ FUNCTIONS
|
||||
|
||||
# f_dialog_iperror $error $ipaddr
|
||||
#
|
||||
# Display a msgbox with the appropriate error message for an error returned by
|
||||
# the f_validate_ipaddr function.
|
||||
#
|
||||
f_dialog_iperror()
|
||||
{
|
||||
local error="$1" ip="$2"
|
||||
|
||||
[ ${error:-0} -ne 0 ] || return $SUCCESS
|
||||
|
||||
case "$error" in
|
||||
1) f_show_msg "$msg_ipv4_addr_octet_contains_invalid_chars" "$ip" ;;
|
||||
2) f_show_msg "$msg_ipv4_addr_octet_is_null" "$ip" ;;
|
||||
3) f_show_msg "$msg_ipv4_addr_octet_exceeds_max_value" "$ip" ;;
|
||||
4) f_show_msg "$msg_ipv4_addr_octet_missing_or_extra" "$ip" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
# f_dialog_validate_ipaddr $ipaddr
|
||||
#
|
||||
# Returns zero if the given argument (an IP address) is of the proper format.
|
||||
#
|
||||
# If the IP address is determined to be invalid, the appropriate error will be
|
||||
# displayed using the f_dialog_iperror function above.
|
||||
#
|
||||
f_dialog_validate_ipaddr()
|
||||
{
|
||||
local ip="$1"
|
||||
|
||||
f_validate_ipaddr "$ip"
|
||||
local retval=$?
|
||||
|
||||
# Produce an appropriate error message if necessary.
|
||||
[ $retval -eq $SUCCESS ] || f_dialog_iperror $retval "$ip"
|
||||
|
||||
return $retval
|
||||
}
|
||||
|
||||
# f_dialog_ip6error $error $ipv6_addr
|
||||
#
|
||||
# Display a msgbox with the appropriate error message for an error returned by
|
||||
# the f_validate_ipaddr6 function above.
|
||||
#
|
||||
f_dialog_ip6error()
|
||||
{
|
||||
local error="$1" ip="$2"
|
||||
|
||||
[ ${error:-0} -ne 0 ] || return $SUCCESS
|
||||
|
||||
case "$error" in
|
||||
1) f_show_msg "$msg_ipv6_addr_segment_contains_invalid_chars" "$ip" ;;
|
||||
2) f_show_msg "$msg_ipv6_addr_too_many_null_segments" "$ip" ;;
|
||||
3) f_show_msg "$msg_ipv6_addr_segment_contains_too_many_chars" "$ip" ;;
|
||||
4) f_show_msg "$msg_ipv6_addr_too_few_or_extra_segments" "$ip" ;;
|
||||
*)
|
||||
if [ $(( $error & 0xF )) -eq 5 ]; then
|
||||
# IPv4 at the end of IPv6 address is invalid
|
||||
f_dialog_iperror $(( $error >> 4 )) "$ip"
|
||||
fi
|
||||
esac
|
||||
}
|
||||
|
||||
# f_dialog_validate_ipaddr6 $ipv6_addr
|
||||
#
|
||||
# Returns zero if the given argument (an IPv6 address) is of the proper format.
|
||||
#
|
||||
# If the IP address is determined to be invalid, the appropriate error will be
|
||||
# displayed using the f_dialog_ip6error function above.
|
||||
#
|
||||
f_dialog_validate_ipaddr6()
|
||||
{
|
||||
local ip="$1"
|
||||
|
||||
f_validate_ipaddr6 "$ip"
|
||||
local retval=$?
|
||||
|
||||
# Produce an appropriate error message if necessary.
|
||||
[ $retval -eq $SUCCESS ] || f_dialog_ip6error $retval "$ip"
|
||||
|
||||
return $retval
|
||||
}
|
||||
|
||||
# f_dialog_input_ipaddr $interface $ipaddr
|
||||
#
|
||||
# Allows the user to edit a given IP address. If the user does not cancel or
|
||||
# press ESC, the $ipaddr environment variable will hold the newly-configured
|
||||
# value upon return.
|
||||
#
|
||||
# Optionally, the user can enter the format "IP_ADDRESS/NBITS" to set the
|
||||
# netmask at the same time as the IP address. If such a format is entered by
|
||||
# the user, the $netmask environment variable will hold the newly-configured
|
||||
# netmask upon return.
|
||||
#
|
||||
f_dialog_input_ipaddr()
|
||||
{
|
||||
local interface="$1" _ipaddr="$2" _input
|
||||
|
||||
#
|
||||
# Return with-error when there are NFS-mounts currently active. If the
|
||||
# IP address is changed while NFS-exported directories are mounted, the
|
||||
# system may hang (if any NFS mounts are using that interface).
|
||||
#
|
||||
if f_nfs_mounted && ! f_jailed; then
|
||||
local setting
|
||||
f_sprintf setting "$msg_current_ipaddr" "$interface" "$_ipaddr"
|
||||
f_noyes "$msg_nfs_mounts_may_cause_hang" "$setting" ||
|
||||
return $DIALOG_CANCEL
|
||||
fi
|
||||
|
||||
local msg
|
||||
f_sprintf msg "$msg_please_enter_new_ip_addr" "$interface"
|
||||
|
||||
#
|
||||
# Loop until the user provides taint-free input.
|
||||
#
|
||||
local retval
|
||||
while :; do
|
||||
#
|
||||
# Return error status if:
|
||||
# - User has either pressed ESC or chosen Cancel/No
|
||||
# - User has not made any changes to the given value
|
||||
#
|
||||
f_dialog_input _input "$msg" "$_ipaddr" \
|
||||
"$hline_num_punc_tab_enter" || return $?
|
||||
[ "$_ipaddr" = "$_input" ] && return $DIALOG_CANCEL
|
||||
|
||||
# Return success if NULL value was entered
|
||||
[ "$_input" ] || return $DIALOG_OK
|
||||
|
||||
# Take only the first "word" of the user's input
|
||||
_ipaddr="$_input"
|
||||
_ipaddr="${_ipaddr%%[$IFS]*}"
|
||||
|
||||
# Taint-check the user's input
|
||||
f_dialog_validate_ipaddr "${_ipaddr%%/*}" && break
|
||||
done
|
||||
|
||||
#
|
||||
# Support the syntax: IP_ADDRESS/NBITS
|
||||
#
|
||||
local _netmask=""
|
||||
case "$_ipaddr" in
|
||||
*/*)
|
||||
local nbits="${_ipaddr#*/}" n=0
|
||||
_ipaddr="${_ipaddr%%/*}"
|
||||
|
||||
#
|
||||
# Taint-check $nbits to be (a) a positive whole-integer,
|
||||
# and (b) to be less than or equal to 32. Otherwise, set
|
||||
# $n so that the below loop never executes.
|
||||
#
|
||||
( f_isinteger "$nbits" && [ $nbits -ge 0 -a $nbits -le 32 ] ) \
|
||||
|| n=4
|
||||
|
||||
while [ $n -lt 4 ]; do
|
||||
_netmask="$_netmask${_netmask:+.}$((
|
||||
(65280 >> ($nbits - 8 * $n) & 255)
|
||||
* ((8*$n) < $nbits & $nbits <= (8*($n+1)))
|
||||
+ 255 * ($nbits > (8*($n+1)))
|
||||
))"
|
||||
n=$(( $n + 1 ))
|
||||
done
|
||||
;;
|
||||
esac
|
||||
|
||||
ipaddr="$_ipaddr"
|
||||
[ "$_netmask" ] && netmask="$_netmask"
|
||||
|
||||
return $DIALOG_OK
|
||||
}
|
||||
|
||||
############################################################ MAIN
|
||||
|
||||
f_dprintf "%s: Successfully loaded." networking/ipaddr.subr
|
||||
|
||||
fi # ! $_NETWORKING_IPADDR_SUBR
|
247
bsdconfig/networking/share/media.subr
Normal file
247
bsdconfig/networking/share/media.subr
Normal file
@ -0,0 +1,247 @@
|
||||
if [ ! "$_NETWORKING_MEDIA_SUBR" ]; then _NETWORKING_MEDIA_SUBR=1
|
||||
#
|
||||
# Copyright (c) 2006-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
|
||||
|
||||
BSDCFG_SHARE="/usr/share/bsdconfig"
|
||||
. $BSDCFG_SHARE/common.subr || exit 1
|
||||
f_dprintf "%s: loading includes..." networking/media.subr
|
||||
f_include $BSDCFG_SHARE/dialog.subr
|
||||
f_include $BSDCFG_SHARE/networking/common.subr
|
||||
f_include $BSDCFG_SHARE/strings.subr
|
||||
f_include $BSDCFG_SHARE/sysrc.subr
|
||||
|
||||
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="120.networking"
|
||||
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
|
||||
|
||||
############################################################ FUNCTIONS
|
||||
|
||||
# f_ifconfig_options $interface
|
||||
#
|
||||
# Returns any/all extra ifconfig(8) parameters associated with $interface.
|
||||
#
|
||||
f_ifconfig_options()
|
||||
{
|
||||
local interface="$1"
|
||||
[ "$interface" ] || return $SUCCESS
|
||||
|
||||
#
|
||||
# Loop over the options, removing what we don't want
|
||||
#
|
||||
(
|
||||
set -- $( f_sysrc_get ifconfig_$interface )
|
||||
|
||||
#
|
||||
# Return if the interface is configured for DHCP
|
||||
#
|
||||
glob="[Dd][Hh][Cc][Pp]"
|
||||
case "$*" in
|
||||
$glob|[Ss][Yy][Nn][Cc]$glob|[Nn][Oo][Ss][Yy][Nn][Cc]$glob)
|
||||
exit $SUCCESS
|
||||
esac
|
||||
|
||||
output=
|
||||
while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
inet|netmask) shift 1 ;;
|
||||
*) output="$output${output:+ }$1"
|
||||
esac
|
||||
shift 1
|
||||
done
|
||||
echo "$output"
|
||||
)
|
||||
}
|
||||
|
||||
# f_ifconfig_media $interface
|
||||
#
|
||||
# Returns list of supported media for $interface.
|
||||
#
|
||||
f_ifconfig_media()
|
||||
{
|
||||
local interface="$1"
|
||||
ifconfig -m "$interface" 2> /dev/null | awk \
|
||||
'
|
||||
BEGIN { media_found = 0 }
|
||||
{
|
||||
if ( media_found == 1 ) { print; next }
|
||||
}
|
||||
( $1 $2 == "supported" "media:" ) \
|
||||
{
|
||||
media_found = 1
|
||||
next
|
||||
}
|
||||
END { exit ! media_found }
|
||||
'
|
||||
}
|
||||
|
||||
# f_dialog_input_options $interface
|
||||
#
|
||||
# Input custom interface options. If the user does not press ESC or choose
|
||||
# Cancel/No, $options will hold the user's input. Default input is taken from
|
||||
# the same variable ($options).
|
||||
#
|
||||
f_dialog_input_options()
|
||||
{
|
||||
local interface="$1"
|
||||
|
||||
#
|
||||
# Return with-error when there are NFS-mounts currently active. If the
|
||||
# options are changed while NFS-exported directories are mounted,
|
||||
# the system may hang (if any NFS mounts are using that interface).
|
||||
#
|
||||
if f_nfs_mounted && ! f_jailed; then
|
||||
local setting
|
||||
f_sprintf setting "$msg_current_options" \
|
||||
"$interface" "$options"
|
||||
f_noyes "$msg_nfs_mounts_may_cause_hang" "$setting" ||
|
||||
return $DIALOG_CANCEL
|
||||
fi
|
||||
|
||||
local msg
|
||||
f_sprintf msg "$msg_please_enter_mediaopts" "$interface"
|
||||
local hline="$hline_alnum_punc_tab_enter"
|
||||
|
||||
local _options
|
||||
_options=$( $DIALOG \
|
||||
--title "$DIALOG_TITLE" \
|
||||
--backtitle "$DIALOG_BACKTITLE" \
|
||||
--hline "$hline" \
|
||||
--ok-label "$msg_ok" \
|
||||
--cancel-label "$msg_cancel" \
|
||||
--inputbox "$msg" 9 70 \
|
||||
"$options" \
|
||||
2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD
|
||||
)
|
||||
local retval=$?
|
||||
f_dialog_line_sanitize _options
|
||||
|
||||
[ $retval -eq $DIALOG_OK ] && options="$_options"
|
||||
|
||||
return $retval
|
||||
}
|
||||
|
||||
# f_dialog_menu_media_options $interface
|
||||
#
|
||||
# Display a menu of additional media options for the given network interface.
|
||||
#
|
||||
f_dialog_menu_media_options()
|
||||
{
|
||||
local interface="$1" _options="$2"
|
||||
#
|
||||
# Not all network interfaces support additional media options, but
|
||||
# when available we should prompt the user to select from a list
|
||||
# of available options (or none, as is the first/default option).
|
||||
#
|
||||
|
||||
#
|
||||
# Return with-error when there are NFS-mounts currently active. If the
|
||||
# media options are changed while NFS-exported directories are mounted,
|
||||
# the system may hang (if any NFS mounts are using that interface).
|
||||
#
|
||||
if f_nfs_mounted && ! f_jailed; then
|
||||
local setting
|
||||
f_sprintf setting "$msg_current_options" \
|
||||
"$interface" "$_options"
|
||||
f_noyes "$msg_nfs_mounts_may_cause_hang" "$setting" ||
|
||||
return $DIALOG_CANCEL
|
||||
fi
|
||||
|
||||
#
|
||||
# Build list of additional media options
|
||||
#
|
||||
local opt_none="$msg_no_options"
|
||||
local opt_cust="$msg_custom"
|
||||
local supported_media="$(
|
||||
f_ifconfig_media $interface | \
|
||||
( index=1
|
||||
|
||||
f_substr -v tagn "$DIALOG_MENU_TAGS" $index 1
|
||||
echo "'$tagn' '$opt_none'"
|
||||
index=$(( $index + 1 ))
|
||||
|
||||
f_substr -v tagn "$DIALOG_MENU_TAGS" $index 1
|
||||
echo "'$tagn' '$opt_cust'"
|
||||
index=$(( $index + 1 ))
|
||||
|
||||
while read media_options; do
|
||||
[ $index -lt ${#DIALOG_MENU_TAGS} ] || break
|
||||
f_substr -v tagn "$DIALOG_MENU_TAGS" $index 1
|
||||
echo "'$tagn' '$media_options'"
|
||||
index=$(( $index + 1 ))
|
||||
done
|
||||
)
|
||||
)"
|
||||
|
||||
local msg
|
||||
if [ "$USE_XDIALOG" ]; then
|
||||
f_sprintf msg "$xmsg_supported_media_options" \
|
||||
"$interface" "$interface"
|
||||
else
|
||||
f_sprintf msg "$msg_supported_media_options" \
|
||||
"$interface" "$interface"
|
||||
fi
|
||||
|
||||
local hline="$hline_arrows_tab_enter"
|
||||
|
||||
local tag
|
||||
tag=$( eval $DIALOG \
|
||||
--title \"\$DIALOG_TITLE\" \
|
||||
--backtitle \"\$DIALOG_BACKTITLE\" \
|
||||
--hline \"\$hline\" \
|
||||
--ok-label \"\$msg_ok\" \
|
||||
--cancel-label \"\$msg_cancel\" \
|
||||
--menu \"\$msg\" 21 60 12 \
|
||||
$supported_media \
|
||||
2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD
|
||||
)
|
||||
local retval=$?
|
||||
f_dialog_data_sanitize tag
|
||||
|
||||
if [ $retval -eq $DIALOG_OK ]; then
|
||||
options=$( eval f_dialog_menutag2item \"\$tag\" \
|
||||
$supported_media )
|
||||
case "$options" in
|
||||
"$opt_none")
|
||||
options=
|
||||
;;
|
||||
"$opt_cust")
|
||||
options="$_options"
|
||||
f_dialog_input_options "$interface"
|
||||
retval=$?
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
return $retval
|
||||
}
|
||||
|
||||
############################################################ MAIN
|
||||
|
||||
f_dprintf "%s: Successfully loaded." networking/media.subr
|
||||
|
||||
fi # ! $_NETWORKING_MEDIA_SUBR
|
137
bsdconfig/networking/share/netmask.subr
Normal file
137
bsdconfig/networking/share/netmask.subr
Normal file
@ -0,0 +1,137 @@
|
||||
if [ ! "$_NETWORKING_NETMASK_SUBR" ]; then _NETWORKING_NETMASK_SUBR=1
|
||||
#
|
||||
# Copyright (c) 2006-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
|
||||
|
||||
BSDCFG_SHARE="/usr/share/bsdconfig"
|
||||
. $BSDCFG_SHARE/common.subr || exit 1
|
||||
f_dprintf "%s: loading includes..." networking/netmask.subr
|
||||
f_include $BSDCFG_SHARE/dialog.subr
|
||||
f_include $BSDCFG_SHARE/networking/common.subr
|
||||
f_include $BSDCFG_SHARE/strings.subr
|
||||
|
||||
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="120.networking"
|
||||
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
|
||||
|
||||
############################################################ FUNCTIONS
|
||||
|
||||
# f_dialog_maskerror $error $netmask
|
||||
#
|
||||
# Display a msgbox with the appropriate error message for an error returned by
|
||||
# the f_validate_netmask function.
|
||||
#
|
||||
f_dialog_maskerror()
|
||||
{
|
||||
local error="$1" netmask="$2"
|
||||
|
||||
[ ${error:-0} -ne 0 ] || return $SUCCESS
|
||||
|
||||
case "$error" in
|
||||
1) f_show_msg "$msg_ipv4_mask_field_contains_invalid_chars" "$mask" ;;
|
||||
2) f_show_msg "$msg_ipv4_mask_field_is_null" "$mask" ;;
|
||||
3) f_show_msg "$msg_ipv4_mask_field_exceeds_max_value" "$mask" ;;
|
||||
4) f_show_msg "$msg_ipv4_mask_field_missing_or_extra" "$mask" ;;
|
||||
5) f_show_msg "$msg_ipv4_mask_field_invalid_value" "$mask" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
# f_dialog_validate_netmask $netmask
|
||||
#
|
||||
# Returns zero if the given argument (a subnet mask) is of the proper format.
|
||||
#
|
||||
# If the subnet mask is determined to be invalid, the appropriate error will be
|
||||
# displayed using the f_dialog_maskerror function above.
|
||||
#
|
||||
f_dialog_validate_netmask()
|
||||
{
|
||||
local netmask="$1"
|
||||
|
||||
f_validate_netmask "$netmask"
|
||||
local retval=$?
|
||||
|
||||
# Produce an appropriate error message if necessary.
|
||||
[ $retval -eq $SUCCESS ] || f_dialog_maskerror $retval "$netmask"
|
||||
|
||||
return $retval
|
||||
}
|
||||
|
||||
# f_dialog_input_netmask $interface $netmask
|
||||
#
|
||||
# Edits the IP netmask of the given interface.
|
||||
#
|
||||
f_dialog_input_netmask()
|
||||
{
|
||||
local interface="$1" _netmask="$2" _input
|
||||
|
||||
#
|
||||
# Return with-error when there are NFS-mounts currently active. If the
|
||||
# subnet mask is changed while NFS-exported directories are mounted,
|
||||
# the system may hang (if any NFS mounts are using that interface).
|
||||
#
|
||||
if f_nfs_mounted && ! f_jailed; then
|
||||
local setting
|
||||
f_sprintf setting "$msg_current_subnet" \
|
||||
"$interface" "$_netmask"
|
||||
f_noyes "$msg_nfs_mounts_may_cause_hang" "$setting" ||
|
||||
return $DIALOG_CANCEL
|
||||
fi
|
||||
|
||||
#
|
||||
# Loop until the user provides taint-free input.
|
||||
#
|
||||
local msg
|
||||
f_sprintf msg "$msg_please_enter_subnet_mask" "$interface"
|
||||
while :; do
|
||||
#
|
||||
# Return error status if:
|
||||
# - User has either pressed ESC or chosen Cancel/No
|
||||
# - User has not made any changes to the given value
|
||||
#
|
||||
f_dialog_input _input "$msg" "$_netmask" \
|
||||
"$hline_num_punc_tab_enter" || return $?
|
||||
[ "$_netmask" = "$_input" ] && return $DIALOG_CANCEL
|
||||
|
||||
# Return success if NULL value was entered
|
||||
[ "$_input" ] || return $DIALOG_OK
|
||||
|
||||
# Take only the first "word" of the user's input
|
||||
_netmask="$_input"
|
||||
_netmask="${_netmask%%[$IFS]*}"
|
||||
|
||||
# Taint-check the user's input
|
||||
f_dialog_validate_netmask "$_netmask" && break
|
||||
done
|
||||
|
||||
netmask="$_netmask"
|
||||
}
|
||||
|
||||
############################################################ MAIN
|
||||
|
||||
f_dprintf "%s: Successfully loaded." networking/netmask.subr
|
||||
|
||||
fi # ! $_NETWORKING_NETMASK_SUBR
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user