Add new flags -d' (sets debug=1) and -D file' (sets debugFile) and

improve debugging initialization. Also fixup USAGE statements while we're
here. Also, change initialization of main program to _not_ change working
directory, allowing the debugFile to be relative without confusion.
This commit is contained in:
Devin Teske 2013-04-22 05:02:34 +00:00
parent 384875a3a6
commit e14ddd1f16
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=249746
56 changed files with 228 additions and 129 deletions

View File

@ -31,10 +31,14 @@ Usage:
@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 usage statement and exit.
-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).

View File

@ -53,6 +53,7 @@ usage()
local index="INDEX" cmd_list=""
cd $BSDCFG_LIBE
# No need to preserve CWD (headed toward exit)
# Test for language-specific indices
f_quietly ls */"$index.${LANG:-$LC_ALL}" &&
@ -131,6 +132,8 @@ usage()
f_usage $BSDCFG_LIBE/USAGE \
"PROGRAM_NAME" "$pgm" \
"COMMAND_LIST" "$cmd_list"
# Never reached
}
# dialog_menu_main
@ -152,14 +155,14 @@ dialog_menu_main()
local sanitize_awk="{ gsub(/'/, \"'\\\\''\"); print }"
local menuitem menu_title menu_help menu_selection index=2
for menuitem in $( ls -d [0-9][0-9][0-9].* ); do
for menuitem in $( cd $BSDCFG_LIBE && ls -d [0-9][0-9][0-9].* ); do
[ $index -lt ${#DIALOG_MENU_TAGS} ] || break
tag=$( f_substr "$DIALOG_MENU_TAGS" $index 1 )
menu_program=
menu_title=
menu_help=
f_include_lang $menuitem/INDEX
f_include_lang $BSDCFG_LIBE/$menuitem/INDEX
[ "$menu_program" ] || continue
case "$menu_program" in
@ -231,7 +234,7 @@ fi
# Process command-line arguments
#
scripts_loaded=0
while getopts f:hSX flag; do
while getopts dD:f:hSX flag; do
case "$flag" in
f) [ $scripts_loaded -eq 0 ] && f_include $BSDCFG_SHARE/script.subr
f_script_load "$OPTARG"
@ -254,8 +257,6 @@ f_dialog_title "$msg_main_menu"
# Incorporate rc-file if it exists
[ -f "$HOME/.bsdconfigrc" ] && f_include "$HOME/.bsdconfigrc"
cd $BSDCFG_LIBE || f_die 1 "$msg_directory_not_found" "$BSDCFG_LIBE"
#
# If a non-option argument was passed, process it as a menuitem selection...
#

View File

@ -1,4 +1,4 @@
# Copyright (c) 2012 Devin Teske
# Copyright (c) 2012-2013 Devin Teske
# All Rights Reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -27,7 +27,11 @@
Usage: bsdconfig @PROGRAM_NAME@ [OPTIONS]
OPTIONS:
-h Print usage statement and exit.
-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).

View File

@ -1,6 +1,6 @@
#!/bin/sh
#-
# Copyright (c) 2012 Devin Teske
# Copyright (c) 2012-2013 Devin Teske
# All Rights Reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -93,7 +93,7 @@ dialog_menu_main()
#
# Process command-line arguments
#
while getopts hSX flag; do
while getopts dD:hSX flag; do
case "$flag" in
h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";;
esac

View File

@ -1,6 +1,6 @@
#!/bin/sh
#-
# Copyright (c) 2012 Devin Teske
# Copyright (c) 2012-2013 Devin Teske
# All Rights Reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -101,7 +101,7 @@ dialog_menu_main()
#
# Process command-line arguments
#
while getopts hSX flag; do
while getopts dD:hSX flag; do
case "$flag" in
h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";;
esac

View File

@ -1,6 +1,6 @@
#!/bin/sh
#-
# Copyright (c) 2012 Devin Teske
# Copyright (c) 2012-2013 Devin Teske
# All Rights Reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -141,7 +141,7 @@ dialog_menu_main()
#
# Process command-line arguments
#
while getopts hSX flag; do
while getopts dD:hSX flag; do
case "$flag" in
h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";;
esac

View File

@ -1,6 +1,6 @@
#!/bin/sh
#-
# Copyright (c) 2012 Devin Teske
# Copyright (c) 2012-2013 Devin Teske
# All Rights Reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -91,7 +91,7 @@ dialog_menu_main()
#
# Process command-line arguments
#
while getopts hSX flag; do
while getopts dD:hSX flag; do
case "$flag" in
h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";;
esac

