summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'sys-apps')
-rw-r--r--sys-apps/systemd-units/files/90_kexec12
-rw-r--r--sys-apps/systemd-units/files/services-server/kexec-load_at.service12
-rw-r--r--sys-apps/systemd-units/systemd-units-7.ebuild (renamed from sys-apps/systemd-units/systemd-units-6.ebuild)12
3 files changed, 36 insertions, 0 deletions
diff --git a/sys-apps/systemd-units/files/90_kexec b/sys-apps/systemd-units/files/90_kexec
new file mode 100644
index 0000000..19a7b5c
--- /dev/null
+++ b/sys-apps/systemd-units/files/90_kexec
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+version="$1" ; shift
+image="$1" ; shift
+
+for s in `systemctl show kexec.target | sed -nre 's/^Wants=(.*)/\1/p'` ; do
+ case "${s}" in
+ kexec-load@*) systemctl disable "${s}" ;;
+ esac
+done
+
+exec systemctl enable kexec-load@"${version}"
diff --git a/sys-apps/systemd-units/files/services-server/kexec-load_at.service b/sys-apps/systemd-units/files/services-server/kexec-load_at.service
new file mode 100644
index 0000000..e75e594
--- /dev/null
+++ b/sys-apps/systemd-units/files/services-server/kexec-load_at.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=load %i kernel into the current kernel
+Documentation=man:kexec(8)
+DefaultDependencies=no
+Before=shutdown.target umount.target final.target
+
+[Service]
+Type=oneshot
+ExecStart=/usr/sbin/kexec -l /boot/vmlinuz-%i --initrd=/boot/initramfs-%i.img --reuse-cmdline
+
+[Install]
+WantedBy=kexec.target
diff --git a/sys-apps/systemd-units/systemd-units-6.ebuild b/sys-apps/systemd-units/systemd-units-7.ebuild
index 630c8b5..0ef9f2d 100644
--- a/sys-apps/systemd-units/systemd-units-6.ebuild
+++ b/sys-apps/systemd-units/systemd-units-7.ebuild
@@ -25,6 +25,10 @@ src_install() {
if use server; then
systemd_dounit "${FILESDIR}"/services-server/*
systemd_dotmpfilesd "${FILESDIR}"/tmpfiles-server/*
+ (
+ insinto /etc/kernel/postinst.d/
+ doins "${FILESDIR}"/90_kexec
+ )
fi
if use desktop; then
@@ -39,3 +43,11 @@ src_install() {
# convert the code string "_at" into an '@' before installing.
rename '_at' '@' "${D}/$(systemd_get_unitdir)"/*
}
+
+pkg_postinst() {
+ if use server; then
+ elog "The file '${ROOT}etc/kernel/postinst.d/90_kexec' has been"
+ elog "installed for you. If you use kexec, you may want to enable it by"
+ elog "making it exectuable."
+ fi
+}