#!/bin/sh # Action script to maintain the state of the RF KILL setting in # PCs that use ipw2200 and acerhk to control the Wireless radio # # Copyright: Copyright (c) 2009 TJ # License: GPL-2 # PATH=/sbin:/usr/sbin:/bin:/usr/bin case "${1}" in suspend|hibernate) # save state of the rfkill switch KILL="$(find /sys/devices -type f -name rf_kill)" SAVE_TO="/var/run/$(echo $KILL | tr / ^)" cat "$KILL" >"$SAVE_TO" ;; resume|thaw) # reinstate the rfkill switch state if it has changed KILL="$(find /sys/devices -type f -name rf_kill)" SAVE_TO="/var/run/$(echo $KILL | tr / ^)" SAVED_STATE=$(cat "$SAVE_TO") echo "$SAVED_STATE" > "$KILL" rm "$SAVE_TO" ;; esac