#!/bin/bash . /usr/lib/pm-utils/functions [[ -f /usr/lib/network/network ]] || exit $NA . /usr/lib/network/network auto_resume() { if checkyesno ${RESTOREPROFILES:-no}; then all_resume sleep 2 fi restartservice net-auto-wireless restartservice net-auto-wired restartservice net-profiles } daemon_suspend_all() { stopservice net-auto-wireless stopservice net-auto-wired stopservice net-profiles } case "$1" in hibernate|suspend_hybrid|suspend) report_notify "suspending all interfaces..." daemon_suspend_all if checkyesno "${RESTOREPROFILES:-no}"; then interface_suspend all fi ;; thaw|resume) if "$CONN_DIR/wireless" query wlan0 enabled; then report_notify "resuming all interfaces..." auto_resume wlan0 else report_notify "resuming all interfaces except wireless..." all_resume wlan0 fi ;; radio_off) report_notify "suspending wireless interface..." interface_suspend wlan0 no set_iface disabled wlan0 bring_interface forcedown wlan0 ;; radio_on) report_notify "resuming wireless interface..." auto_resume wlan0 if [ -x /etc/pm/power.d/??wifi ]; then /usr/bin/on_ac_power # this is in pm-utils case $? in 0) # on ac /etc/pm/power.d/??wifi false ;; 1) # on battery /etc/pm/power.d/??wifi true ;; esac fi ;; *) ;; esac exit $? # vim: ft=sh ts=4 et sw=4: