Implement basic ACPI shutdown support via busybox acpid (#209)

On systems where ACPI support is present as inidcated by the presence of
/proc/acpi (e.g. on OVA compatible hypervisors), we want to properly
shut down the system when the power button is pressed (or the hypervisor
simulates this kind of event to the guest machine that executes hassos).

This changeset provides the following basic infrastructure for this
feature to work as expected:

 * a systemd service to start acpid, if ACPI support can be assumed
 * an acpid configuration directory
 * a trivial shutdown script to invoke when a PWR event is registered
This commit is contained in:
Johannes Truschnigg 2018-10-10 11:34:06 +02:00 committed by Pascal Vizeli
parent 9af71ce9ea
commit 8ffcd3efb9
3 changed files with 20 additions and 0 deletions

View File

@ -0,0 +1,7 @@
#!/bin/sh
# This script is exec()d by acpid when an ACPI event signals the power button
# to have been pressed.
echo "System power button was pressed - shutting down..."
exec /bin/systemctl poweroff

View File

@ -0,0 +1 @@
/usr/lib/systemd/system/busybox-acpid.service

View File

@ -0,0 +1,12 @@
[Unit]
Description=acpid (busybox)
RefuseManualStop=true
ConditionPathIsDirectory=/proc/acpi
[Service]
Type=simple
ExecStart=/sbin/acpid -d
[Install]
After=local-fs.target
WantedBy=multi-user.target