summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--man/on_ac_power.sgml8
-rw-r--r--pm/functions.in13
-rwxr-xr-xpm/sleep.d/00clear4
-rwxr-xr-xpm/sleep.d/00logging2
-rw-r--r--pm/sleep.d/01grub23
-rwxr-xr-xpm/sleep.d/05led6
-rwxr-xr-xpm/sleep.d/10NetworkManager6
-rwxr-xr-xpm/sleep.d/20video4
-rwxr-xr-xpm/sleep.d/49bluetooth6
-rwxr-xr-xpm/sleep.d/50modules6
-rwxr-xr-xpm/sleep.d/65alsa6
-rwxr-xr-xpm/sleep.d/90clock4
-rwxr-xr-xpm/sleep.d/94cpufreq7
-rwxr-xr-xpm/sleep.d/95led4
-rwxr-xr-xpm/sleep.d/99video2
-rw-r--r--src/pm-action.in2
-rw-r--r--src/pm-is-supported.in4
17 files changed, 38 insertions, 69 deletions
diff --git a/man/on_ac_power.sgml b/man/on_ac_power.sgml
index a490398..398f76b 100644
--- a/man/on_ac_power.sgml
+++ b/man/on_ac_power.sgml
@@ -63,14 +63,6 @@
<para>System is not on line power.</para>
</listitem>
</varlistentry>
- <varlistentry>
- <term>
- <option>255 (false)</option>
- </term>
- <listitem>
- <para>Power status could not be determined.</para>
- </listitem>
- </varlistentry>
</variablelist>
</refsect1>
<refsect1>
diff --git a/pm/functions.in b/pm/functions.in
index 2e2703b..e0fc960 100644
--- a/pm/functions.in
+++ b/pm/functions.in
@@ -25,6 +25,7 @@ TEMPORARY_CPUFREQ_GOVERNOR="performance"
LOCKDIR="${PM_UTILS_RUNDIR}/locks"
STORAGEDIR="${PM_UTILS_RUNDIR}/storage"
SLEEP_MODULE="kernel"
+NA=254
# Use c sort order
export LC_COLLATE=C
@@ -118,8 +119,15 @@ command_exists()
return $?
}
-run_hooks()
-{
+hook_exit_status(){
+ case $1 in
+ 0) echo "success." ;;
+ $NA) echo "not applicable." ;;
+ *) echo "Returned exit code $1." ;;
+ esac
+}
+
+run_hooks() {
# $1 = type of hook to find.
# $2 = paramaters to pass to hooks.
# $3 = if present and equal to "reverse", run hooks backwards.
@@ -147,6 +155,7 @@ run_hooks()
IFS="${oifs}"
echo "$(date): running ${hook} $2"
"${hook}" $2
+ hook_exit_status $?
)
done
IFS="${oifs}"
diff --git a/pm/sleep.d/00clear b/pm/sleep.d/00clear
index b6260bd..976fc21 100755
--- a/pm/sleep.d/00clear
+++ b/pm/sleep.d/00clear
@@ -2,14 +2,10 @@
. "${PM_FUNCTIONS}"
-RETVAL=0
case "$1" in
hibernate|suspend)
TERM=linux openvt -w -s -f -c 63 -- clear >/dev/null 2>&1
- RETVAL=$?
;;
*)
;;
esac
-
-exit $RETVAL
diff --git a/pm/sleep.d/00logging b/pm/sleep.d/00logging
index 7cba5e7..7990a50 100755
--- a/pm/sleep.d/00logging
+++ b/pm/sleep.d/00logging
@@ -10,5 +10,3 @@ case "$1" in
free
;;
esac
-
-exit 0
diff --git a/pm/sleep.d/01grub b/pm/sleep.d/01grub
index 7c528ab..7fa356a 100644
--- a/pm/sleep.d/01grub
+++ b/pm/sleep.d/01grub
@@ -4,31 +4,28 @@ default_resume_kernel()
{
case $(uname -m) in
i?86|x86_64|athlon)
- ;;
+ ;;
*) # this is only valid for x86 and x86_64
- return 1
- ;;
+ return $NA
+ ;;
esac
-
- [ -x /sbin/grubby -a -x /sbin/grub ] || return 1
+
+ [ -x /sbin/grubby -a -x /sbin/grub ] || return $NA
[ -e "/boot/vmlinuz-$(uname -r)" ] || return 1
-
out=$(/sbin/grubby --info /boot/vmlinuz-$(uname -r) |grep index)
[ -n "${out}" ] || return 1
current=${out#index=}
- echo "savedefault --default=${current} --once" | /sbin/grub --batch --no-floppy --device-map=/boot/grub/device.map --no-curses >/dev/null
-
+ echo "savedefault --default=${current} --once" | \
+ /sbin/grub --device-map=/boot/grub/device.map \
+ --batch --no-floppy --no-curses >/dev/null
+
return 0
}
-RETVAL=0
case "$1" in
hibernate)
default_resume_kernel
- RETVAL=$?
;;
- *)
+ *) exit $NA
;;
esac
-
-exit $RETVAL
diff --git a/pm/sleep.d/05led b/pm/sleep.d/05led
index 5b4f7b6..84bef1b 100755
--- a/pm/sleep.d/05led
+++ b/pm/sleep.d/05led
@@ -1,6 +1,6 @@
#!/bin/sh
-[ -f /proc/acpi/ibm/led ] || exit 1
+[ -f /proc/acpi/ibm/led ] || exit $NA
case "$1" in
hibernate|suspend)
@@ -9,8 +9,6 @@ case "$1" in
thaw|resume)
echo "7 off" >/proc/acpi/ibm/led
;;
- *)
+ *) exit $NA
;;
esac
-
-exit $?
diff --git a/pm/sleep.d/10NetworkManager b/pm/sleep.d/10NetworkManager
index 9815a39..8538d6b 100755
--- a/pm/sleep.d/10NetworkManager
+++ b/pm/sleep.d/10NetworkManager
@@ -2,7 +2,7 @@
. "${PM_FUNCTIONS}"
-command_exists dbus-send || exit 1
+command_exists dbus-send || exit $NA
suspend_nm()
{
@@ -29,8 +29,6 @@ case "$1" in
thaw|resume)
resume_nm
;;
- *)
+ *) exit $NA
;;
esac
-
-exit $?
diff --git a/pm/sleep.d/20video b/pm/sleep.d/20video
index 709226c..05d91ee 100755
--- a/pm/sleep.d/20video
+++ b/pm/sleep.d/20video
@@ -25,7 +25,7 @@ suspend_video()
{
# 0=nothing, 1=s3_bios, 2=s3_mode, 3=both
if [ "${DISPLAY_QUIRK_S3_BIOS}" = "true" -a \
- "${DISPLAY_QUIRK_S3_MODE}" = "true" ]; then
+ "${DISPLAY_QUIRK_S3_MODE}" = "true" ]; then
sysctl -w kernel.acpi_video_flags=3
elif [ "${DISPLAY_QUIRK_S3_BIOS}" = "true" ]; then
sysctl -w kernel.acpi_video_flags=1
@@ -65,5 +65,3 @@ case "$1" in
fi
;;
esac
-
-exit $?
diff --git a/pm/sleep.d/49bluetooth b/pm/sleep.d/49bluetooth
index 0c72b8f..5fcb04c 100755
--- a/pm/sleep.d/49bluetooth
+++ b/pm/sleep.d/49bluetooth
@@ -2,7 +2,7 @@
. "${PM_FUNCTIONS}"
-[ -f /proc/acpi/ibm/bluetooth ] || exit 1
+[ -f /proc/acpi/ibm/bluetooth ] || exit $NA
suspend_bluetooth()
{
@@ -29,8 +29,6 @@ case "$1" in
thaw|resume)
resume_bluetooth
;;
- *)
+ *) exit $NA
;;
esac
-
-exit $?
diff --git a/pm/sleep.d/50modules b/pm/sleep.d/50modules
index 946bcee..338529b 100755
--- a/pm/sleep.d/50modules
+++ b/pm/sleep.d/50modules
@@ -4,7 +4,7 @@
suspend_modules()
{
- [ -z "$SUSPEND_MODULES" ] && return 0
+ [ -z "$SUSPEND_MODULES" ] && return $NA
for x in $SUSPEND_MODULES ; do
modunload $x
done
@@ -23,8 +23,6 @@ case "$1" in
thaw|resume)
resume_modules
;;
- *)
+ *) exit $NA
;;
esac
-
-exit $?
diff --git a/pm/sleep.d/65alsa b/pm/sleep.d/65alsa
index 35da00d..5fc729e 100755
--- a/pm/sleep.d/65alsa
+++ b/pm/sleep.d/65alsa
@@ -2,7 +2,7 @@
. "${PM_FUNCTIONS}"
-command_exists alsactl || exit 1
+command_exists alsactl || exit $NA
case "$1" in
hibernate|suspend)
@@ -11,8 +11,6 @@ case "$1" in
thaw|resume)
alsactl restore 0 >/dev/null 2>&1
;;
- *)
+ *) exit $NA
;;
esac
-
-exit $?
diff --git a/pm/sleep.d/90clock b/pm/sleep.d/90clock
index de27a16..f69c8c9 100755
--- a/pm/sleep.d/90clock
+++ b/pm/sleep.d/90clock
@@ -31,8 +31,6 @@ case "$1" in
thaw|resume)
resume_clock
;;
- *)
+ *) exit $NA
;;
esac
-
-exit $?
diff --git a/pm/sleep.d/94cpufreq b/pm/sleep.d/94cpufreq
index 2783c74..12dfc1f 100755
--- a/pm/sleep.d/94cpufreq
+++ b/pm/sleep.d/94cpufreq
@@ -2,8 +2,7 @@
. "${PM_FUNCTIONS}"
-
-[ -d /sys/devices/system/cpu/ ] || exit 1
+[ -d /sys/devices/system/cpu/ ] || exit $NA
hibernate_cpufreq()
{
@@ -35,8 +34,6 @@ case "$1" in
resume|thaw)
thaw_cpufreq
;;
- *)
+ *) exit $NA
;;
esac
-
-exit $?
diff --git a/pm/sleep.d/95led b/pm/sleep.d/95led
index d1d769d..20fb64a 100755
--- a/pm/sleep.d/95led
+++ b/pm/sleep.d/95led
@@ -1,6 +1,6 @@
#!/bin/sh
-[ -f /proc/acpi/ibm/led ] || exit 1
+[ -f /proc/acpi/ibm/led ] || exit $NA
case "$1" in
thaw|resume)
@@ -10,4 +10,4 @@ case "$1" in
;;
esac
-exit $?
+exit $NA
diff --git a/pm/sleep.d/99video b/pm/sleep.d/99video
index bd01662..2797a06 100755
--- a/pm/sleep.d/99video
+++ b/pm/sleep.d/99video
@@ -90,5 +90,3 @@ case "$1" in
fi
;;
esac
-
-exit $?
diff --git a/src/pm-action.in b/src/pm-action.in
index 990f03c..787ad01 100644
--- a/src/pm-action.in
+++ b/src/pm-action.in
@@ -108,5 +108,3 @@ rm -f "${INHIBIT}"
run_hooks sleep "$ACTION"
"do_$ACTION"
reverse "$REVERSE"
-
-exit $?
diff --git a/src/pm-is-supported.in b/src/pm-is-supported.in
index 9e72f9f..bfce1ae 100644
--- a/src/pm-is-supported.in
+++ b/src/pm-is-supported.in
@@ -28,10 +28,8 @@ ARG="$(echo ${1#--}|tr - _)"
case "$ARG" in
suspend|hibernate|suspend_hybrid)
- "check_$ARG"; exit $? ;;
+ "check_$ARG" ;;
help) help_options ;;
*) help_options 1>&2
exit 1 ;;
esac
-
-exit 0