From 29a93c0238a7b8503012b9396789062d225ff93f Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Mon, 1 Feb 2010 23:35:40 +0100 Subject: [PATCH] Support bootoption bootid=.... --- debian/patches/00list | 1 + debian/patches/12_uuid_support.dpatch | 93 +++++++++++++++++++++++++++++++++++ 2 files changed, 94 insertions(+) create mode 100755 debian/patches/12_uuid_support.dpatch diff --git a/debian/patches/00list b/debian/patches/00list index 6fb2fe4..d166435 100644 --- a/debian/patches/00list +++ b/debian/patches/00list @@ -9,3 +9,4 @@ 09_fix_resolvconf_pxeboot.dpatch 10_support_ethdevice.dpatch 11_dhcphostname.patch +12_uuid_support.dpatch diff --git a/debian/patches/12_uuid_support.dpatch b/debian/patches/12_uuid_support.dpatch new file mode 100755 index 0000000..85bb1db --- /dev/null +++ b/debian/patches/12_uuid_support.dpatch @@ -0,0 +1,93 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 12_uuid_support.dpatch by Michael Prokop +## +## DP: This patch enables support for verifying the ISO through bootid=.... bootoption. +## DP: Logic behind bootoptions and possible combinations: +## DP: * bootid.txt + wrong bootid=... => fails to boot +## DP: * bootid.txt + right bootid=... => boots +## DP: * bootid.txt + ignore_bootid => boots +## DP: * bootid.txt + no bootid=... + no ignore_bootid => fails to boot +## DP: * no bootid.txt + no bootid=... + no ignore_bootid => boots +## DP: * no bootid.txt + bootid=... => fails to boot +## DP: * no bootid.txt + ignore_bootid=... => boots + +@DPATCH@ +diff -urNad live-initramfs-grml~/scripts/live live-initramfs-grml/scripts/live +--- live-initramfs-grml~/scripts/live 2010-02-01 20:31:44.410884646 +0100 ++++ live-initramfs-grml/scripts/live 2010-02-01 20:32:09.131721944 +0100 +@@ -54,6 +54,12 @@ + export ACCESS + ;; + ++ bootid=*) ++ BOOTID="${ARGUMENT#bootid=}" ++ export BOOTID ++ ;; ++ ++ + console=*) + DEFCONSOLE="${ARGUMENT#*=}" + export DEFCONSOLE +@@ -129,6 +135,11 @@ + export USERFULLNAME LIVECONF + ;; + ++ ignore_bootid) ++ IGNORE_BOOTID="Yes" ++ export IGNORE_BOOTID ++ ;; ++ + ignore_uuid) + IGNORE_UUID="Yes" + export IGNORE_UUID +@@ -556,6 +567,41 @@ + return 1 + } + ++grml_match_bootid() ++{ ++ path="$1" ++ ++ if [ -n "$IGNORE_BOOTID" ] ; then ++ echo " * Ignoring verification of bootid.txt as requested via ignore_bootid.">>/live.log ++ return 0 ++ fi ++ ++ if [ -n "$BOOTID" ] && ! [ -r "${path}/conf/bootid.txt" ] ; then ++ echo " * Warning: bootid=... specified but no bootid.txt found on currently requested device.">>/live.log ++ return 1 ++ fi ++ ++ [ -r "${path}/conf/bootid.txt" ] || return 0 ++ ++ bootid_conf=$(cat "${path}/conf/bootid.txt") ++ ++ if [ -z "$BOOTID" -a -z "$IGNORE_BOOTID" ] ++ then ++ echo " * Warning: bootid.txt found but ignore_bootid / bootid=.. bootoption missing...">>/live.log ++ return 1 ++ fi ++ ++ if [ "$BOOTID" = "$bootid_conf" ] ++ then ++ echo " * Successfully verified /conf/bootid.txt from ISO, continuing... ">>/live.log ++ else ++ echo " * Warning: BOOTID of ISO does not match. Retrying and continuing search...">>/live.log ++ return 1 ++ fi ++ ++ return 0 ++} ++ + matches_uuid () + { + if [ "${IGNORE_UUID}" ] || [ ! -e /conf/uuid.conf ] +@@ -1504,7 +1550,7 @@ + fi + + if is_live_path ${mountpoint} && \ +- ([ "${skip_uuid_check}" ] || matches_uuid ${mountpoint}) ++ ([ "${skip_uuid_check}" ] || grml_match_bootid ${mountpoint}) + then + echo ${mountpoint} + return 0 -- 2.1.4