summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTails developers <amnesia@boum.org>2011-10-20 16:28:02 +0200
committerTails developers <amnesia@boum.org>2011-10-20 16:28:02 +0200
commit51b27d5fac5b24a4ec1c25bde1d3001c434d5ca6 (patch)
tree1dcdb86f02e0fe0598a1a39cf77dd04f57d54f6e
parent707f2e202a55c1af6d4f69fcfe6fd215dab9a449 (diff)
Factor out running kernel/initrd information extraction to a script.
Our upcoming memlockd reconfiguration initscript will need this as well.
-rw-r--r--config/chroot_local-includes/etc/default/kexec15
-rwxr-xr-xconfig/chroot_local-includes/usr/local/bin/tails-get-bootinfo31
2 files changed, 33 insertions, 13 deletions
diff --git a/config/chroot_local-includes/etc/default/kexec b/config/chroot_local-includes/etc/default/kexec
index 13cab1b..107bbf0 100644
--- a/config/chroot_local-includes/etc/default/kexec
+++ b/config/chroot_local-includes/etc/default/kexec
@@ -5,19 +5,8 @@
LOAD_KEXEC=true
# Kernel and initrd image
-LIVE_IMAGE_MOUNTPOINT=/live/image
-for arg in $(cat /proc/cmdline) ; do
- case "$arg" in
- BOOT_IMAGE=*)
- kernel="${arg#BOOT_IMAGE=}"
- ;;
- initrd=*)
- initrd="${arg#initrd=}"
- ;;
- esac
-done
-KERNEL_IMAGE="${LIVE_IMAGE_MOUNTPOINT}${kernel}"
-INITRD="${LIVE_IMAGE_MOUNTPOINT}${initrd}"
+KERNEL_IMAGE=$(/usr/local/bin/tails-get-bootinfo kernel)
+INITRD=$(/usr/local/bin/tails-get-bootinfo initrd)
# If empty, use current /proc/cmdline
APPEND="quiet"
diff --git a/config/chroot_local-includes/usr/local/bin/tails-get-bootinfo b/config/chroot_local-includes/usr/local/bin/tails-get-bootinfo
new file mode 100755
index 0000000..9261e9d
--- /dev/null
+++ b/config/chroot_local-includes/usr/local/bin/tails-get-bootinfo
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+LIVE_IMAGE_MOUNTPOINT=/live/image
+for arg in $(cat /proc/cmdline) ; do
+ case "$arg" in
+ BOOT_IMAGE=*)
+ kernel="${arg#BOOT_IMAGE=}"
+ ;;
+ initrd=*)
+ initrd="${arg#initrd=}"
+ ;;
+ esac
+done
+
+# Sanity checks
+[ -n "$kernel" ] || exit 4
+[ -n "$initrd" ] || exit 5
+
+case "$1" in
+ kernel)
+ echo "${LIVE_IMAGE_MOUNTPOINT}${kernel}"
+ ;;
+ initrd)
+ echo "${LIVE_IMAGE_MOUNTPOINT}${initrd}"
+ ;;
+ *)
+ usage "$0 kernel|initrd"
+ exit 3
+esac
+
+exit 0