xref: /illumos-gate/usr/src/cmd/hal/tools/sunos/hal-system-power-hibernate-sunos.sh (revision bb9b6b3f59b8820022416cea99b49c50fef6e391)
1#!/bin/sh
2#
3# hal-system-power-hibernate-sunos.sh
4#
5# Licensed under the Academic Free License version 2.1
6#
7
8unsupported() {
9	echo org.freedesktop.Hal.Device.SystemPowerManagement.NotSupported >&2
10	echo No hibernate method found >&2
11	exit 1
12}
13
14if [ -x "/usr/sbin/uadmin" ] ; then
15	/usr/sbin/uadmin 3 0
16	RET=$?
17else
18	unsupported
19fi
20
21#Refresh devices as a resume can do funny things
22for type in button battery ac_adapter
23do
24	devices=`hal-find-by-capability --capability $type`
25	for device in $devices
26	do
27		dbus-send --system --print-reply --dest=org.freedesktop.Hal \
28			  $device org.freedesktop.Hal.Device.Rescan
29	done
30done
31
32exit $RET
33