## Copyright (C) 2025 - 2025 ENCRYPTED SUPPORT LLC <adrelanos@whonix.org>
## See the file COPYING for copying conditions.

[Unit]
Description=Emergency shutdown when boot media is removed
Documentation=https://github.com/Kicksecure/security-misc
DefaultDependencies=no
Before=sysinit.target
Requires=systemd-udevd.service
After=systemd-udevd.service
Requires=local-fs.target
After=local-fs.target
ConditionPathExists=!/usr/share/qubes/marker-vm
## Do not run emerg-shutdown.service in case 'rd.live.ram' or 'rd.live.ram=1'
## is set.
## https://forums.kicksecure.com/t/how-to-run-iso-live-mode-from-ram/1542/9
ConditionKernelCommandLine=!rd.live.ram
ConditionKernelCommandLine=!rd.live.ram=1

[Service]
Type=notify
ExecStart=/usr/libexec/security-misc/emerg-shutdown
NotifyAccess=main

[Install]
WantedBy=sysinit.target
