From 2ad885f06aa6d2ac4214c6ae28ac82bd7534e828 Mon Sep 17 00:00:00 2001 From: Jan Luebbe Date: Tue, 23 Jun 2015 14:21:57 +0200 Subject: [PATCH] systemd: ship emergency.service which triggers a reboot This reboots the system instead of starting a shell on boot problems. Because the slot will only be marked as sucessfully booted as the last step in a normal boot, repeated emergency boots will cause a fallback at the boot chooser level to the other slot. Testing this is possible by passing 'emergency' via the kernel command line. --- recipes-apps/tasks/task-sysmocom-tools.bb | 3 ++- .../sysmocom-systemd/files/emergency.service | 9 +++++++++ .../sysmocom-systemd/sysmocom-systemd_1.0.bb | 14 ++++++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 recipes-config/sysmocom-systemd/files/emergency.service create mode 100644 recipes-config/sysmocom-systemd/sysmocom-systemd_1.0.bb diff --git a/recipes-apps/tasks/task-sysmocom-tools.bb b/recipes-apps/tasks/task-sysmocom-tools.bb index 8f6c4e7..96e6307 100644 --- a/recipes-apps/tasks/task-sysmocom-tools.bb +++ b/recipes-apps/tasks/task-sysmocom-tools.bb @@ -3,7 +3,7 @@ LICENSE = "MIT" LIC_FILES_CHKSUM = " \ file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" ALLOW_EMPTY_${PN} = "1" -PR = "r9" +PR = "r10" RDEPENDS_${PN} = "\ lmsensors-scripts \ @@ -16,4 +16,5 @@ RDEPENDS_${PN} = "\ ca-cacert-rootcert \ sysmocom-backup \ sysmocom-backup-default \ + sysmocom-systemd \ " diff --git a/recipes-config/sysmocom-systemd/files/emergency.service b/recipes-config/sysmocom-systemd/files/emergency.service new file mode 100644 index 0000000..34afaac --- /dev/null +++ b/recipes-config/sysmocom-systemd/files/emergency.service @@ -0,0 +1,9 @@ +[Unit] +Description=Emergency Reboot +DefaultDependencies=no +Conflicts=shutdown.target +Before=shutdown.target + +[Service] +ExecStart=/bin/systemctl --force reboot +Type=oneshot diff --git a/recipes-config/sysmocom-systemd/sysmocom-systemd_1.0.bb b/recipes-config/sysmocom-systemd/sysmocom-systemd_1.0.bb new file mode 100644 index 0000000..c9c2330 --- /dev/null +++ b/recipes-config/sysmocom-systemd/sysmocom-systemd_1.0.bb @@ -0,0 +1,14 @@ +DESCRIPTION = "sysmocom systemd customization" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" + +SRC_URI = " \ + file://emergency.service \ +" + +do_install() { + install -d ${D}${sysconfdir}/systemd/system + install -m 0644 ${WORKDIR}/emergency.service ${D}${sysconfdir}/systemd/system +} + +CONFFILES_${PN} += "${sysconfdir}/systemd/system/emergency.service"