This patch series applies some more minor cleanups on top of current git.
The only ordering dependency is that the patch which introduces
command_exists has to be applied before any of the patches that use
it.
I am especially interested in a more robust version of 0003.
From 21cc1e1c172b6fa2bd282c41b1fbccc48e608b1c Mon Sep 17 00:00:00 2001
From: Victor Lowther <[EMAIL PROTECTED]>
Date: Tue, 29 Jan 2008 13:55:17 -0600
Subject: [PATCH] Get rid of extraneous shell evals.
The commands will have their output redirected appropriately.
---
pm/sleep.d/00logging | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/pm/sleep.d/00logging b/pm/sleep.d/00logging
index 563745a..61285fe 100755
--- a/pm/sleep.d/00logging
+++ b/pm/sleep.d/00logging
@@ -5,9 +5,9 @@
case "$1" in
hibernate|suspend)
[ -n "$PM_LOGFILE" ] || exit 0
- echo -e "Kernel version: `/bin/uname -a`\n"
- echo -e "`lsmod`\n"
- echo -e "`free`\n"
+ /bin/uname -a
+ lsmod
+ free
;;
esac
--
1.5.3.8
From fd9ee75a77bf14c9826fadefb66e86af98360f03 Mon Sep 17 00:00:00 2001
From: Victor Lowther <[EMAIL PROTECTED]>
Date: Tue, 29 Jan 2008 14:28:29 -0600
Subject: [PATCH] Make 05led exit 1 iff we are not running on an IBM system.
This will cause it to be skipped on resume if we are on a system
that does not need it.
---
pm/sleep.d/05led | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/pm/sleep.d/05led b/pm/sleep.d/05led
index f1c4201..58dbbfd 100755
--- a/pm/sleep.d/05led
+++ b/pm/sleep.d/05led
@@ -1,6 +1,6 @@
#!/bin/sh
-[ -f /proc/acpi/ibm/led ] || exit 0
+[ -f /proc/acpi/ibm/led ] || exit 1
case "$1" in
hibernate|suspend)
--
1.5.3.8
From ccf72b774837ac9fdd5a56054376e2939a8a32ee Mon Sep 17 00:00:00 2001
From: Victor Lowther <[EMAIL PROTECTED]>
Date: Tue, 29 Jan 2008 14:32:27 -0600
Subject: [PATCH] Add a function to test for the existence of a command, either a
function, executable, or shell builtin.
---
pm/functions | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/pm/functions b/pm/functions
index 05409fe..6c27a6d 100755
--- a/pm/functions
+++ b/pm/functions
@@ -92,6 +92,15 @@ remove_suspend_lock()
release_lock "${LOCK}"
}
+
+command_exists()
+{
+ # $1 = command to test for. It can be an executable in the path,
+ # a shell function, or a shell builtin.
+ type "$1" | grep -q -v "not found"
+ return $?
+}
+
find_hooks() {
# $1 = type of hook to find.
# Currently only power and sleep are meaningful.
--
1.5.3.8
From 434e1b85f571e3ecbb8b7e43f93ce5de922f587c Mon Sep 17 00:00:00 2001
From: Victor Lowther <[EMAIL PROTECTED]>
Date: Tue, 29 Jan 2008 14:37:20 -0600
Subject: [PATCH] Use the command_exists utility function instead of
directly calling type thing |grep -q "not found".
---
pm/functions | 2 +-
pm/sleep.d/20video | 4 ++--
pm/sleep.d/99video | 4 ++--
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/pm/functions b/pm/functions
index 6c27a6d..beb7826 100755
--- a/pm/functions
+++ b/pm/functions
@@ -255,7 +255,7 @@ modreload()
done
}
-if type service |grep -q "not found"; then
+if ! command_exists service; then
service() {
if [ -x "/etc/init.d/$1" ]; then
"/etc/init.d/$@"
diff --git a/pm/sleep.d/20video b/pm/sleep.d/20video
index 41e79ad..1beee57 100755
--- a/pm/sleep.d/20video
+++ b/pm/sleep.d/20video
@@ -9,13 +9,13 @@
. /usr/lib/pm-utils/functions
-if type vbetool |grep -q "not found" ; then
+if ! command_exists vbetool; then
vbe() { echo "vbetool not found" 1>&2; return 1; }
else
vbe() { vbetool "$@"; }
fi
-if type radeontool |grep -q "not found" ; then
+if ! command_exists radeontool; then
radeon() { echo "radeontool not found" 1>&2; return 1; }
else
radeon() { radeontool "$@"; }
diff --git a/pm/sleep.d/99video b/pm/sleep.d/99video
index cbba76f..9d06505 100755
--- a/pm/sleep.d/99video
+++ b/pm/sleep.d/99video
@@ -19,13 +19,13 @@ reset_brightness() {
done
}
-if type vbetool |grep -q "not found"; then
+if command_esists vbetool; then
vbe() { echo "vbetool not installed!" 1>&2; return 1; }
else
vbe() { vbetool "$@"; }
fi
-if type radeontool |grep -q "not found"; then
+if command_exists radeontool; then
radeon() { echo "radeontool not found" 1>&2; return 1; }
else
radeon() { radeontool "$@"; }
--
1.5.3.8
From b1adc6068f43fd04386bcfc2d6eb53e6ce9b86de Mon Sep 17 00:00:00 2001
From: Victor Lowther <[EMAIL PROTECTED]>
Date: Tue, 29 Jan 2008 14:39:50 -0600
Subject: [PATCH] Do not do anything in 10NetworkManager if dbus-send does not exist.
---
pm/sleep.d/10NetworkManager | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/pm/sleep.d/10NetworkManager b/pm/sleep.d/10NetworkManager
index f9eeb91..3e018ec 100755
--- a/pm/sleep.d/10NetworkManager
+++ b/pm/sleep.d/10NetworkManager
@@ -2,6 +2,8 @@
. /usr/lib/pm-utils/functions
+command_exists dbus-send || exit 1
+
suspend_nm() {
# Tell NetworkManager to shut down networking
dbus-send --system \
--
1.5.3.8
From 1f75314636bd85d3000c22fd990e1492579aa831 Mon Sep 17 00:00:00 2001
From: Victor Lowther <[EMAIL PROTECTED]>
Date: Tue, 29 Jan 2008 14:42:12 -0600
Subject: [PATCH] move the sanity check in 49bluetooth outside the suspend function.
---
pm/sleep.d/49bluetooth | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/pm/sleep.d/49bluetooth b/pm/sleep.d/49bluetooth
index 57ed8ee..bab680a 100755
--- a/pm/sleep.d/49bluetooth
+++ b/pm/sleep.d/49bluetooth
@@ -2,9 +2,10 @@
. /usr/lib/pm-utils/functions
+[ -f /proc/acpi/ibm/bluetooth ] || exit 1
+
suspend_bluetooth()
{
- [ -f /proc/acpi/ibm/bluetooth ] || return 1
savestate ibm_bluetooth "$(awk '{ print $2 ; exit; }' /proc/acpi/ibm/bluetooth)"
echo disable > /proc/acpi/ibm/bluetooth
}
--
1.5.3.8
From c327f9ef20032923bcea3b0edc3574929413130d Mon Sep 17 00:00:00 2001
From: Victor Lowther <[EMAIL PROTECTED]>
Date: Tue, 29 Jan 2008 14:46:08 -0600
Subject: [PATCH] Deleted commented-out commands, minor quotation fixes to 55battery.
---
pm/sleep.d/55battery | 8 ++------
1 files changed, 2 insertions(+), 6 deletions(-)
diff --git a/pm/sleep.d/55battery b/pm/sleep.d/55battery
index 680cee4..e5f3758 100755
--- a/pm/sleep.d/55battery
+++ b/pm/sleep.d/55battery
@@ -5,13 +5,9 @@
resume_batteries()
{
for x in $(hal-find-by-capability --capability battery 2>/dev/null); do
-# hal-set-property --udi "$x" --key battery.present --bool false
-# dbus-send --print-reply --system --reply-timeout=2000 \
-# --dest=org.freedesktop.Hal $x \
-# org.freedesktop.Hal.Device.Reprobe string:$x
dbus-send --print-reply --system --reply-timeout=2000 \
- --dest=org.freedesktop.Hal $x \
- org.freedesktop.Hal.Device.Rescan string:$x
+ --dest=org.freedesktop.Hal "$x" \
+ org.freedesktop.Hal.Device.Rescan "string:$x"
done
}
--
1.5.3.8
From f789b66197e4b44c8193f29a1affd859bb0095e9 Mon Sep 17 00:00:00 2001
From: Victor Lowther <[EMAIL PROTECTED]>
Date: Tue, 29 Jan 2008 14:47:49 -0600
Subject: [PATCH] Don't do anything in 65alsa if there is no alsactl command.
---
pm/sleep.d/65alsa | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/pm/sleep.d/65alsa b/pm/sleep.d/65alsa
index 68400db..0762436 100755
--- a/pm/sleep.d/65alsa
+++ b/pm/sleep.d/65alsa
@@ -2,6 +2,8 @@
. /usr/lib/pm-utils/functions
+command_exists alsactl || exit 1
+
case "$1" in
hibernate|suspend)
alsactl store 0 >/dev/null 2>&1
--
1.5.3.8
From 0e9fc443d434657e4b4497167a8f5a010bc00fdf Mon Sep 17 00:00:00 2001
From: Victor Lowther <[EMAIL PROTECTED]>
Date: Tue, 29 Jan 2008 15:13:38 -0600
Subject: [PATCH] in 94cpufreq, just exit outright if /sys/devices/system/cpu/ is not present.
---
pm/sleep.d/94cpufreq | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/pm/sleep.d/94cpufreq b/pm/sleep.d/94cpufreq
index 0c03400..01ef390 100755
--- a/pm/sleep.d/94cpufreq
+++ b/pm/sleep.d/94cpufreq
@@ -2,9 +2,11 @@
. /usr/lib/pm-utils/functions
+
+[ -d /sys/devices/system/cpu/ ] || exit 1
+
hibernate_cpufreq()
{
- [ -d /sys/devices/system/cpu/ ] || return 1
( cd /sys/devices/system/cpu/
for x in cpu[0-9]* ; do
[ -f "$x/cpufreq/scaling_governor" ] || continue
--
1.5.3.8
From 2067cdaead3d556372ddf8ae636af5c04e76b210 Mon Sep 17 00:00:00 2001
From: Victor Lowther <[EMAIL PROTECTED]>
Date: Tue, 29 Jan 2008 15:14:48 -0600
Subject: [PATCH] Made zzz executable.
---
0 files changed, 0 insertions(+), 0 deletions(-)
mode change 100644 => 100755 pm/sleep.d/zzz
diff --git a/pm/sleep.d/zzz b/pm/sleep.d/zzz
old mode 100644
new mode 100755
--
1.5.3.8
From a59c3345ff4e78c15951a24033c9dad5b5386448 Mon Sep 17 00:00:00 2001
From: Victor Lowther <[EMAIL PROTECTED]>
Date: Tue, 29 Jan 2008 15:16:24 -0600
Subject: [PATCH] Added entries in .gitignore to ignore vim backup and swap files.
---
.gitignore | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/.gitignore b/.gitignore
index 0e4b33c..62ce4ad 100644
--- a/.gitignore
+++ b/.gitignore
@@ -31,4 +31,5 @@ intl
macros
INSTALL
*.tar.*
-
+*~
+*.swp
--
1.5.3.8
_______________________________________________
Pm-utils mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/pm-utils