Make condition checking in (20|99)video POSIX compliant, and modify
vbe() and radeon() to only check for the existence of (vbe|radeon)tool
once per hook invocation instead of once per function invocation.
diff -U 0 -rNX diffignore pm-utils.updates/pm/sleep.d/20video working/pm/sleep.d/20video
--- pm-utils.updates/pm/sleep.d/20video 2008-01-27 11:58:02.000000000 -0600
+++ working/pm/sleep.d/20video 2008-01-27 13:18:59.000000000 -0600
@@ -12,17 +12,11 @@
-vbetool=$(type -p vbetool)
-vbe() {
- if [ -z "$vbetool" ]; then
- echo "vbetool not found" 1>&2
- return 1
- fi
- $vbetool "$@"
-}
-
-radeontool=$(type -p radeontool)
-radeon() {
- if [ -z "$radeontool" ]; then
- echo "radeontool not found" 1>&2
- return 1
- fi
- $radeontool "$@"
-}
+if type vbetool |grep -q "not found" ; then
+ vbe() { echo "vbetool not found" 1>&2; return 1; }
+else
+ vbe() { vbetool "$@"; }
+fi
+
+if type radeontool |grep -q "not found" ; then
+ radeon() { echo "radeontool not found" 1>&2; return 1; }
+else
+ radeon() { radeontool "$@"; }
+fi
@@ -33,2 +27,2 @@
- if [ "${DISPLAY_QUIRK_S3_BIOS}" == "true" -a \
- "${DISPLAY_QUIRK_S3_MODE}" == "true" ]; then
+ if [ "${DISPLAY_QUIRK_S3_BIOS}" = "true" -a \
+ "${DISPLAY_QUIRK_S3_MODE}" = "true" ]; then
@@ -36 +30 @@
- elif [ "${DISPLAY_QUIRK_S3_BIOS}" == "true" ]; then
+ elif [ "${DISPLAY_QUIRK_S3_BIOS}" = "true" ]; then
@@ -38 +32 @@
- elif [ "${DISPLAY_QUIRK_S3_MODE}" == "true" ]; then
+ elif [ "${DISPLAY_QUIRK_S3_MODE}" = "true" ]; then
@@ -45 +39 @@
- if [ "${DISPLAY_QUIRK_RADEON_OFF}" == "true" ]; then
+ if [ "${DISPLAY_QUIRK_RADEON_OFF}" = "true" ]; then
@@ -49 +43 @@
- if [ "${DISPLAY_QUIRK_VBESTATE_RESTORE}" == "true" ]; then
+ if [ "${DISPLAY_QUIRK_VBESTATE_RESTORE}" = "true" ]; then
@@ -52 +46 @@
- if [ "${DISPLAY_QUIRK_VBEMODE_RESTORE}" == "true" ]; then
+ if [ "${DISPLAY_QUIRK_VBEMODE_RESTORE}" = "true" ]; then
@@ -55 +49 @@
- if [ "${DISPLAY_QUIRK_VGA_MODE_3}" == "true" ]; then
+ if [ "${DISPLAY_QUIRK_VGA_MODE_3}" = "true" ]; then
@@ -58 +52 @@
- if [ "${DISPLAY_QUIRK_DPMS_SUSPEND}" == "true" ]; then
+ if [ "${DISPLAY_QUIRK_DPMS_SUSPEND}" = "true" ]; then
@@ -69 +63 @@
- if [ "x$HIBERNATE_RESUME_POST_VIDEO" == "xyes" ]; then
+ if [ "$HIBERNATE_RESUME_POST_VIDEO" = "yes" ]; then
diff -U 0 -rNX diffignore pm-utils.updates/pm/sleep.d/99video working/pm/sleep.d/99video
--- pm-utils.updates/pm/sleep.d/99video 2008-01-27 11:58:02.000000000 -0600
+++ working/pm/sleep.d/99video 2008-01-27 13:14:27.000000000 -0600
@@ -15 +14,0 @@
- [ -d $bl ] || continue
@@ -23,17 +22,11 @@
-vbetool=$(type -p vbetool)
-vbe() {
- if [ -z "$vbetool" ]; then
- echo "vbetool not found" 1>&2
- return 1
- fi
- $vbetool "$@"
-}
-
-radeontool=$(type -p radeontool)
-radeon() {
- if [ -z "$radeontool" ]; then
- echo "radeontool not found" 1>&2
- return 1
- fi
- $radeontool "$@"
-}
+if type vbetool |grep -q "not found"; then
+ vbe() { echo "vbetool not installed!" 1>&2; return 1; }
+else
+ vbe() { vbetool "$@"; }
+fi
+
+if type radeontool |grep -q "not found"; then
+ radeon() { echo "radeontool not found" 1>&2; return 1; }
+else
+ radeon() { radeontool "$@"; }
+fi
@@ -43 +36 @@
- if [ "${DISPLAY_QUIRK_RADEON_OFF}" == "true" ]; then
+ if [ "${DISPLAY_QUIRK_RADEON_OFF}" = "true" ]; then
@@ -48 +41 @@
- if [ "${DISPLAY_QUIRK_VBE_POST}" == "true" ]; then
+ if [ "${DISPLAY_QUIRK_VBE_POST}" = "true" ]; then
@@ -52 +45 @@
- if [ "${DISPLAY_QUIRK_VBESTATE_RESTORE}" == "true" ]; then
+ if [ "${DISPLAY_QUIRK_VBESTATE_RESTORE}" = "true" ]; then
@@ -55,2 +48,2 @@
- if [ "${DISPLAY_QUIRK_VBEMODE_RESTORE}" == "true" ]; then
- vbe vbemode set `cat /var/run/vbemode`
+ if [ "${DISPLAY_QUIRK_VBEMODE_RESTORE}" = "true" ]; then
+ vbe vbemode set $(cat /var/run/vbemode)
@@ -58 +51 @@
- if [ "${DISPLAY_QUIRK_DPMS_ON}" == "true" ]; then
+ if [ "${DISPLAY_QUIRK_DPMS_ON}" = "true" ]; then
@@ -61 +54 @@
- if [ "${DISPLAY_QUIRK_RESET_BRIGHTNESS}" == "true" ]; then
+ if [ "${DISPLAY_QUIRK_RESET_BRIGHTNESS}" = "true" ]; then
@@ -72 +65 @@
- if [ "x$HIBERNATE_RESUME_POST_VIDEO" == "xyes" ]; then
+ if [ "$HIBERNATE_RESUME_POST_VIDEO" = "yes" ]; then
_______________________________________________
Pm-utils mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/pm-utils