hal/tools hal-system-power-hibernate, 1.1,
1.2 hal-system-power-set-power-save, 1.1,
1.2 hal-system-power-suspend, 1.1, 1.2
Danny Kukawka
dkukawka at freedesktop.org
Fri Aug 19 05:33:53 PDT 2005
- Previous message: hal/po ChangeLog, 1.21, 1.22 de.po, 1.11, 1.12 es.po, 1.1, 1.2 fr.po,
1.10, 1.11 it.po, 1.3, 1.4 zh_TW.po, 1.2, 1.3
- Next message: hal ChangeLog,1.602,1.603
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvs/hal/hal/tools
In directory gabe:/tmp/cvs-serv3682/tools
Modified Files:
hal-system-power-hibernate hal-system-power-set-power-save
hal-system-power-suspend
Log Message:
2005-08-19 Danny Danny Kukawka <danny.kukawka at web.de>
* tools/hal-system-power-hibernate,
tools/hal-system-power-set-power-save,
tools/hal-system-power-suspend: Add dectection of ALTLinux, SUSE,
Mandrake, Slackware, Debian and Gentoo and add support for powersave
for SUSE and ALTLinux (powersave will be included to next release ALT
Linux 3.0) to the scripts.
Index: hal-system-power-hibernate
===================================================================
RCS file: /cvs/hal/hal/tools/hal-system-power-hibernate,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- hal-system-power-hibernate 16 Aug 2005 18:08:42 -0000 1.1
+++ hal-system-power-hibernate 19 Aug 2005 12:33:48 -0000 1.2
@@ -2,17 +2,46 @@
unknown_distro() {
echo org.freedesktop.Hal.Device.SystemPowerManagement.NotSupported >&2
+ echo Unsupported Operating System >&2
+ exit 1
+}
+
+unsupported() {
+ echo org.freedesktop.Hal.Device.SystemPowerManagement.NotSupported >&2
echo No hibernate script found >&2
exit 1
}
-if [ -f /etc/redhat-release ] || [ -f /etc/fedora-release ] ; then
+if [ -f /etc/altlinux-release ] ; then
+ if [ -x /usr/bin/powersave ] ; then
+ /usr/bin/powersave --suspend-to-disk
+ RET=$?
+ else
+ # TODO: add support
+ unsupported
+ fi
+elif [ -f /etc/redhat-release ] || [ -f /etc/fedora-release ] ; then
/usr/sbin/pm-hibernate
RET=$?
+elif [ -f /etc/SuSE-release ] ; then
+ /usr/bin/powersave --suspend-to-disk
+ RET=$?
+elif [ -f /etc/mandrake-release ] ; then
+ # TODO: add support
+ unsupported
+elif [ -f /etc/gentoo-release ] ; then
+ # TODO: add support
+ unsupported
+elif [ -f /etc/slackware-version ] ; then
+ # TODO: add support
+ unsupported
+elif [ -f /etc/debian_version ] ; then
+ # TODO: add support
+ unsupported
else
# TODO: support other distros
unknown_distro
-fi
+fi
exit $RET
Index: hal-system-power-set-power-save
===================================================================
RCS file: /cvs/hal/hal/tools/hal-system-power-set-power-save,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- hal-system-power-set-power-save 16 Aug 2005 18:08:42 -0000 1.1
+++ hal-system-power-set-power-save 19 Aug 2005 12:33:48 -0000 1.2
@@ -1,10 +1,56 @@
#!/bin/sh
-
read value
-# TODO: write code here
-if [ $value = "true" ]; then
- echo TODO: enable power savings
-elif [ $value = "false" ]; then
- echo TODO: disable power savings
-fi
+unknown_distro() {
+ echo org.freedesktop.Hal.Device.SystemPowerManagement.NotSupported >&2
+ echo Unsupported Operating System >&2
+ todo
+}
+
+todo() {
+ if [ $value = "true" ]; then
+ echo TODO: enable power savings
+ elif [ $value = "false" ]; then
+ echo TODO: disable power savings
+ fi
+ exit 1
+}
+
+
+if [ -f /etc/altlinux-release ] ; then
+ if [ -x /usr/bin/powersave ] ; then
+ if [ $value = "true" ]; then
+ /usr/bin/powersave -e Powersave
+ RET=$?
+ elif [ $value = "false" ]; then
+ /usr/bin/powersave -e Performance
+ RET=$?
+ fi
+ else
+ todo
+ fi
+elif [ -f /etc/redhat-release ] || [ -f /etc/fedora-release ] ; then
+ todo
+elif [ -f /etc/SuSE-release ] ; then
+ if [ $value = "true" ]; then
+ /usr/bin/powersave -e Powersave
+ RET=$?
+ elif [ $value = "false" ]; then
+ /usr/bin/powersave -e Performance
+ RET=$?
+ fi
+elif [ -f /etc/mandrake-release ] ; then
+ todo
+elif [ -f /etc/gentoo-release ] ; then
+ todo
+elif [ -f /etc/slackware-version ] ; then
+ todo
+elif [ -f /etc/debian_version ] ; then
+ todo
+else
+ # TODO: support other distros
+ unknown_distro
+fi
+
+exit $RET
+
Index: hal-system-power-suspend
===================================================================
RCS file: /cvs/hal/hal/tools/hal-system-power-suspend,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- hal-system-power-suspend 16 Aug 2005 18:08:42 -0000 1.1
+++ hal-system-power-suspend 19 Aug 2005 12:33:48 -0000 1.2
@@ -6,26 +6,55 @@
exit 1
}
-unknown_distro() {
+unsupported() {
echo org.freedesktop.Hal.Device.SystemPowerManagement.NotSupported >&2
echo No suspend script found >&2
exit 1
}
+unknown_distro() {
+ echo org.freedesktop.Hal.Device.SystemPowerManagement.NotSupported >&2
+ echo Unsupported Operating System >&2
+ exit 1
+}
+
read seconds_to_sleep
-if [ -f /etc/redhat-release ] || [ -f /etc/fedora-release ] ; then
+if [ -f /etc/altlinux-release ] ; then
+ if [ -x /usr/bin/powersave ] ; then
+ /usr/bin/powersave --suspend-to-ram
+ RET=$?
+ else
+ # TODO: add support
+ unsupported
+ fi
+elif [ -f /etc/redhat-release ] || [ -f /etc/fedora-release ] ; then
# TODO: fix pm-suspend to take a --wakeup-alarm argument
if [ $seconds_to_sleep != "0" ] ; then
- alarm_not_supported
+ alarm_not_supported
fi
/usr/sbin/pm-suspend
RET=$?
# TODO: fixup pm-suspend to define erroc code (see alarm above) and throw
# the appropriate exception
+elif [ -f /etc/SuSE-release ] ; then
+ /usr/bin/powersave --suspend-to-ram
+ RET=$?
+elif [ -f /etc/mandrake-release ] ; then
+ # TODO: add support
+ unsupported
+elif [ -f /etc/gentoo-release ] ; then
+ # TODO: add support
+ unsupported
+elif [ -f /etc/slackware-version ] ; then
+ # TODO: add support
+ unsupported
+elif [ -f /etc/debian_version ] ; then
+ # TODO: add support
+ unsupported
else
# TODO: support other distros
unknown_distro
-fi
+fi
exit $RET
- Previous message: hal/po ChangeLog, 1.21, 1.22 de.po, 1.11, 1.12 es.po, 1.1, 1.2 fr.po,
1.10, 1.11 it.po, 1.3, 1.4 zh_TW.po, 1.2, 1.3
- Next message: hal ChangeLog,1.602,1.603
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the hal-commit
mailing list