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.
This commit is contained in:
Jan Luebbe 2015-06-23 14:21:57 +02:00 committed by Holger Hans Peter Freyther
parent 78b77de220
commit 2ad885f06a
3 changed files with 25 additions and 1 deletions

View File

@ -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 \
"

View File

@ -0,0 +1,9 @@
[Unit]
Description=Emergency Reboot
DefaultDependencies=no
Conflicts=shutdown.target
Before=shutdown.target
[Service]
ExecStart=/bin/systemctl --force reboot
Type=oneshot

View File

@ -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"