Try 2 -- this time with real automake support.
Sorry for the size of the patch -- lots of file renames, doncha know.
The real changes are in pm/sleep.d/Makefile.am and src/Makefile.am
Also sorry that the changes are fugly -- my small amount of research
did not come up with a way of writing a rule that says "Transform all
these files at once, make!"
The patch should apply cleanly to git head.
On Jan 30, 2008 9:39 AM, Victor Lowther <[EMAIL PROTECTED]> wrote:
> On Jan 30, 2008 3:48 AM, Michael Biebl <[EMAIL PROTECTED]> wrote:
> > 2008/1/30, Victor Lowther <[EMAIL PROTECTED]>:
> >
> > > The attached patch removes our depencence on a hardcoded path to
> > > pm/functions. It modifies Makefile.am in the src and pm/sleep.d
> > > directories to have make install rewrite the installed scripts to
> > > source the final installation location of pm/functions, not the
> > > hardcoded path.
> > >
> > > One interesting thing to note is that the scripts are considered data
> > > by the autotools process, so all that install-exec-(local|hook) stuff
> > > has been incorrect for the lifetime of pm-utils so far.
> > >
> > > I would like some review and testing -- it Works For Me, but I am an
> > > autotools n00b and probably missed something.
> >
> > I'd rather not implement it this way (besides that your implementation
> > currently ignores DESTDIR).
> > Usually, such things are done a bit differently, using *.in files that
> > are processed during make time.
> > So you'd have e.g pm/functions.in and in pm/Makefile.am
> >
> > functions: functions.in
> > $(edit) $< >$@
> >
> > edit = sed \
> > -e 's|@[EMAIL PROTECTED]|$(libdir)/pm-utils|g'
> >
> > CLEANFILES = functions
> > ...
>
> Thanks for the pointers -- I will investigate using this method to
> make the scripts and hooks location-independent. If you kmnow of a
> package that already does similar hacks, a pointer to it for study
> purposes would be greatly appreciated.
>
>
> > Michael
> >
> > --
> > Why is it that all of the instruments seeking intelligent life in the
> > universe are pointed away from Earth?
> >
>
diff --git a/pm/sleep.d/00clear b/pm/sleep.d/00clear
deleted file mode 100755
index b96e0a7..0000000
--- a/pm/sleep.d/00clear
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/sh
-
-. /usr/lib/pm-utils/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/00clear.in b/pm/sleep.d/00clear.in
new file mode 100755
index 0000000..fac3496
--- /dev/null
+++ b/pm/sleep.d/00clear.in
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+. @PM-UTILS-LIBDIR@/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
deleted file mode 100755
index 61285fe..0000000
--- a/pm/sleep.d/00logging
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/sh
-
-. /usr/lib/pm-utils/functions
-
-case "$1" in
- hibernate|suspend)
- [ -n "$PM_LOGFILE" ] || exit 0
- /bin/uname -a
- lsmod
- free
- ;;
-esac
-
-exit 0
diff --git a/pm/sleep.d/00logging.in b/pm/sleep.d/00logging.in
new file mode 100755
index 0000000..a77b407
--- /dev/null
+++ b/pm/sleep.d/00logging.in
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+. @PM-UTILS-LIBDIR@/functions
+
+case "$1" in
+ hibernate|suspend)
+ [ -n "$PM_LOGFILE" ] || exit 0
+ /bin/uname -a
+ lsmod
+ free
+ ;;
+esac
+
+exit 0
diff --git a/pm/sleep.d/01grub b/pm/sleep.d/01grub
deleted file mode 100644
index 4500c39..0000000
--- a/pm/sleep.d/01grub
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/bin/sh
-
-default_resume_kernel()
-{
- case $(uname -m) in
- i?86|x86_64|athlon)
- ;;
- *) # this is only valid for x86 and x86_64
- return 1
- esac
-
- [ -x /sbin/grubby -a -x /sbin/grub ] || return 1
- [ -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
-
- return 0
-}
-
-RETVAL=0
-case "$1" in
- hibernate)
- default_resume_kernel
- RETVAL=$?
- ;;
- *)
- ;;
-esac
-
-exit $RETVAL
diff --git a/pm/sleep.d/01grub.in b/pm/sleep.d/01grub.in
new file mode 100644
index 0000000..4500c39
--- /dev/null
+++ b/pm/sleep.d/01grub.in
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+default_resume_kernel()
+{
+ case $(uname -m) in
+ i?86|x86_64|athlon)
+ ;;
+ *) # this is only valid for x86 and x86_64
+ return 1
+ esac
+
+ [ -x /sbin/grubby -a -x /sbin/grub ] || return 1
+ [ -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
+
+ return 0
+}
+
+RETVAL=0
+case "$1" in
+ hibernate)
+ default_resume_kernel
+ RETVAL=$?
+ ;;
+ *)
+ ;;
+esac
+
+exit $RETVAL
diff --git a/pm/sleep.d/05led b/pm/sleep.d/05led
deleted file mode 100755
index 58dbbfd..0000000
--- a/pm/sleep.d/05led
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/sh
-
-[ -f /proc/acpi/ibm/led ] || exit 1
-
-case "$1" in
- hibernate|suspend)
- { echo "7 blink" >/proc/acpi/ibm/led ; } 2>/dev/null
- ;;
- thaw|resume)
- { echo "7 off" >/proc/acpi/ibm/led ; } 2>/dev/null
- ;;
- *)
- ;;
-esac
-
-exit $?
diff --git a/pm/sleep.d/05led.in b/pm/sleep.d/05led.in
new file mode 100755
index 0000000..58dbbfd
--- /dev/null
+++ b/pm/sleep.d/05led.in
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+[ -f /proc/acpi/ibm/led ] || exit 1
+
+case "$1" in
+ hibernate|suspend)
+ { echo "7 blink" >/proc/acpi/ibm/led ; } 2>/dev/null
+ ;;
+ thaw|resume)
+ { echo "7 off" >/proc/acpi/ibm/led ; } 2>/dev/null
+ ;;
+ *)
+ ;;
+esac
+
+exit $?
diff --git a/pm/sleep.d/10NetworkManager b/pm/sleep.d/10NetworkManager
deleted file mode 100755
index 3e018ec..0000000
--- a/pm/sleep.d/10NetworkManager
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/bin/sh
-
-. /usr/lib/pm-utils/functions
-
-command_exists dbus-send || exit 1
-
-suspend_nm() {
- # Tell NetworkManager to shut down networking
- dbus-send --system \
- --dest=org.freedesktop.NetworkManager \
- /org/freedesktop/NetworkManager \
- org.freedesktop.NetworkManager.sleep
-}
-
-resume_nm() {
- # Wake up NetworkManager and make it do a new connection
- dbus-send --system \
- --dest=org.freedesktop.NetworkManager \
- /org/freedesktop/NetworkManager \
- org.freedesktop.NetworkManager.wake
-}
-
-case "$1" in
- hibernate|suspend)
- suspend_nm
- ;;
- thaw|resume)
- resume_nm
- ;;
- *)
- ;;
-esac
-
-exit $?
diff --git a/pm/sleep.d/10NetworkManager.in b/pm/sleep.d/10NetworkManager.in
new file mode 100755
index 0000000..96e77c8
--- /dev/null
+++ b/pm/sleep.d/10NetworkManager.in
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+. @PM-UTILS-LIBDIR@/functions
+
+command_exists dbus-send || exit 1
+
+suspend_nm() {
+ # Tell NetworkManager to shut down networking
+ dbus-send --system \
+ --dest=org.freedesktop.NetworkManager \
+ /org/freedesktop/NetworkManager \
+ org.freedesktop.NetworkManager.sleep
+}
+
+resume_nm() {
+ # Wake up NetworkManager and make it do a new connection
+ dbus-send --system \
+ --dest=org.freedesktop.NetworkManager \
+ /org/freedesktop/NetworkManager \
+ org.freedesktop.NetworkManager.wake
+}
+
+case "$1" in
+ hibernate|suspend)
+ suspend_nm
+ ;;
+ thaw|resume)
+ resume_nm
+ ;;
+ *)
+ ;;
+esac
+
+exit $?
diff --git a/pm/sleep.d/20video b/pm/sleep.d/20video
deleted file mode 100755
index 1beee57..0000000
--- a/pm/sleep.d/20video
+++ /dev/null
@@ -1,69 +0,0 @@
-#!/bin/sh
-#
-# Copyright 2006-2007 Richard Hughes <[EMAIL PROTECTED]>
-# Copyright 2007 Peter Jones <[EMAIL PROTECTED]>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of version 2 of the GNU General Public License as
-# published by the Free Software Foundation.
-
-. /usr/lib/pm-utils/functions
-
-if ! command_exists vbetool; then
- vbe() { echo "vbetool not found" 1>&2; return 1; }
-else
- vbe() { vbetool "$@"; }
-fi
-
-if ! command_exists radeontool; then
- radeon() { echo "radeontool not found" 1>&2; return 1; }
-else
- radeon() { radeontool "$@"; }
-fi
-
-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
- sysctl -w kernel.acpi_video_flags=3
- elif [ "${DISPLAY_QUIRK_S3_BIOS}" = "true" ]; then
- sysctl -w kernel.acpi_video_flags=1
- elif [ "${DISPLAY_QUIRK_S3_MODE}" = "true" ]; then
- sysctl -w kernel.acpi_video_flags=2
- else
- sysctl -w kernel.acpi_video_flags=0
- fi
-
- # We might need to do one or many of these quirks
- if [ "${DISPLAY_QUIRK_RADEON_OFF}" = "true" ]; then
- radeon dac off
- radeon light off
- fi
- if [ "${DISPLAY_QUIRK_VBESTATE_RESTORE}" = "true" ]; then
- vbe vbestate save > /var/run/vbestate
- fi
- if [ "${DISPLAY_QUIRK_VBEMODE_RESTORE}" = "true" ]; then
- vbe vbemode get > /var/run/vbemode
- fi
- if [ "${DISPLAY_QUIRK_VGA_MODE_3}" = "true" ]; then
- vbe vbemode set 3
- fi
- if [ "${DISPLAY_QUIRK_DPMS_SUSPEND}" = "true" ]; then
- vbe dpms suspend
- fi
-}
-
-
-case "$1" in
- suspend)
- suspend_video
- ;;
- hibernate)
- if [ "$HIBERNATE_RESUME_POST_VIDEO" = "yes" ]; then
- suspend_video
- fi
- ;;
-esac
-
-exit $?
diff --git a/pm/sleep.d/20video.in b/pm/sleep.d/20video.in
new file mode 100755
index 0000000..35732d9
--- /dev/null
+++ b/pm/sleep.d/20video.in
@@ -0,0 +1,69 @@
+#!/bin/sh
+#
+# Copyright 2006-2007 Richard Hughes <[EMAIL PROTECTED]>
+# Copyright 2007 Peter Jones <[EMAIL PROTECTED]>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of version 2 of the GNU General Public License as
+# published by the Free Software Foundation.
+
+. @PM-UTILS-LIBDIR@/functions
+
+if ! command_exists vbetool; then
+ vbe() { echo "vbetool not found" 1>&2; return 1; }
+else
+ vbe() { vbetool "$@"; }
+fi
+
+if ! command_exists radeontool; then
+ radeon() { echo "radeontool not found" 1>&2; return 1; }
+else
+ radeon() { radeontool "$@"; }
+fi
+
+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
+ sysctl -w kernel.acpi_video_flags=3
+ elif [ "${DISPLAY_QUIRK_S3_BIOS}" = "true" ]; then
+ sysctl -w kernel.acpi_video_flags=1
+ elif [ "${DISPLAY_QUIRK_S3_MODE}" = "true" ]; then
+ sysctl -w kernel.acpi_video_flags=2
+ else
+ sysctl -w kernel.acpi_video_flags=0
+ fi
+
+ # We might need to do one or many of these quirks
+ if [ "${DISPLAY_QUIRK_RADEON_OFF}" = "true" ]; then
+ radeon dac off
+ radeon light off
+ fi
+ if [ "${DISPLAY_QUIRK_VBESTATE_RESTORE}" = "true" ]; then
+ vbe vbestate save > /var/run/vbestate
+ fi
+ if [ "${DISPLAY_QUIRK_VBEMODE_RESTORE}" = "true" ]; then
+ vbe vbemode get > /var/run/vbemode
+ fi
+ if [ "${DISPLAY_QUIRK_VGA_MODE_3}" = "true" ]; then
+ vbe vbemode set 3
+ fi
+ if [ "${DISPLAY_QUIRK_DPMS_SUSPEND}" = "true" ]; then
+ vbe dpms suspend
+ fi
+}
+
+
+case "$1" in
+ suspend)
+ suspend_video
+ ;;
+ hibernate)
+ if [ "$HIBERNATE_RESUME_POST_VIDEO" = "yes" ]; then
+ suspend_video
+ fi
+ ;;
+esac
+
+exit $?
diff --git a/pm/sleep.d/49bluetooth b/pm/sleep.d/49bluetooth
deleted file mode 100755
index bab680a..0000000
--- a/pm/sleep.d/49bluetooth
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/bin/sh
-
-. /usr/lib/pm-utils/functions
-
-[ -f /proc/acpi/ibm/bluetooth ] || exit 1
-
-suspend_bluetooth()
-{
- savestate ibm_bluetooth "$(awk '{ print $2 ; exit; }' /proc/acpi/ibm/bluetooth)"
- echo disable > /proc/acpi/ibm/bluetooth
-}
-
-resume_bluetooth()
-{
- case "$(restorestate ibm_bluetooth)" in
- enabled)
- echo enable > /proc/acpi/ibm/bluetooth
- ;;
- disabled)
- echo disable > /proc/acpi/ibm/bluetooth
- ;;
- esac
-}
-
-case "$1" in
- hibernate|suspend)
- suspend_bluetooth
- ;;
- thaw|resume)
- resume_bluetooth
- ;;
- *)
- ;;
-esac
-
-exit $?
diff --git a/pm/sleep.d/49bluetooth.in b/pm/sleep.d/49bluetooth.in
new file mode 100755
index 0000000..2802a40
--- /dev/null
+++ b/pm/sleep.d/49bluetooth.in
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+. @PM-UTILS-LIBDIR@/functions
+
+[ -f /proc/acpi/ibm/bluetooth ] || exit 1
+
+suspend_bluetooth()
+{
+ savestate ibm_bluetooth "$(awk '{ print $2 ; exit; }' /proc/acpi/ibm/bluetooth)"
+ echo disable > /proc/acpi/ibm/bluetooth
+}
+
+resume_bluetooth()
+{
+ case "$(restorestate ibm_bluetooth)" in
+ enabled)
+ echo enable > /proc/acpi/ibm/bluetooth
+ ;;
+ disabled)
+ echo disable > /proc/acpi/ibm/bluetooth
+ ;;
+ esac
+}
+
+case "$1" in
+ hibernate|suspend)
+ suspend_bluetooth
+ ;;
+ thaw|resume)
+ resume_bluetooth
+ ;;
+ *)
+ ;;
+esac
+
+exit $?
diff --git a/pm/sleep.d/50modules b/pm/sleep.d/50modules
deleted file mode 100755
index 19707c1..0000000
--- a/pm/sleep.d/50modules
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/bin/sh
-
-. /usr/lib/pm-utils/functions
-
-suspend_modules()
-{
- [ -z "$SUSPEND_MODULES" ] && return 0
- for x in $SUSPEND_MODULES ; do
- modunload $x
- done
- return 0
-}
-
-resume_modules()
-{
- modreload
-}
-
-case "$1" in
- hibernate|suspend)
- suspend_modules
- ;;
- thaw|resume)
- resume_modules
- ;;
- *)
- ;;
-esac
-
-exit $?
diff --git a/pm/sleep.d/50modules.in b/pm/sleep.d/50modules.in
new file mode 100755
index 0000000..b406258
--- /dev/null
+++ b/pm/sleep.d/50modules.in
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+. @PM-UTILS-LIBDIR@/functions
+
+suspend_modules()
+{
+ [ -z "$SUSPEND_MODULES" ] && return 0
+ for x in $SUSPEND_MODULES ; do
+ modunload $x
+ done
+ return 0
+}
+
+resume_modules()
+{
+ modreload
+}
+
+case "$1" in
+ hibernate|suspend)
+ suspend_modules
+ ;;
+ thaw|resume)
+ resume_modules
+ ;;
+ *)
+ ;;
+esac
+
+exit $?
diff --git a/pm/sleep.d/55battery b/pm/sleep.d/55battery
deleted file mode 100755
index e5f3758..0000000
--- a/pm/sleep.d/55battery
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/sh
-
-. /usr/lib/pm-utils/functions
-
-resume_batteries()
-{
- for x in $(hal-find-by-capability --capability battery 2>/dev/null); do
- dbus-send --print-reply --system --reply-timeout=2000 \
- --dest=org.freedesktop.Hal "$x" \
- org.freedesktop.Hal.Device.Rescan "string:$x"
- done
-}
-
-case "$1" in
- resume|thaw)
- resume_batteries
- ;;
-esac
diff --git a/pm/sleep.d/55battery.in b/pm/sleep.d/55battery.in
new file mode 100755
index 0000000..a38f1d4
--- /dev/null
+++ b/pm/sleep.d/55battery.in
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+. @PM-UTILS-LIBDIR@/functions
+
+resume_batteries()
+{
+ for x in $(hal-find-by-capability --capability battery 2>/dev/null); do
+ dbus-send --print-reply --system --reply-timeout=2000 \
+ --dest=org.freedesktop.Hal "$x" \
+ org.freedesktop.Hal.Device.Rescan "string:$x"
+ done
+}
+
+case "$1" in
+ resume|thaw)
+ resume_batteries
+ ;;
+esac
diff --git a/pm/sleep.d/65alsa b/pm/sleep.d/65alsa
deleted file mode 100755
index 0762436..0000000
--- a/pm/sleep.d/65alsa
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/sh
-
-. /usr/lib/pm-utils/functions
-
-command_exists alsactl || exit 1
-
-case "$1" in
- hibernate|suspend)
- alsactl store 0 >/dev/null 2>&1
- ;;
- thaw|resume)
- alsactl restore 0 >/dev/null 2>&1
- ;;
- *)
- ;;
-esac
-
-exit $?
diff --git a/pm/sleep.d/65alsa.in b/pm/sleep.d/65alsa.in
new file mode 100755
index 0000000..5f2bd77
--- /dev/null
+++ b/pm/sleep.d/65alsa.in
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+. @PM-UTILS-LIBDIR@/functions
+
+command_exists alsactl || exit 1
+
+case "$1" in
+ hibernate|suspend)
+ alsactl store 0 >/dev/null 2>&1
+ ;;
+ thaw|resume)
+ alsactl restore 0 >/dev/null 2>&1
+ ;;
+ *)
+ ;;
+esac
+
+exit $?
diff --git a/pm/sleep.d/90clock b/pm/sleep.d/90clock
deleted file mode 100755
index 6e73714..0000000
--- a/pm/sleep.d/90clock
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/bin/sh
-. /usr/lib/pm-utils/functions
-
-NTPD_LOCK="/var/run/pm-utils/pm-ntpd.lock"
-
-suspend_clock() {
- if try_lock "${NTPD_LOCK}"; then
- trap 'release_lock "${NTPD_LOCK}"' 0
- stopservice ntpd
- fi
- /sbin/hwclock --systohc >/dev/null 2>&1 0<&1
- return $?
-}
-
-resume_clock() {
- /sbin/hwclock --hctosys >/dev/null 2>&1 0<&1
- rc=$?
- # Bring back ntpd _after_ NetworkManager and such come back...
- ( spin_lock "${NTPD_LOCK}";
- trap 'release_lock "${NTPD_LOCK}"' 0
- sleep 20;
- restartservice ntpd; ) &
- return $rc
-}
-
-case "$1" in
- hibernate|suspend)
- suspend_clock
- ;;
- thaw|resume)
- resume_clock
- ;;
- *)
- ;;
-esac
-
-exit $?
diff --git a/pm/sleep.d/90clock.in b/pm/sleep.d/90clock.in
new file mode 100755
index 0000000..2a30beb
--- /dev/null
+++ b/pm/sleep.d/90clock.in
@@ -0,0 +1,37 @@
+#!/bin/sh
+. @PM-UTILS-LIBDIR@/functions
+
+NTPD_LOCK="/var/run/pm-utils/pm-ntpd.lock"
+
+suspend_clock() {
+ if try_lock "${NTPD_LOCK}"; then
+ trap 'release_lock "${NTPD_LOCK}"' 0
+ stopservice ntpd
+ fi
+ /sbin/hwclock --systohc >/dev/null 2>&1 0<&1
+ return $?
+}
+
+resume_clock() {
+ /sbin/hwclock --hctosys >/dev/null 2>&1 0<&1
+ rc=$?
+ # Bring back ntpd _after_ NetworkManager and such come back...
+ ( spin_lock "${NTPD_LOCK}";
+ trap 'release_lock "${NTPD_LOCK}"' 0
+ sleep 20;
+ restartservice ntpd; ) &
+ return $rc
+}
+
+case "$1" in
+ hibernate|suspend)
+ suspend_clock
+ ;;
+ thaw|resume)
+ resume_clock
+ ;;
+ *)
+ ;;
+esac
+
+exit $?
diff --git a/pm/sleep.d/94cpufreq b/pm/sleep.d/94cpufreq
deleted file mode 100755
index 01ef390..0000000
--- a/pm/sleep.d/94cpufreq
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/bin/sh
-
-. /usr/lib/pm-utils/functions
-
-
-[ -d /sys/devices/system/cpu/ ] || exit 1
-
-hibernate_cpufreq()
-{
- ( cd /sys/devices/system/cpu/
- for x in cpu[0-9]* ; do
- [ -f "$x/cpufreq/scaling_governor" ] || continue
- grep -q "$TEMPORARY_CPUFREQ_GOVERNOR" \
- "$x/cpufreq/scaling_available_governors" || continue
- savestate "${x}_governor" $(cat "$x/cpufreq/scaling_governor")
- echo "$TEMPORARY_CPUFREQ_GOVERNOR" > \
- "$x/cpufreq/scaling_governor"
- done )
-}
-
-thaw_cpufreq()
-{
- ( cd /sys/devices/system/cpu/
- for x in cpu[0-9]* ; do
- local gov=$(restorestate "${x}_governor")
- [ -z "$gov" ] || continue
- echo "$gov" > "$x/cpufreq/scaling_governor"
- done )
-}
-
-case "$1" in
- suspend|hibernate)
- hibernate_cpufreq
- ;;
- resume|thaw)
- thaw_cpufreq
- ;;
- *)
- ;;
-esac
-
-exit $?
diff --git a/pm/sleep.d/94cpufreq.in b/pm/sleep.d/94cpufreq.in
new file mode 100755
index 0000000..2f9895f
--- /dev/null
+++ b/pm/sleep.d/94cpufreq.in
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+. @PM-UTILS-LIBDIR@/functions
+
+
+[ -d /sys/devices/system/cpu/ ] || exit 1
+
+hibernate_cpufreq()
+{
+ ( cd /sys/devices/system/cpu/
+ for x in cpu[0-9]* ; do
+ [ -f "$x/cpufreq/scaling_governor" ] || continue
+ grep -q "$TEMPORARY_CPUFREQ_GOVERNOR" \
+ "$x/cpufreq/scaling_available_governors" || continue
+ savestate "${x}_governor" $(cat "$x/cpufreq/scaling_governor")
+ echo "$TEMPORARY_CPUFREQ_GOVERNOR" > \
+ "$x/cpufreq/scaling_governor"
+ done )
+}
+
+thaw_cpufreq()
+{
+ ( cd /sys/devices/system/cpu/
+ for x in cpu[0-9]* ; do
+ local gov=$(restorestate "${x}_governor")
+ [ -z "$gov" ] || continue
+ echo "$gov" > "$x/cpufreq/scaling_governor"
+ done )
+}
+
+case "$1" in
+ suspend|hibernate)
+ hibernate_cpufreq
+ ;;
+ resume|thaw)
+ thaw_cpufreq
+ ;;
+ *)
+ ;;
+esac
+
+exit $?
diff --git a/pm/sleep.d/95led b/pm/sleep.d/95led
deleted file mode 100755
index 1704207..0000000
--- a/pm/sleep.d/95led
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/bin/sh
-
-[ -f /proc/acpi/ibm/led ] || exit 1
-
-case "$1" in
- thaw|resume)
- { echo "7 blink" >/proc/acpi/ibm/led ; } 2>/dev/null
- ;;
- *)
- ;;
-esac
-
-exit $?
diff --git a/pm/sleep.d/95led.in b/pm/sleep.d/95led.in
new file mode 100755
index 0000000..1704207
--- /dev/null
+++ b/pm/sleep.d/95led.in
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+[ -f /proc/acpi/ibm/led ] || exit 1
+
+case "$1" in
+ thaw|resume)
+ { echo "7 blink" >/proc/acpi/ibm/led ; } 2>/dev/null
+ ;;
+ *)
+ ;;
+esac
+
+exit $?
diff --git a/pm/sleep.d/99video b/pm/sleep.d/99video
deleted file mode 100755
index c8dab94..0000000
--- a/pm/sleep.d/99video
+++ /dev/null
@@ -1,71 +0,0 @@
-#!/bin/sh
-#
-# Copyright 2006-2007 Richard Hughes <[EMAIL PROTECTED]>
-# Copyright 2007 Peter Jones <[EMAIL PROTECTED]>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of version 2 of the GNU General Public License as
-# published by the Free Software Foundation.
-
-. /usr/lib/pm-utils/functions
-
-
-reset_brightness() {
- for bl in /sys/class/backlight/* ; do
- [ -f $bl/brightness ] || continue
- BR=$(cat $bl/brightness)
- echo 0 > $bl/brightness
- echo $BR > $bl/brightness
- done
-}
-
-if command_exists vbetool; then
- vbe() { echo "vbetool not installed!" 1>&2; return 1; }
-else
- vbe() { vbetool "$@"; }
-fi
-
-if command_exists radeontool; then
- radeon() { echo "radeontool not found" 1>&2; return 1; }
-else
- radeon() { radeontool "$@"; }
-fi
-
-resume_video()
-{
- if [ "${DISPLAY_QUIRK_RADEON_OFF}" = "true" ]; then
- radeon dac on
- radeon light on
- fi
- # We might need to do one or many of these quirks
- if [ "${DISPLAY_QUIRK_VBE_POST}" = "true" ]; then
- vbe post
- sleep 0.1
- fi
- if [ "${DISPLAY_QUIRK_VBESTATE_RESTORE}" = "true" ]; then
- vbe vbestate restore < /var/run/vbestate
- fi
- if [ "${DISPLAY_QUIRK_VBEMODE_RESTORE}" = "true" ]; then
- vbe vbemode set $(cat /var/run/vbemode)
- fi
- if [ "${DISPLAY_QUIRK_DPMS_ON}" = "true" ]; then
- vbe dpms on
- fi
- if [ "${DISPLAY_QUIRK_RESET_BRIGHTNESS}" = "true" ]; then
- reset_brightness
- fi
-}
-
-
-case "$1" in
- resume)
- resume_video
- ;;
- thaw)
- if [ "$HIBERNATE_RESUME_POST_VIDEO" = "yes" ]; then
- resume_video
- fi
- ;;
-esac
-
-exit $?
diff --git a/pm/sleep.d/99video.in b/pm/sleep.d/99video.in
new file mode 100755
index 0000000..0ee23e9
--- /dev/null
+++ b/pm/sleep.d/99video.in
@@ -0,0 +1,71 @@
+#!/bin/sh
+#
+# Copyright 2006-2007 Richard Hughes <[EMAIL PROTECTED]>
+# Copyright 2007 Peter Jones <[EMAIL PROTECTED]>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of version 2 of the GNU General Public License as
+# published by the Free Software Foundation.
+
+. @PM-UTILS-LIBDIR@/functions
+
+
+reset_brightness() {
+ for bl in /sys/class/backlight/* ; do
+ [ -f $bl/brightness ] || continue
+ BR=$(cat $bl/brightness)
+ echo 0 > $bl/brightness
+ echo $BR > $bl/brightness
+ done
+}
+
+if command_exists vbetool; then
+ vbe() { echo "vbetool not installed!" 1>&2; return 1; }
+else
+ vbe() { vbetool "$@"; }
+fi
+
+if command_exists radeontool; then
+ radeon() { echo "radeontool not found" 1>&2; return 1; }
+else
+ radeon() { radeontool "$@"; }
+fi
+
+resume_video()
+{
+ if [ "${DISPLAY_QUIRK_RADEON_OFF}" = "true" ]; then
+ radeon dac on
+ radeon light on
+ fi
+ # We might need to do one or many of these quirks
+ if [ "${DISPLAY_QUIRK_VBE_POST}" = "true" ]; then
+ vbe post
+ sleep 0.1
+ fi
+ if [ "${DISPLAY_QUIRK_VBESTATE_RESTORE}" = "true" ]; then
+ vbe vbestate restore < /var/run/vbestate
+ fi
+ if [ "${DISPLAY_QUIRK_VBEMODE_RESTORE}" = "true" ]; then
+ vbe vbemode set $(cat /var/run/vbemode)
+ fi
+ if [ "${DISPLAY_QUIRK_DPMS_ON}" = "true" ]; then
+ vbe dpms on
+ fi
+ if [ "${DISPLAY_QUIRK_RESET_BRIGHTNESS}" = "true" ]; then
+ reset_brightness
+ fi
+}
+
+
+case "$1" in
+ resume)
+ resume_video
+ ;;
+ thaw)
+ if [ "$HIBERNATE_RESUME_POST_VIDEO" = "yes" ]; then
+ resume_video
+ fi
+ ;;
+esac
+
+exit $?
diff --git a/pm/sleep.d/Makefile.am b/pm/sleep.d/Makefile.am
index 5092a42..7693477 100644
--- a/pm/sleep.d/Makefile.am
+++ b/pm/sleep.d/Makefile.am
@@ -1,4 +1,5 @@
sleepdir = $(libdir)/pm-utils/sleep.d
+pm_utils_libdir = $(libdir)/pm-utils
sleep_SCRIPTS = \
00clear \
@@ -16,9 +17,89 @@ sleep_SCRIPTS = \
99video \
zzz
-EXTRA_DIST=$(sleep_SCRIPTS)
+CLEANFILES = $(sleep_SCRIPTS)
-install-exec-local:
+EXTRA_DIST= \
+ 00clear.in \
+ 01grub.in \
+ 05led.in \
+ 10NetworkManager.in \
+ 20video.in \
+ 49bluetooth.in \
+ 50modules.in \
+ 55battery.in \
+ 65alsa.in \
+ 90clock.in \
+ 94cpufreq.in \
+ 95led.in \
+ 99video.in \
+ zzz.in
+
+do_subst = sed -e 's,[EMAIL PROTECTED]@],$(pm_utils_libdir),g'
+
+# If anything sources pm/functions, you MUST:
+# 1: Have it source @PM-UTILS-LIBDIR@/functions
+# 2: Add it to the list of files to be transformed below.
+# Doing this will ensure that the scripts will function
+# no matter where they are installed.
+
+00clear: 00clear.in Makefile
+ $(do_subst) <$(srcdir)/00clear.in > 00clear
+ chmod +x 00clear
+
+01grub: 01grub.in Makefile
+ $(do_subst) <$(srcdir)/01grub.in > 01grub
+ chmod +x 01grub
+
+05led: 05led.in Makefile
+ $(do_subst) <$(srcdir)/05led.in > 05led
+ chmod +x 05led
+
+10NetworkManager: 10NetworkManager.in Makefile
+ $(do_subst) <$(srcdir)/10NetworkManager.in > 10NetworkManager
+ chmod +x 10NetworkManager
+
+20video: 20video.in Makefile
+ $(do_subst) <$(srcdir)/20video.in > 20video
+ chmod +x 20video
+
+49bluetooth: 49bluetooth.in Makefile
+ $(do_subst) <$(srcdir)/49bluetooth.in > 49bluetooth
+ chmod +x 49bluetooth
+
+50modules: 50modules.in Makefile
+ $(do_subst) <$(srcdir)/50modules.in > 50modules
+ chmod +x 50modules
+
+55battery: 55battery.in Makefile
+ $(do_subst) <$(srcdir)/55battery.in > 55battery
+ chmod +x 55battery
+
+65alsa: 65alsa.in Makefile
+ $(do_subst) <$(srcdir)/65alsa.in > 65alsa
+ chmod +x 65alsa
+
+90clock: 90clock.in Makefile
+ $(do_subst) <$(srcdir)/90clock.in > 90clock
+ chmod +x 90clock
+
+94cpufreq: 94cpufreq.in Makefile
+ $(do_subst) <$(srcdir)/94cpufreq.in > 94cpufreq
+ chmod +x 94cpufreq
+
+95led: 95led.in Makefile
+ $(do_subst) <$(srcdir)/95led.in > 95led
+ chmod +x 95led
+
+99video: 99video.in Makefile
+ $(do_subst) <$(srcdir)/99video.in > 99video
+ chmod +x 99video
+
+zzz: zzz.in Makefile
+ $(do_subst) <$(srcdir)/zzz.in > zzz
+ chmod +x zzz
+
+install-data-hook:
-mkdir -p $(DESTDIR)$(sysconfdir)/pm/sleep.d
clean-local :
diff --git a/pm/sleep.d/zzz b/pm/sleep.d/zzz
deleted file mode 100755
index 1d16e78..0000000
--- a/pm/sleep.d/zzz
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/sh
-. /usr/lib/pm-utils/functions
-[ -e "$INHIBIT" ] && return 1
-sync;sync;sync;
-case $1 in
- suspend|hibernate|suspend_hybrid) do_$1 ;;
- resume|thaw) exit 0 ;;
- *) exit 1 ;;
-esac
-exit $?
diff --git a/pm/sleep.d/zzz.in b/pm/sleep.d/zzz.in
new file mode 100755
index 0000000..0853445
--- /dev/null
+++ b/pm/sleep.d/zzz.in
@@ -0,0 +1,10 @@
+#!/bin/sh
+. @PM-UTILS-LIBDIR@/functions
+[ -e "$INHIBIT" ] && return 1
+sync;sync;sync;
+case $1 in
+ suspend|hibernate|suspend_hybrid) do_$1 ;;
+ resume|thaw) exit 0 ;;
+ *) exit 1 ;;
+esac
+exit $?
diff --git a/src/Makefile.am b/src/Makefile.am
index 184c221..4da5b54 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,4 +1,5 @@
pm_utils_bindir = $(libdir)/pm-utils/bin
+pm_utils_libdir = $(libdir)/pm-utils
pm_utils_bin_PROGRAMS = \
pm-pmu \
@@ -28,16 +29,33 @@ acpowerdir = $(bindir)
acpower_SCRIPTS = \
on_ac_power
-install-exec-hook:
+CLEANFILES = $(extra_SCRIPTS) $(pm_utils_bin_SCRIPTS)
+
+# If anything sources pm/functions, you MUST:
+# 1: Have it source @PM-UTILS-LIBDIR@/functions
+# 2: Add it to the list of files to be transformed below.
+# Doing this will ensure that the scripts will function
+# no matter where they are installed.
+install-data-hook:
-mkdir -p $(DESTDIR)$(sbindir)
-ln -s $(pm_utils_bindir)/pm-action $(DESTDIR)$(sbindir)/pm-suspend
-ln -s $(pm_utils_bindir)/pm-action $(DESTDIR)$(sbindir)/pm-hibernate
-ln -s $(pm_utils_bindir)/pm-action $(DESTDIR)$(sbindir)/pm-suspend-hybrid
+do_subst = sed -e 's,[EMAIL PROTECTED]@],$(pm_utils_libdir),g'
+
+pm-action: pm-action.in Makefile
+ $(do_subst) < $(srcdir)/pm-action.in >pm-action
+ chmod +x pm-action
+
+pm-powersave: pm-powersave.in Makefile
+ $(do_subst) < $(srcdir)/pm-powersave.in >pm-powersave
+ chmod +x pm-powersave
+
EXTRA_DIST = \
- $(extra_SCRIPTS) \
+ pm-action.in \
+ pm-powersave.in \
$(acpower_SCRIPTS) \
- $(pm_utils_bin_SCRIPTS) \
$(pm_utils_usr_bin_SCRIPTS)
clean-local :
diff --git a/src/pm-action b/src/pm-action
deleted file mode 100755
index 3a1e6a5..0000000
--- a/src/pm-action
+++ /dev/null
@@ -1,125 +0,0 @@
-#!/bin/sh
-#
-# Simple suspend script
-#
-# Copyright 2006 Red Hat, Inc.
-#
-# Based on work from:
-# Bill Nottingham <[EMAIL PROTECTED]>
-# Peter Jones <[EMAIL PROTECTED]>
-# David Zeuthen <[EMAIL PROTECTED]>
-# Richard Hughes <[EMAIL PROTECTED]>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of version 2 of the GNU General Public License as
-# published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-
-# The rule here? Simplicity.
-
-help_options() {
- echo "${0##*/} [options]"
- echo
- echo "Options can change how the supend or hibernate is done."
- echo
- echo "Possible actions are:"
- echo
- echo " --quirk-dpms-on"
- echo " --quirk-dpms-suspend"
- echo " --quirk-radeon-off"
- echo " --quirk-reset-brightness"
- echo " --quirk-s3-bios"
- echo " --quirk-s3-mode"
- echo " --quirk-vbe-post"
- echo " --quirk-vbemode-restore"
- echo " --quirk-vbestate-restore"
- echo " --quirk-vga-mode3"
- echo
-}
-
-if [ -n "$EUID" -a "$EUID" != "0" ]; then
- echo This utility may only be run by the root user. 1>&2
- exit 1
-fi
-
-# Get the command line options
-while [ $# -gt 0 ]
-do
- case "$1" in
- --quirk-dpms-on)
- export DISPLAY_QUIRK_DPMS_ON="true" ;;
- --quirk-dpms-suspend)
- export DISPLAY_QUIRK_DPMS_SUSPEND="true" ;;
- --quirk-radeon-off)
- export DISPLAY_QUIRK_RADEON_OFF="true" ;;
- --quirk-reset-brightness)
- export DISPLAY_QUIRK_RESET_BRIGHTNESS="true" ;;
- --quirk-s3-bios)
- export DISPLAY_QUIRK_S3_BIOS="true" ;;
- --quirk-s3-mode)
- export DISPLAY_QUIRK_S3_MODE="true" ;;
- --quirk-vbe-post)
- export DISPLAY_QUIRK_VBE_POST="true" ;;
- --quirk-vbemode-restore)
- export DISPLAY_QUIRK_VBEMODE_RESTORE="true" ;;
- --quirk-vbestate-restore)
- export DISPLAY_QUIRK_VBESTATE_RESTORE="true" ;;
- --quirk-vga-mode3)
- export DISPLAY_QUIRK_VGA_MODE_3="true" ;;
- --help)
- help_options
- exit 0 ;;
- *)
- break ;; # terminate while loop
- esac
- shift
-done
-
-. /usr/lib/pm-utils/functions
-
-[ -f /sys/power/state ] || exit 1
-
-
-ACTION=${0##*pm-}
-
-case "$ACTION" in
- suspend)
- if ! pm-is-supported --"$ACTION" ; then
- echo "Error: kernel cannot suspend to ram." 1>&2
- exit 1
- fi
- REVERSE=resume
- ;;
- hibernate)
- if ! pm-is-supported --"$ACTION" ; then
- echo "Error: kernel cannot suspend to disk." 1>&2
- exit 1
- fi
- REVERSE=thaw
- ;;
- suspend-hybrid)
- if ! pm-is-supported --"$ACTION" ; then
- echo "Error: hybrid suspend is not supported." 1>&2
- exit
- fi
- REVERSE=resume
- ;;
- *)
- exit 1
- ;;
-esac
-
-export PM_CMDLINE="$@"
-
-pm_main "$(echo $ACTION | tr - _)" "$REVERSE"
-
-exit $?
diff --git a/src/pm-action.in b/src/pm-action.in
new file mode 100755
index 0000000..dce8eaa
--- /dev/null
+++ b/src/pm-action.in
@@ -0,0 +1,125 @@
+#!/bin/sh
+#
+# Simple suspend script
+#
+# Copyright 2006 Red Hat, Inc.
+#
+# Based on work from:
+# Bill Nottingham <[EMAIL PROTECTED]>
+# Peter Jones <[EMAIL PROTECTED]>
+# David Zeuthen <[EMAIL PROTECTED]>
+# Richard Hughes <[EMAIL PROTECTED]>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of version 2 of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+
+# The rule here? Simplicity.
+
+help_options() {
+ echo "${0##*/} [options]"
+ echo
+ echo "Options can change how the supend or hibernate is done."
+ echo
+ echo "Possible actions are:"
+ echo
+ echo " --quirk-dpms-on"
+ echo " --quirk-dpms-suspend"
+ echo " --quirk-radeon-off"
+ echo " --quirk-reset-brightness"
+ echo " --quirk-s3-bios"
+ echo " --quirk-s3-mode"
+ echo " --quirk-vbe-post"
+ echo " --quirk-vbemode-restore"
+ echo " --quirk-vbestate-restore"
+ echo " --quirk-vga-mode3"
+ echo
+}
+
+if [ -n "$EUID" -a "$EUID" != "0" ]; then
+ echo This utility may only be run by the root user. 1>&2
+ exit 1
+fi
+
+# Get the command line options
+while [ $# -gt 0 ]
+do
+ case "$1" in
+ --quirk-dpms-on)
+ export DISPLAY_QUIRK_DPMS_ON="true" ;;
+ --quirk-dpms-suspend)
+ export DISPLAY_QUIRK_DPMS_SUSPEND="true" ;;
+ --quirk-radeon-off)
+ export DISPLAY_QUIRK_RADEON_OFF="true" ;;
+ --quirk-reset-brightness)
+ export DISPLAY_QUIRK_RESET_BRIGHTNESS="true" ;;
+ --quirk-s3-bios)
+ export DISPLAY_QUIRK_S3_BIOS="true" ;;
+ --quirk-s3-mode)
+ export DISPLAY_QUIRK_S3_MODE="true" ;;
+ --quirk-vbe-post)
+ export DISPLAY_QUIRK_VBE_POST="true" ;;
+ --quirk-vbemode-restore)
+ export DISPLAY_QUIRK_VBEMODE_RESTORE="true" ;;
+ --quirk-vbestate-restore)
+ export DISPLAY_QUIRK_VBESTATE_RESTORE="true" ;;
+ --quirk-vga-mode3)
+ export DISPLAY_QUIRK_VGA_MODE_3="true" ;;
+ --help)
+ help_options
+ exit 0 ;;
+ *)
+ break ;; # terminate while loop
+ esac
+ shift
+done
+
+. @PM-UTILS-LIBDIR@/functions
+
+[ -f /sys/power/state ] || exit 1
+
+
+ACTION=${0##*pm-}
+
+case "$ACTION" in
+ suspend)
+ if ! pm-is-supported --"$ACTION" ; then
+ echo "Error: kernel cannot suspend to ram." 1>&2
+ exit 1
+ fi
+ REVERSE=resume
+ ;;
+ hibernate)
+ if ! pm-is-supported --"$ACTION" ; then
+ echo "Error: kernel cannot suspend to disk." 1>&2
+ exit 1
+ fi
+ REVERSE=thaw
+ ;;
+ suspend-hybrid)
+ if ! pm-is-supported --"$ACTION" ; then
+ echo "Error: hybrid suspend is not supported." 1>&2
+ exit
+ fi
+ REVERSE=resume
+ ;;
+ *)
+ exit 1
+ ;;
+esac
+
+export PM_CMDLINE="$@"
+
+pm_main "$(echo $ACTION | tr - _)" "$REVERSE"
+
+exit $?
diff --git a/src/pm-powersave b/src/pm-powersave
deleted file mode 100755
index 11ec1b9..0000000
--- a/src/pm-powersave
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/bin/sh
-# vim:noexpandtab
-# Simple powersave script
-#
-# Copyright 2006 Red Hat, Inc.
-#
-# Based on work from:
-# Bill Nottingham <[EMAIL PROTECTED]>
-# Peter Jones <[EMAIL PROTECTED]>
-# David Zeuthen <[EMAIL PROTECTED]>
-# Richard Hughes <[EMAIL PROTECTED]>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of version 2 of the GNU General Public License as
-# published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-
-POWERSAVE_LOGFILE="/dev/null"
-[ -f /usr/lib/pm-utils/functions ] || return 1
-. /usr/lib/pm-utils/functions
-
-if [ "x$1" = "xtrue" -o "x$1" = "xfalse" ] ; then
- init_logfile "${POWERSAVE_LOGFILE}"
- run_hooks power "$1"
-else
- echo "Argument needs to be true or false" >&2
- exit 1
-fi
diff --git a/src/pm-powersave.in b/src/pm-powersave.in
new file mode 100755
index 0000000..4b690ce
--- /dev/null
+++ b/src/pm-powersave.in
@@ -0,0 +1,37 @@
+#!/bin/sh
+# vim:noexpandtab
+# Simple powersave script
+#
+# Copyright 2006 Red Hat, Inc.
+#
+# Based on work from:
+# Bill Nottingham <[EMAIL PROTECTED]>
+# Peter Jones <[EMAIL PROTECTED]>
+# David Zeuthen <[EMAIL PROTECTED]>
+# Richard Hughes <[EMAIL PROTECTED]>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of version 2 of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+
+POWERSAVE_LOGFILE="/dev/null"
+[ -f @PM-UTILS-LIBDIR@/functions ] || return 1
+. @PM-UTILS-LIBDIR@/functions
+
+if [ "x$1" = "xtrue" -o "x$1" = "xfalse" ] ; then
+ init_logfile "${POWERSAVE_LOGFILE}"
+ run_hooks power "$1"
+else
+ echo "Argument needs to be true or false" >&2
+ exit 1
+fi
_______________________________________________
Pm-utils mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/pm-utils