From 02dff0421246dcd9e1a03d4bc97165455ca36715 Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Mon, 16 May 2022 10:58:30 +0200 Subject: [PATCH] Shutdown immeaditly on ACPI Power Button events (#1896) (#1898) For phyiscal hardware the default Power Button action has been disabled to avoid accidentally power down the machine. However, for virtual machine this method is often used to shutdown the virtual machine gracefully. Use the regular power settings for virtual machines. --- .../rootfs-overlay/etc/systemd/logind.conf | 45 +++++++++++++++++++ buildroot-external/configs/ova_defconfig | 2 +- 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 buildroot-external/board/pc/ova/rootfs-overlay/etc/systemd/logind.conf diff --git a/buildroot-external/board/pc/ova/rootfs-overlay/etc/systemd/logind.conf b/buildroot-external/board/pc/ova/rootfs-overlay/etc/systemd/logind.conf new file mode 100644 index 000000000..078b4f55a --- /dev/null +++ b/buildroot-external/board/pc/ova/rootfs-overlay/etc/systemd/logind.conf @@ -0,0 +1,45 @@ +# This file is part of systemd. +# +# systemd is free software; you can redistribute it and/or modify it under the +# terms of the GNU Lesser General Public License as published by the Free +# Software Foundation; either version 2.1 of the License, or (at your option) +# any later version. +# +# Entries in this file show the compile time defaults. Local configuration +# should be created by either modifying this file, or by creating "drop-ins" in +# the logind.conf.d/ subdirectory. The latter is generally recommended. +# Defaults can be restored by simply deleting this file and all drop-ins. +# +# Use 'systemd-analyze cat-config systemd/logind.conf' to display the full config. +# +# See logind.conf(5) for details. + +[Login] +#NAutoVTs=6 +#ReserveVT=6 +#KillUserProcesses=yes +#KillOnlyUsers= +#KillExcludeUsers=root +#InhibitDelayMaxSec=5 +#UserStopDelaySec=10 +#HandlePowerKey=poweroff +#HandleSuspendKey=suspend +#HandleHibernateKey=hibernate +#HandleLidSwitch=suspend +#HandleLidSwitchExternalPower=suspend +#HandleLidSwitchDocked=ignore +#HandleRebootKey=reboot +#HandleRebootKeyLongPress=poweroff +#PowerKeyIgnoreInhibited=no +#SuspendKeyIgnoreInhibited=no +#HibernateKeyIgnoreInhibited=no +#LidSwitchIgnoreInhibited=yes +#RebootKeyIgnoreInhibited=no +#HoldoffTimeoutSec=30s +#IdleAction=ignore +#IdleActionSec=30min +#RuntimeDirectorySize=10% +#RuntimeDirectoryInodesMax=400k +#RemoveIPC=yes +#InhibitorsMax=8192 +#SessionsMax=8192 diff --git a/buildroot-external/configs/ova_defconfig b/buildroot-external/configs/ova_defconfig index e765a6f3c..8731a9b7e 100644 --- a/buildroot-external/configs/ova_defconfig +++ b/buildroot-external/configs/ova_defconfig @@ -14,7 +14,7 @@ BR2_TARGET_GENERIC_HOSTNAME="homeassistant" BR2_TARGET_GENERIC_ISSUE="Welcome to Home Assistant" BR2_INIT_SYSTEMD=y # BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW is not set -BR2_ROOTFS_OVERLAY="$(BR2_EXTERNAL_HASSOS_PATH)/rootfs-overlay" +BR2_ROOTFS_OVERLAY="$(BR2_EXTERNAL_HASSOS_PATH)/rootfs-overlay $(BR2_EXTERNAL_HASSOS_PATH)/board/pc/ova/rootfs-overlay" BR2_ROOTFS_POST_BUILD_SCRIPT="$(BR2_EXTERNAL_HASSOS_PATH)/scripts/post-build.sh" BR2_ROOTFS_POST_IMAGE_SCRIPT="$(BR2_EXTERNAL_HASSOS_PATH)/scripts/post-image.sh" BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_EXTERNAL_HASSOS_PATH)/board/pc/ova $(BR2_EXTERNAL_HASSOS_PATH)/board/pc/ova/hassos-hook.sh"