View File

@ -1,6 +1,6 @@
#!/bin/sh
#-
# Copyright (c) 2012 Devin Teske
# Copyright (c) 2012-2013 Devin Teske
# All Rights Reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -101,7 +101,7 @@ dialog_menu_main()
#
# Process command-line arguments
#
while getopts hSX flag; do
while getopts dD:hSX flag; do
case "$flag" in
h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";;
esac

View File

@ -1,6 +1,6 @@
#!/bin/sh
#-
# Copyright (c) 2012 Devin Teske
# Copyright (c) 2012-2013 Devin Teske
# All Rights Reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -93,7 +93,7 @@ dialog_menu_main()
#
# Process command-line arguments
#
while getopts hSX flag; do
while getopts dD:hSX flag; do
case "$flag" in
h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";;
esac

View File

@ -1,6 +1,6 @@
#!/bin/sh
#-
# Copyright (c) 2012 Devin Teske
# Copyright (c) 2012-2013 Devin Teske
# All Rights Reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -163,7 +163,7 @@ ttys_set_type()
#
# Process command-line arguments
#
while getopts hSX flag; do
while getopts dD:hSX flag; do
case "$flag" in
h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";;
esac

View File

@ -1,4 +1,4 @@
# Copyright (c) 2012 Devin Teske
# Copyright (c) 2012-2013 Devin Teske
# All Rights Reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -27,7 +27,11 @@
Usage: bsdconfig @PROGRAM_NAME@ [OPTIONS]
OPTIONS:
-h Print usage statement and exit.
-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).

View File

@ -1,6 +1,6 @@
#!/bin/sh
#-
# Copyright (c) 2012 Devin Teske
# Copyright (c) 2012-2013 Devin Teske
# All Rights Reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -56,7 +56,7 @@ X11TERM_OPTS=
#
# Process command-line arguments
#
while getopts hSX flag; do
while getopts dD:hSX flag; do
case "$flag" in
h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";;
esac

View File

@ -1,4 +1,4 @@
# Copyright (c) 2012 Devin Teske
# Copyright (c) 2012-2013 Devin Teske
# All Rights Reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -27,7 +27,11 @@
Usage: bsdconfig @PROGRAM_NAME@ [OPTIONS]
OPTIONS:
-h Print usage statement and exit.
-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).

View File

@ -1,6 +1,6 @@
#!/bin/sh
#-
# Copyright (c) 2012 Devin Teske
# Copyright (c) 2012-2013 Devin Teske
# All Rights Reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -56,7 +56,7 @@ X11TERM_OPTS=
#
# Process command-line arguments
#
while getopts hSX flag; do
while getopts dD:hSX flag; do
case "$flag" in
h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";;
esac

View File

@ -1,4 +1,4 @@
# Copyright (c) 2012 Devin Teske
# Copyright (c) 2012-2013 Devin Teske
# All Rights Reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -27,7 +27,7 @@
Usage: bsdconfig @PROGRAM_NAME@ [OPTIONS]
OPTIONS:
-h Print usage statement and exit.
-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.

View File

@ -1,6 +1,6 @@
#!/bin/sh
#-
# Copyright (c) 2012 Devin Teske
# Copyright (c) 2012-2013 Devin Teske
# All Rights Reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -28,6 +28,11 @@
#
############################################################ 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"

View File

@ -1,4 +1,4 @@
# Copyright (c) 2012 Devin Teske
# Copyright (c) 2012-2013 Devin Teske
# All Rights Reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -27,7 +27,11 @@
Usage: bsdconfig @PROGRAM_NAME@ [OPTIONS]
OPTIONS:
-h Print usage statement and exit.
-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).

View File

@ -1,6 +1,6 @@
#!/bin/sh
#-
# Copyright (c) 2012 Devin Teske
# Copyright (c) 2012-2013 Devin Teske
# All Rights Reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -56,7 +56,7 @@ MOUSED_PIDFILE=/var/run/moused.pid
#
# Process command-line arguments
#
while getopts hSX flag; do
while getopts dD:hSX flag; do
case "$flag" in
h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";;
esac

View File

@ -1,6 +1,6 @@
#!/bin/sh
#-
# Copyright (c) 2012 Devin Teske
# Copyright (c) 2012-2013 Devin Teske
# All Rights Reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -56,7 +56,7 @@ MOUSED_PIDFILE=/var/run/moused.pid
#
# Process command-line arguments
#
while getopts hSX flag; do
while getopts dD:hSX flag; do
case "$flag" in
h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";;
esac

