1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
|
# -*- sh -*-
# vim:ft=sh:ts=8:sw=4:noet
###
## Disconnects Wicd on suspend and connects on resume.
##
## Author: Jens Gustedt, modifications by Nigel Cunningham.
## Credits:
## Based on NetworkManager script from Markus Becker
##
###
AddConfigHandler WICDOptions
AddConfigHelp "EnableWICDReconnect <boolean>" "Disconnect and reconnect WICD before and after suspending."
WICDFindScripts() {
for NAME in /usr/lib/wicd /usr/share/wicd; do
if [ -f "${NAME}/autoconnect.py" ]; then
WICD_DIR=${NAME}
fi
done
}
WICDSuspend() {
if [ -z "$WICD_DIR" ]; then
vecho 0 "wicd directory not found, cannot signal Wicd"
return 1
fi
${WICD_DIR}/suspend.py
return 0
}
WICDResume() {
if [ -z "$WICD_DIR" ]; then
vecho 0 "wicd directory not found, cannot signal Wicd"
return 1
fi
${WICD_DIR}/autoconnect.py
return 0
}
WICDOptions() {
case $1 in
enablewicdreconnect)
WICDFindScripts
BoolIsOn "$1" "$2" && WICD_ENABLED=1 || return 0
;;
*)
return 1
esac
if [ -z "$WICD_HOOKED" ] ; then
AddSuspendHook 61 WICDSuspend
AddResumeHook 61 WICDResume
WICD_HOOKED=1
fi
return 0
}
|