#!/bin/sh -efu

# e2k has a different module
[ `arch` != e2k ] || exit 0

a= . install2-init-functions

# /proc/acpi indicates present ACPI support (in installer too)
if [ ! -d /proc/acpi/ ]; then
	[ -x $destdir/etc/init.d/apmd ] && exec_chroot chkconfig apmd on ||:
	exit 0
fi

# provide kernel interface for ACPI power button
grep -qsx button $destdir/etc/modules ||
	echo button >> $destdir/etc/modules

# is powersaved starting?  if yes, it will (re)start acpid
[ -x $destdir/etc/init.d/powersaved ] &&
exec_chroot chkconfig --list powersaved |grep -qs '[345]:on' &&
ACPID=off ||
	ACPID=on

[ -x $destdir/etc/init.d/acpid ] &&
exec_chroot chkconfig acpid "$ACPID" ||:
