diff options
author | Jouke Witteveen <j.witteveen@gmail.com> | 2012-04-11 02:07:20 +0200 |
---|---|---|
committer | Jouke Witteveen <j.witteveen@gmail.com> | 2012-04-11 11:40:18 +0200 |
commit | 7fab9eaf848004fd742e0513d620ced9ee7667a2 (patch) | |
tree | 2470a3a6643e5ae2cf3d89c50998b92cfffc86db /contrib | |
parent | fda34d4a6c03e919786b26876d6a9c051119db1d (diff) | |
download | netctl-7fab9eaf848004fd742e0513d620ced9ee7667a2.tar.gz netctl-7fab9eaf848004fd742e0513d620ced9ee7667a2.tar.xz |
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.
Diffstat (limited to 'contrib')
-rwxr-xr-x | contrib/logging.hook | 13 | ||||
-rwxr-xr-x | contrib/pm-utils.handler | 10 |
2 files changed, 9 insertions, 14 deletions
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 |