diff options
author | dteske <dteske@FreeBSD.org> | 2012-12-25 10:47:45 +0000 |
---|---|---|
committer | dteske <dteske@FreeBSD.org> | 2012-12-25 10:47:45 +0000 |
commit | aa703b25c09ae59c8f17176570221deed1999284 (patch) | |
tree | 3ead8d539a160fdb4f4db46d2403cb924d485ede /usr.sbin/bsdconfig/share | |
parent | 2646f7c5d89cc315500842004bb7913403ac47c6 (diff) | |
download | FreeBSD-src-aa703b25c09ae59c8f17176570221deed1999284.zip FreeBSD-src-aa703b25c09ae59c8f17176570221deed1999284.tar.gz |
Add more debugging to help with diagnosis of program-flow when needed.
Diffstat (limited to 'usr.sbin/bsdconfig/share')
-rw-r--r-- | usr.sbin/bsdconfig/share/common.subr | 36 | ||||
-rw-r--r-- | usr.sbin/bsdconfig/share/dialog.subr | 7 | ||||
-rw-r--r-- | usr.sbin/bsdconfig/share/mustberoot.subr | 5 | ||||
-rw-r--r-- | usr.sbin/bsdconfig/share/strings.subr | 2 | ||||
-rw-r--r-- | usr.sbin/bsdconfig/share/sysrc.subr | 9 |
5 files changed, 47 insertions, 12 deletions
diff --git a/usr.sbin/bsdconfig/share/common.subr b/usr.sbin/bsdconfig/share/common.subr index 4c53e49..6d56ecf 100644 --- a/usr.sbin/bsdconfig/share/common.subr +++ b/usr.sbin/bsdconfig/share/common.subr @@ -55,24 +55,25 @@ ARGV="$@" SUCCESS=0 FAILURE=1 +# +# Operating environment details +# +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) + ############################################################ FUNCTIONS # -# This is an empty function by default, to use it, copy -# /usr/share/examples/bsdconfig/bsdconfigrc to $HOME/.bsdconfigrc +# Sensible debug function. Override in ~/.bsdconfigrc if desired. +# See /usr/share/examples/bsdconfig/bsdconfigrc for example. # f_dprintf() { - : this page intentionally left blank + [ "$debug" ] || return $SUCCESS + local fmt="$1"; shift + printf "DEBUG: $fmt${fmt:+\n}" "$@" >&${TERMINAL_STDOUT_PASSTHRU:-1} } -[ "$DEBUGGING" ] && f_dprintf() -{ - local fmt="$1" - shift - printf "$fmt${fmt:+\n}" "$@" \ - >&${TERMINAL_STDOUT_PASSTHRU:-1} -} && - export DEBUGGING # f_err $fmt [ $opts ... ] # @@ -510,4 +511,17 @@ trap '' SIGALRM SIGPROF SIGUSR1 SIGUSR2 SIGHUP SIGVTALRM eval exec $TERMINAL_STDOUT_PASSTHRU\>\&1 eval exec $TERMINAL_STDERR_PASSTHRU\>\&2 +# +# Make debugging persistant if set +# +[ "$debug" ] && export debug + +# +# Log our operating environment for debugging purposes +# +f_dprintf "UNAME_S=[%s] UNAME_P=[%s] UNAME_R=[%s]" \ + "$UNAME_S" "$UNAME_P" "$UNAME_R" + +f_dprintf "%s: Successfully loaded." common.subr + fi # ! $_COMMON_SUBR diff --git a/usr.sbin/bsdconfig/share/dialog.subr b/usr.sbin/bsdconfig/share/dialog.subr index 3f4a89e..58888cb 100644 --- a/usr.sbin/bsdconfig/share/dialog.subr +++ b/usr.sbin/bsdconfig/share/dialog.subr @@ -30,6 +30,7 @@ if [ ! "$_DIALOG_SUBR" ]; then _DIALOG_SUBR=1 BSDCFG_SHARE="/usr/share/bsdconfig" . $BSDCFG_SHARE/common.subr || exit 1 +f_dprintf "%s: loading includes..." dialog.subr f_include $BSDCFG_SHARE/strings.subr BSDCFG_LIBE="/usr/libexec/bsdconfig" @@ -1473,13 +1474,19 @@ f_dialog_init() DIALOG_BACKTITLE="$_DIALOG_TITLE" unset _DIALOG_TITLE fi + + f_dprintf "f_dialog_init: dialog(1) API initialized." } ############################################################ MAIN +f_dprintf "%s: DIALOG_SELF_INITIALIZE=[%s]" \ + dialog.subr "$DIALOG_SELF_INITIALIZE" case "$DIALOG_SELF_INITIALIZE" in ""|0|[Nn][Oo]|[Oo][Ff][Ff]|[Ff][Aa][Ll][Ss][Ee]) : do nothing ;; *) f_dialog_init esac +f_dprintf "%s: Successfully loaded." dialog.subr + fi # ! $_DIALOG_SUBR diff --git a/usr.sbin/bsdconfig/share/mustberoot.subr b/usr.sbin/bsdconfig/share/mustberoot.subr index 078b950..ebce9c1 100644 --- a/usr.sbin/bsdconfig/share/mustberoot.subr +++ b/usr.sbin/bsdconfig/share/mustberoot.subr @@ -30,6 +30,7 @@ if [ ! "$_MUSTBEROOT_SUBR" ]; then _MUSTBEROOT_SUBR=1 BSDCFG_SHARE="/usr/share/bsdconfig" . $BSDCFG_SHARE/common.subr || exit 1 +f_dprintf "%s: loading includes..." mustberoot.subr f_include $BSDCFG_SHARE/dialog.subr BSDCFG_LIBE="/usr/libexec/bsdconfig" @@ -419,4 +420,8 @@ f_mustberoot_init() fi } +############################################################ MAIN + +f_dprintf "%s: Successfully loaded." mustberoot.subr + fi # ! $_MUSTBEROOT_SUBR diff --git a/usr.sbin/bsdconfig/share/strings.subr b/usr.sbin/bsdconfig/share/strings.subr index d11a9a2..6fe0f32 100644 --- a/usr.sbin/bsdconfig/share/strings.subr +++ b/usr.sbin/bsdconfig/share/strings.subr @@ -101,4 +101,6 @@ f_isinteger() ( : $((0/$arg)) ) > /dev/null 2>&1 } +f_dprintf "%s: Successfully loaded." strings.subr + fi # ! $_STRINGS_SUBR diff --git a/usr.sbin/bsdconfig/share/sysrc.subr b/usr.sbin/bsdconfig/share/sysrc.subr index 1ee70e6..36a550e 100644 --- a/usr.sbin/bsdconfig/share/sysrc.subr +++ b/usr.sbin/bsdconfig/share/sysrc.subr @@ -32,7 +32,10 @@ BSDCFG_SHARE="/usr/share/bsdconfig" [ "$_COMMON_SUBR" ] || . $BSDCFG_SHARE/common.subr || exit 1 BSDCFG_LIBE="/usr/libexec/bsdconfig" -[ ! "$_SYSRC_JAILED" ] && f_include_lang $BSDCFG_LIBE/include/messages.subr +if [ ! "$_SYSRC_JAILED" ]; then + f_dprintf "%s: loading includes..." sysrc.subr + f_include_lang $BSDCFG_LIBE/include/messages.subr +fi ############################################################ CONFIGURATION @@ -623,4 +626,8 @@ f_sysrc_delete() done } +############################################################ MAIN + +f_dprintf "%s: Successfully loaded." sysrc.subr + fi # ! $_SYSRC_SUBR |