View File

@ -1,6 +1,6 @@
#!/bin/sh
#-
# Copyright (c) 2012 Devin Teske
# Copyright (c) 2012-2013 Devin Teske
# All Rights Reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -56,7 +56,7 @@ MOUSED_PIDFILE=/var/run/moused.pid
#
# Process command-line arguments
#
while getopts hSX flag; do
while getopts dD:hSX flag; do
case "$flag" in
h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";;
esac

View File

@ -1,6 +1,6 @@
#!/bin/sh
#-
# Copyright (c) 2012 Devin Teske
# Copyright (c) 2012-2013 Devin Teske
# All Rights Reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -92,7 +92,7 @@ dialog_menu_main()
#
# Process command-line arguments
#
while getopts hSX flag; do
while getopts dD:hSX flag; do
case "$flag" in
h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";;
esac

View File

@ -1,6 +1,6 @@
#!/bin/sh
#-
# Copyright (c) 2012 Devin Teske
# Copyright (c) 2012-2013 Devin Teske
# All Rights Reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -93,7 +93,7 @@ dialog_menu_main()
#
# Process command-line arguments
#
while getopts hSX flag; do
while getopts dD:hSX flag; do
case "$flag" in
h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";;
esac

View File

@ -1,6 +1,6 @@
#!/bin/sh
#-
# Copyright (c) 2012 Devin Teske
# Copyright (c) 2012-2013 Devin Teske
# All Rights Reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -97,7 +97,7 @@ dialog_menu_main()
#
# Process command-line arguments
#
while getopts hSX flag; do
while getopts dD:hSX flag; do
case "$flag" in
h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";;
esac

View File

@ -1,4 +1,4 @@
# Copyright (c) 2006-2012 Devin Teske
# Copyright (c) 2006-2013 Devin Teske
# All Rights Reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -27,7 +27,11 @@
Usage: bsdconfig @PROGRAM_NAME@ [OPTIONS]
OPTIONS:
-h Print usage statement and exit.
-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).

View File

@ -1,6 +1,6 @@
#!/bin/sh
#-
# Copyright (c) 2006-2012 Devin Teske
# Copyright (c) 2006-2013 Devin Teske
# All Rights Reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -49,7 +49,7 @@ ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
#
# Process command-line arguments
#
while getopts hSX flag; do
while getopts dD:hSX flag; do
case "$flag" in
h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";;
esac

View File

@ -54,7 +54,7 @@ ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
#
# Process command-line options
#
while getopts hSX flag; do
while getopts dD:hSX flag; do
case "$flag" in
h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";;
esac

View File

@ -1,6 +1,6 @@
#!/bin/sh
#-
# Copyright (c) 2006-2012 Devin Teske
# Copyright (c) 2006-2013 Devin Teske
# All Rights Reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -49,7 +49,7 @@ ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
#
# Process command-line arguments
#
while getopts hSX flag; do
while getopts dD:hSX flag; do
case "$flag" in
h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";;
esac

View File

@ -1,6 +1,6 @@
#!/bin/sh
#-
# Copyright (c) 2006-2012 Devin Teske
# Copyright (c) 2006-2013 Devin Teske
# All Rights Reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -49,7 +49,7 @@ ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
#
# Process command-line arguments
#
while getopts hSX flag; do
while getopts dD:hSX flag; do
case "$flag" in
h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";;
esac

View File

@ -1,6 +1,6 @@
#!/bin/sh
#-
# Copyright (c) 2006-2012 Devin Teske
# Copyright (c) 2006-2013 Devin Teske
# All Rights Reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -89,7 +89,7 @@ dialog_menu_main()
#
# Process command-line arguments
#
while getopts hSX flag; do
while getopts dD:hSX flag; do
case "$flag" in
h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";;
esac

View File

@ -1,4 +1,4 @@
# Copyright (c) 2012 Devin Teske
# Copyright (c) 2012-2013 Devin Teske
# All Rights Reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -27,7 +27,11 @@
Usage: bsdconfig @PROGRAM_NAME@ [OPTIONS]
OPTIONS:
-h Print usage statement and exit.
-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).

View File

@ -1,6 +1,6 @@
#!/bin/sh
#-
# Copyright (c) 2012 Devin Teske
# Copyright (c) 2012-2013 Devin Teske
# All Rights Reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -55,7 +55,7 @@ USER_ROOT=root
#
# Process command-line arguments
#
while getopts hSX flag; do
while getopts dD:hSX flag; do
case "$flag" in
h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";;
esac

