From 7fab9eaf848004fd742e0513d620ced9ee7667a2 Mon Sep 17 00:00:00 2001 From: Jouke Witteveen Date: Wed, 11 Apr 2012 02:07:20 +0200 Subject: Rewrite output hook to not depend on initscripts /etc/rc.d/functions is owned by initscripts on which netcfg does not explicitly depend. The revised layout is inspired by systemd. --- contrib/logging.hook | 13 ++++--------- contrib/pm-utils.handler | 10 +++++----- 2 files changed, 9 insertions(+), 14 deletions(-) (limited to 'contrib') diff --git a/contrib/logging.hook b/contrib/logging.hook index b7af62e..82d0ed1 100755 --- a/contrib/logging.hook +++ b/contrib/logging.hook @@ -33,20 +33,14 @@ function report_err { printhl "$*" } -function report_warn { - report_log warning "$*" - # printhl "$*" - checkyesno "$NETCFG_DEBUG" && echo "DEBUG: $*" >&2 -} - - -function report_notify { +function report_notice { report_log notice "$*" # print "$*" >&2 checkyesno "$NETCFG_DEBUG" && echo "DEBUG: $*" >&2 } + function report_debug { if checkyesno "$NETCFG_DEBUG"; then echo "DEBUG: $*" >&2 @@ -56,13 +50,13 @@ function report_debug { } - function report_try { report_log notice "trying $*..." stat_busy "$*" REPORT_TRYING=1 } + function report_fail { if [[ -n "$*" ]]; then report_log err "$*" @@ -79,6 +73,7 @@ function report_fail { fi } + function report_success { if [[ -n "$*" ]]; then stat_append "- $*" diff --git a/contrib/pm-utils.handler b/contrib/pm-utils.handler index 0ad87b3..79cad6a 100755 --- a/contrib/pm-utils.handler +++ b/contrib/pm-utils.handler @@ -29,7 +29,7 @@ daemon_suspend_all() case "$1" in hibernate|suspend_hybrid|suspend) - report_notify "suspending all interfaces..." + report_notice "suspending all interfaces..." daemon_suspend_all if checkyesno "${RESTOREPROFILES:-no}"; then interface_suspend all @@ -37,21 +37,21 @@ case "$1" in ;; thaw|resume) if [ -f "$STATE_DIR/interface/${WIRELESS_INTERFACE}" ]; then - report_notify "resuming all interfaces..." + report_notice "resuming all interfaces..." auto_resume ${WIRELESS_INTERFACE} else - report_notify "resuming all interfaces except wireless..." + report_notice "resuming all interfaces except wireless..." all_resume ${WIRELESS_INTERFACE} fi ;; radio_off) - report_notify "suspending wireless interface..." + report_notice "suspending wireless interface..." interface_suspend ${WIRELESS_INTERFACE} no set_iface disabled ${WIRELESS_INTERFACE} bring_interface forcedown ${WIRELESS_INTERFACE} ;; radio_on) - report_notify "resuming wireless interface..." + report_notice "resuming wireless interface..." auto_resume ${WIRELESS_INTERFACE} if [ -x /etc/pm/power.d/??wifi ]; then /usr/bin/on_ac_power # this is in pm-utils -- cgit v1.2.3-24-g4f1b