diff --git a/package/harvester-os/files/etc/systemd/system/rke2-shutdown.service b/package/harvester-os/files/etc/systemd/system/rke2-shutdown.service new file mode 100644 index 000000000..a72d45a0f --- /dev/null +++ b/package/harvester-os/files/etc/systemd/system/rke2-shutdown.service @@ -0,0 +1,13 @@ +[Unit] +Description=Kill RKE2 Containers for clean unmount +DefaultDependencies=no +RefuseManualStart=yes +Before=reboot.target halt.target shutdown.target poweroff.target umount.target final.target + +[Install] +RequiredBy=reboot.target halt.target shutdown.target poweroff.target umount.target final.target + +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStart=-/usr/local/bin/rke2-killall.sh diff --git a/package/harvester-os/files/system/oem/91_rke2-shutdown.yaml b/package/harvester-os/files/system/oem/91_rke2-shutdown.yaml new file mode 100644 index 000000000..6758e5e78 --- /dev/null +++ b/package/harvester-os/files/system/oem/91_rke2-shutdown.yaml @@ -0,0 +1,7 @@ +name: "Enable RKE2 shutdown service" +stages: + initramfs: + - name: "enable rke2-shutdown.service" + if: 'grep -q root=LABEL=COS_ACTIVE /proc/cmdline && [ -n "$(blkid -L COS_ACTIVE)" ]' + commands: + - systemctl enable rke2-shutdown.service