View File

@ -1,4 +1,4 @@
# Copyright (c) 2012 Devin Teske
# Copyright (c) 2012-2013 Devin Teske
# All Rights Reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -27,7 +27,11 @@
Usage: bsdconfig @PROGRAM_NAME@ [OPTIONS]
OPTIONS:
-h Print usage statement and exit.
-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).

View File

@ -1,6 +1,6 @@
#!/bin/sh
#-
# Copyright (c) 2012 Devin Teske
# Copyright (c) 2012-2013 Devin Teske
# All Rights Reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -97,7 +97,7 @@ dialog_menu_main()
#
# Process command-line arguments
#
while getopts hSX flag; do
while getopts dD:hSX flag; do
case "$flag" in
h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";;
esac

View File

@ -1,6 +1,6 @@
#!/bin/sh
#-
# Copyright (c) 2012 Devin Teske
# Copyright (c) 2012-2013 Devin Teske
# All Rights Reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -111,7 +111,7 @@ dialog_menu_main()
#
# Process command-line arguments
#
while getopts hSX flag; do
while getopts dD:hSX flag; do
case "$flag" in
h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";;
esac

View File

@ -62,6 +62,11 @@ export UNAME_S="$(uname -s)" # Operating System (i.e. FreeBSD)
export UNAME_P="$(uname -p)" # Processor Architecture (i.e. i386)
export UNAME_R="$(uname -r)" # Release Level (i.e. X.Y-RELEASE)
#
# Default behavior is to call f_debug_init() automatically when loaded.
#
: ${DEBUG_SELF_INITIALIZE=1}
############################################################ FUNCTIONS
# f_dprintf $fmt [ $opts ... ]
@ -86,6 +91,59 @@ f_dprintf()
return $SUCCESS
}
# f_debug_init
#
# Initialize debugging. Truncates $debugFile to zero bytes if set.
#
f_debug_init()
{
#
# Process stored command-line arguments
#
( set -- "$ARGV"
while getopts d flag > /dev/null; do
case "$flag" in
d) true; exit;;
\?) continue;;
esac
done
false
) && debug=1
debugFile=$( set -- "$ARGV"
while getopts D flag > /dev/null; do
case "$flag" in
D) echo "$OPTARG";;
\?) continue;;
esac
done
)
#
# Make debugging persistant if set
#
[ "$debug" ] && export debug
#
# Truncate the debug file upon. Note that we will trim a leading plus
# (`+') from the value of debugFile to support persistant meaning that
# f_dprintf() should print both to standard output and $debugFile
# (minus the leading plus, of course).
#
local _debug_file="${debugFile#+}"
if [ "$_debug_file" ]; then
if ( umask 022 && :> "$_debug_file" ); then
f_dprintf "Successfully initialized debugFile \`%s'" \
"$_debug_file"
[ "${debug+set}" ] ||
debug=1 # turn debugging on if not set
else
unset debugFile
f_dprintf "Unable to initialize debugFile \`%s'" \
"$_debug_file"
fi
fi
}
# f_err $fmt [ $opts ... ]
#
# Print a message to stderr (fd=2).
@ -615,28 +673,14 @@ eval exec $TERMINAL_STDOUT_PASSTHRU\>\&1
eval exec $TERMINAL_STDERR_PASSTHRU\>\&2
#
# Make debugging persistant if set
# Self-initialize unless requested otherwise
#
[ "$debug" ] && export debug
#
# Truncate the debug file upon initialization (now). Note that we will trim a
# leading plus (`+') from the value of debugFile to support persistant meaning
# that f_dprintf() should print both to standard output and $debugFile (minus
# the leading plus, of course).
#
_debug_file="${debugFile#+}"
if [ "$_debug_file" ]; then
if ( umask 022 && :> "$_debug_file" ); then
f_dprintf "Successfully initialized debugFile \`%s'" \
"$_debug_file"
else
unset debugFile
f_dprintf "Unable to initialize debugFile \`%s'" \
"$_debug_file"
fi
fi
unset _debug_file
f_dprintf "%s: DEBUG_SELF_INITIALIZE=[%s]" \
dialog.subr "$DEBUG_SELF_INITIALIZE"
case "$DEBUG_SELF_INITIALIZE" in
""|0|[Nn][Oo]|[Oo][Ff][Ff]|[Ff][Aa][Ll][Ss][Ee]) : do nothing ;;
*) f_debug_init
esac
#
# Log our operating environment for debugging purposes

