1
0
mirror of https://github.com/gryf/wicd.git synced 2025-12-30 10:22:31 +01:00

Added entry points for autoconnect and suspend.

Moved scripts to data directory.
This commit is contained in:
2020-08-31 21:53:43 +02:00
parent e6afb9232d
commit 780ded6802
7 changed files with 20 additions and 10 deletions

69
data/pmutils/55wicd Executable file
View File

@@ -0,0 +1,69 @@
#!/bin/sh
# pm-utils hook to handle suspend/resume properly for wicd
if [ -r "${PM_FUNCTIONS}" ]; then
. "${PM_FUNCTIONS}"
elif [ -r "${FUNCTIONS}" ]; then
. "${FUNCTIONS}"
else
# pm-utils version is too old, or something else is wrong
exit $NA
fi
RETVAL=0 # Set this to 0 initially
wicd_suspend()
{
# Put wifi interface down
wicd-suspend 1>/dev/null 2>/dev/null
RETVAL=$?
}
wicd_resume()
{
# Bring wifi interface back up
wicd-autoconnect 1>/dev/null 2>/dev/null
RETVAL=$?
}
case "$1" in
hibernate|suspend)
wicd_suspend
;;
thaw|resume)
wicd_resume
;;
*) exit $NA
;;
esac
# We can't return a nonzero exit code (aside from $NA, $DX, and $NX) to
# to pm-utils or the entire sleep operation will be inhibited, so...
# No matter what we do, the log prefix and message will conflict a bit.
case "$RETVAL" in
0)
exit $RETVAL
;;
1)
# Probably the daemon isn't running if this happens
echo "Unable to connect to wicd daemon - is it running?"
exit $DX
;;
2)
# This will occur if the daemon encounters an error
echo "Wicd daemon was unable to suspend the network."
exit $DX
;;
3)
# Will only be returned by autoconnect.py
# This should never happen, but just in case...
echo "Wicd daemon failed to autoconnect on resume."
exit $DX
;;
*)
echo "Unknown exit code."
exit $NA
;;
esac