summaryrefslogtreecommitdiff
path: root/usr/src/cmd/hal/tools/sunos/hal-system-power-hibernate-sunos.sh
blob: e6bd73c027d8c65a3d08e1267249e688f4577ded (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/sh
#
# hal-system-power-hibernate-sunos.sh
#
# Licensed under the Academic Free License version 2.1
#

unsupported() {
	echo org.freedesktop.Hal.Device.SystemPowerManagement.NotSupported >&2
	echo No hibernate method found >&2
	exit 1
}

if [ -x "/usr/sbin/uadmin" ] ; then
	/usr/sbin/uadmin 3 0 
	RET=$?
else
	unsupported
fi

#Refresh devices as a resume can do funny things
for type in button battery ac_adapter
do
	devices=`hal-find-by-capability --capability $type`
	for device in $devices
	do
		dbus-send --system --print-reply --dest=org.freedesktop.Hal \
			  $device org.freedesktop.Hal.Device.Rescan
	done
done

exit $RET