View File

@ -1,6 +1,6 @@
if [ ! "$_MUSTBEROOT_SUBR" ]; then _MUSTBEROOT_SUBR=1
#
# Copyright (c) 2006-2012 Devin Teske
# Copyright (c) 2006-2013 Devin Teske
# All Rights Reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -250,6 +250,7 @@ f_become_root_via_sudo()
fi
# Re-execute ourselves with sudo(8)
f_dprintf "%s: Becoming root via sudo(8)..." mustberoot.subr
if [ $ARGC -gt 0 ]; then
exec sudo "$0" $ARGV
else

View File

@ -1,4 +1,4 @@
# Copyright (c) 2012 Devin Teske
# Copyright (c) 2012-2013 Devin Teske
# All Rights Reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -27,7 +27,11 @@
Usage: bsdconfig @PROGRAM_NAME@ [OPTIONS]
OPTIONS:
-h Print usage statement and exit.
-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).

View File

@ -1,6 +1,6 @@
#!/bin/sh
#-
# Copyright (c) 2012 Devin Teske
# Copyright (c) 2012-2013 Devin Teske
# All Rights Reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -276,7 +276,7 @@ dialog_input_value()
#
# Process command-line arguments
#
while getopts hSX flag; do
while getopts dD:hSX flag; do
case "$flag" in
h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";;
esac

View File

@ -1,6 +1,6 @@
#!/bin/sh
#-
# Copyright (c) 2012 Devin Teske
# Copyright (c) 2012-2013 Devin Teske
# All Rights Reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -97,7 +97,7 @@ dialog_menu_main()
#
# Process command-line arguments
#
while getopts hSX flag; do
while getopts dD:hSX flag; do
case "$flag" in
h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";;
esac

View File

@ -1,6 +1,6 @@
#!/bin/sh
#-
# Copyright (c) 2012 Devin Teske
# Copyright (c) 2012-2013 Devin Teske
# All Rights Reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -196,7 +196,7 @@ dialog_menu_main()
#
# Process command-line arguments
#
while getopts hSX flag; do
while getopts dD:hSX flag; do
case "$flag" in
h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";;
esac

View File

@ -1,6 +1,6 @@
#!/bin/sh
#-
# Copyright (c) 2012 Devin Teske
# Copyright (c) 2012-2013 Devin Teske
# All Rights Reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -269,7 +269,7 @@ dialog_menu_delete()
#
# Process command-line arguments
#
while getopts hSX flag; do
while getopts dD:hSX flag; do
case "$flag" in
h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";;
esac

View File

@ -1,6 +1,6 @@
#!/bin/sh
#-
# Copyright (c) 2012 Devin Teske
# Copyright (c) 2012-2013 Devin Teske
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -49,7 +49,7 @@ ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
#
# Process command-line arguments
#
while getopts hSX flag; do
while getopts dD:hSX flag; do
case "$flag" in
h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";;
esac

View File

@ -158,7 +158,7 @@ dialog_menu_main()
#
# Process command-line arguments
#
while getopts hSX flag; do
while getopts dD:hSX flag; do
case "$flag" in
h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";;
esac

View File

@ -1,6 +1,6 @@
#!/bin/sh
#-
# Copyright (c) 2012 Devin Teske
# Copyright (c) 2012-2013 Devin Teske
# All Rights Reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -90,7 +90,7 @@ dialog_menu_main()
#
# Process command-line arguments
#
while getopts hSX flag; do
while getopts dD:hSX flag; do
case "$flag" in
h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";;
esac

View File

@ -1,4 +1,4 @@
# Copyright (c) 2011-2012 Devin Teske
# Copyright (c) 2011-2013 Devin Teske
# All Rights Reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -26,11 +26,15 @@
Usage: bsdconfig @PROGRAM_NAME@ [-ehnrSsvX] [-C chroot_dir] [zinfo_file | zinfo_name]
OPTIONS:
-h Print usage statement and exit.
-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).
-e Only return success on exit if user selects a timezone AND
the selected timezone was successfully installed. By default
(without this flag), success is always returned unless an
error has occurred.
-h Print this usage statement and exit.
-n Do not create or copy files.
-r Reinstall the zoneinfo file installed last time. The name is
obtained from /var/db/zoneinfo.

View File

@ -1,6 +1,6 @@
#!/bin/sh
#-
# Copyright (c) 2011-2012 Devin Teske
# Copyright (c) 2011-2013 Devin Teske
# All Rights Reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -115,7 +115,7 @@ dialog_menu_main()
#
# Process command-line arguments
#
while getopts C:ehnrsSvX flag; do
while getopts C:dD:ehnrsSvX flag; do
case "$flag" in
C) CHROOTENV="$OPTARG";;
e) TZ_OR_FAIL=1;;

View File

@ -1,4 +1,4 @@
# Copyright (c) 2012 Devin Teske
# Copyright (c) 2012-2013 Devin Teske
# All Rights Reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -27,7 +27,11 @@
Usage: bsdconfig @PROGRAM_NAME@ [OPTIONS]
OPTIONS:
-h Print usage statement and exit.
-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).

View File

@ -1,6 +1,6 @@
#!/bin/sh
#-
# Copyright (c) 2012 Devin Teske
# Copyright (c) 2012-2013 Devin Teske
# All Rights Reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -67,7 +67,7 @@ ETC_TTYS=/etc/ttys
#
# Process command-line arguments
#
while getopts hSX flag; do
while getopts dD:hSX flag; do
case "$flag" in
h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";;
esac

View File

@ -1,4 +1,4 @@
# Copyright (c) 2012 Devin Teske
# Copyright (c) 2012-2013 Devin Teske
# All Rights Reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -27,7 +27,11 @@
Usage: bsdconfig @PROGRAM_NAME@ [OPTIONS]
OPTIONS:
-h Print usage statement and exit.
-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).

View File

@ -1,7 +1,7 @@
#!/bin/sh
#-
# Copyright (c) 2012 Ron McDowell
# Copyright (c) 2012 Devin Teske
# Copyright (c) 2012-2013 Devin Teske
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -47,7 +47,7 @@ ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
#
# Process command-line arguments
#
while getopts hSX flag; do
while getopts dD:hSX flag; do
case "$flag" in
h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";;
esac

View File

@ -1,7 +1,7 @@
#!/bin/sh
#-
# Copyright (c) 2012 Ron McDowell
# Copyright (c) 2012 Devin Teske
# Copyright (c) 2012-2013 Devin Teske
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -50,7 +50,7 @@ ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
#
# Process command-line arguments
#
while getopts hSX flag; do
while getopts dD:hSX flag; do
case "$flag" in
h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";;
esac

View File

@ -1,7 +1,7 @@
#!/bin/sh
#-
# Copyright (c) 2012 Ron McDowell
# Copyright (c) 2012 Devin Teske
# Copyright (c) 2012-2013 Devin Teske
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -50,7 +50,7 @@ ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
#
# Process command-line arguments
#
while getopts hSX flag; do
while getopts dD:hSX flag; do
case "$flag" in
h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";;
esac

View File

@ -1,7 +1,7 @@
#!/bin/sh
#-
# Copyright (c) 2012 Ron McDowell
# Copyright (c) 2012 Devin Teske
# Copyright (c) 2012-2013 Devin Teske
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -47,7 +47,7 @@ ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
#
# Process command-line arguments
#
while getopts hSX flag; do
while getopts dD:hSX flag; do
case "$flag" in
h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";;
esac

View File

@ -1,7 +1,7 @@
#!/bin/sh
#-
# Copyright (c) 2012 Ron McDowell
# Copyright (c) 2012 Devin Teske
# Copyright (c) 2012-2013 Devin Teske
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -50,7 +50,7 @@ ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
#
# Process command-line arguments
#
while getopts hSX flag; do
while getopts dD:hSX flag; do
case "$flag" in
h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";;
esac

View File

@ -1,7 +1,7 @@
#!/bin/sh
#-
# Copyright (c) 2012 Ron McDowell
# Copyright (c) 2012 Devin Teske
# Copyright (c) 2012-2013 Devin Teske
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -50,7 +50,7 @@ ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
#
# Process command-line arguments
#
while getopts hSX flag; do
while getopts dD:hSX flag; do
case "$flag" in
h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";;
esac

View File

@ -1,7 +1,7 @@
#!/bin/sh
#-
# Copyright (c) 2012 Ron McDowell
# Copyright (c) 2012 Devin Teske
# Copyright (c) 2012-2013 Devin Teske
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -106,7 +106,7 @@ dialog_menu_main()
#
# Process command-line arguments
#
while getopts hSX flag; do
while getopts dD:hSX flag; do
case "$flag" in
h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";;
esac