+03_grml_version_file_hook.dpatch
+05_boot_failure_message_grml.dpatch
+07_support_findiso.dpatch
+08_grml_defaults.dpatch
+09_bootoption_noudev.dpatch
+10_validateroot.dpatch
+11_dhcphostname.dpatch
+12_uuid_support.dpatch
+13_always_display_warnings_and_failures.dpatch
+14_no_blkid_on_lenny.dpatch
--- /dev/null
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 03_grml_version_file_hook.dpatch by <mika@grml.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Copy /etc/grml_version to initrd
+
+@DPATCH@
+
+diff --git a/hooks/live b/hooks/live
+index b5d43f2..ef95275 100755
+--- a/hooks/live
++++ b/hooks/live
+@@ -38,6 +38,12 @@ then
+ done
+ fi
+
++# Grml version information:
++if [ -r /etc/grml_version ]
++then
++ cp /etc/grml_version "${DESTDIR}"/etc
++fi
++
+ # Handling live-boot
+
+ # Configuration
--- /dev/null
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 05_boot_failure_message_grml.dpatch by <mika@grml.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Copy /etc/grml_version to initrd
+
+@DPATCH@
+
+diff --git a/scripts/live-functions b/scripts/live-functions
+index 5efe432..faaf23e 100644
+--- a/scripts/live-functions
++++ b/scripts/live-functions
+@@ -88,14 +88,20 @@ panic() {
+ printf " ${DEB_1}\n"
+ printf " ${DEB_2} \033[1;37mBOOT FAILED!\033[0m\n"
+ printf " ${DEB_3}\n"
+- printf " ${DEB_4} This Debian Live image failed to boot.\n\n"
++ printf " ${DEB_4} This image failed to boot.\n\n"
+
+- printf " Please file a bug against the 'live-boot' package or email the Debian\n"
+- printf " Live mailing list at <debian-live@lists.debian.org>, making sure to note the\n"
+- printf " exact version, name and distribution of the image you were attempting to boot.\n\n"
++ printf " Please file a bug at your distributors bug tracking system, making\n"
++ printf " sure to note the exact version, name and distribution of the image\n"
++ printf " you were attempting to boot.\n\n"
++
++ if [ -r /etc/grml_version ]
++ then
++ GRML_VERSION="$(cat /etc/grml_version)"
++ printf " $GRML_VERSION\n\n"
++ fi
+
+ printf " The file ${LIVELOG} contains some debugging information but booting with the\n"
+- printf " ${DEBUG} command-line parameter will greatly increase its verbosity which is\n"
++ printf " ${DEBUG}=1 command-line parameter will greatly increase its verbosity which is\n"
+ printf " extremely useful when diagnosing issues.\n\n"
+
+ if [ -n "${panic}" ]; then
--- /dev/null
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 07_support_findiso.dpatch by Michael Schierl <schierlm@gmx.de>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: support for findoiso bootoption
+# When booting with findiso=/grml_2010.05.iso, it will look for
+# that .iso file on all disks where it usually looks for the .squashfs
+# file. When it is found, the disk containing the iso is read-only mounted
+# as /live/findiso (and exposed there after boot completed). The squashfs
+# file is searched inside that ISO file then.
+
+@DPATCH@
+diff --git a/scripts/live b/scripts/live
+index d79beed..04ad61e 100755
+--- a/scripts/live
++++ b/scripts/live
+@@ -102,6 +102,11 @@ Arguments ()
+ export FETCH
+ ;;
+
++ findiso=*)
++ FINDISO="${ARGUMENT#findiso=}"
++ export FINDISO
++ ;;
++
+ forcepersistentfsck)
+ FORCEPERSISTENTFSCK="Yes"
+ export FORCEPERSISTENTFSCK
+@@ -1526,6 +1531,19 @@ check_dev ()
+ mount -t ${fstype} -o ro,noatime "${devname}" ${mountpoint} || continue
+ [ -n "$devuid" ] && echo "$devuid" >> $tried
+
++ if [ -n "${FINDISO}" ]
++ then
++ if [ -f ${mountpoint}/${FINDISO} ]
++ then
++ umount ${mountpoint}
++ mkdir /live/findiso -p
++ mount -t ${fstype} -o ro,noatime "${devname}" /live/findiso
++ loopdevname=$(setup_loop "/live/findiso/${FINDISO}" "loop" "/sys/block/loop*" "" '')
++ devname="${loopdevname}"
++ mount -t iso9660 -o ro,noatime "${devname}" ${mountpoint}
++ fi
++ fi
++
+ if is_live_path ${mountpoint} && \
+ ([ "${skip_uuid_check}" ] || matches_uuid ${mountpoint})
+ then
--- /dev/null
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 08_grml_defaults.dpatch by Christian Hofstaedtler <ch@grml.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Pseudo-brand as grml
+
+@DPATCH@
+diff --git a/scripts/live b/scripts/live
+index d79beed..04ad61e 100755
+--- a/scripts/live
++++ b/scripts/live
+@@ -16,9 +16,9 @@ home_persistence="home-rw"
+ root_snapshot_label="live-sn"
+ home_snapshot_label="home-sn"
+
+-USERNAME="user"
+-USERFULLNAME="Live user"
+-HOSTNAME="host"
++USERNAME="grml"
++USERFULLNAME="grml user"
++HOSTNAME="grml"
+
+ mkdir -p "${mountpoint}"
+ tried="/tmp/tried"
+
--- /dev/null
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 09_bootoption_noudev.dpatch by Christian Hofstaedtler <ch@grml.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: honor bootoption "noudev"
+
+@DPATCH@
+diff --git a/scripts/live-bottom/23networking b/scripts/live-bottom/23networking
+index 9554b77..f85b29e 100755
+--- a/scripts/live-bottom/23networking
++++ b/scripts/live-bottom/23networking
+@@ -46,8 +46,13 @@ iface lo inet loopback
+
+ EOF
+
+-udevadm trigger
+-udevadm settle
++if grep -q noudev /proc/cmdline
++then
++ log_begin_msg "Skipping udev as requested via bootoption noudev."
++else
++ udevadm trigger
++ udevadm settle
++fi
+
+ if [ -z "${NETBOOT}" -a -n "${STATICIP}" -a "${STATICIP}" != "frommedia" ]
+ then
--- /dev/null
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 10_validateroot.dpatch by Christian Hofstaedtler <ch@grml.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: add live-bottom/10validateroot
+
+@DPATCH@
+diff --git a/scripts/live-bottom/10validateroot b/scripts/live-bottom/10validateroot
+new file mode 100755
+index 0000000..8d42afc
+--- /dev/null
++++ b/scripts/live-bottom/10validateroot
+@@ -0,0 +1,27 @@
++#!/bin/sh
++
++#set -e
++
++# initramfs-tools header
++
++PREREQ=""
++
++prereqs()
++{
++ echo "${PREREQ}"
++}
++
++case "${1}" in
++ prereqs)
++ prereqs
++ exit 0
++ ;;
++esac
++
++. /scripts/live-functions
++. /scripts/live-helpers
++
++if ! [ -x "/root/sbin/init" ] ; then
++ panic "rootfs can not be mounted as supposed because of fatal error during bootup."
++fi
++
--- /dev/null
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 11_dhcphostname.dpatch by Andreas Thienemann <andreas@bawue.net>
+## and Michael Prokop <mika@grml.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Support disabling setting hostname via DNS info
+
+@DPATCH@
+
+Support 'nodhcphostname' option which will disable setting the
+hostname of the booted system according to the DNS information.
+This patch takes care of the netboot case.
+
+diff --git a/scripts/live-bottom/23networking b/scripts/live-bottom/23networking
+index 9554b77..9270e9c 100755
+--- a/scripts/live-bottom/23networking
++++ b/scripts/live-bottom/23networking
+@@ -135,6 +135,19 @@ ${rc_server1}
+ EOF
+
+ cat /root/etc/resolv.conf >> /root/var/log/netboot.config
++
++ if [ -z "$NODHCPHOSTNAME" ]
++ then
++ dhcp_address=$(cat netboot.config | awk '/address:/{print $2}')
++ dhcp_hostname=$(busybox nslookup ${dhcp_address} ${rc_server0#nameserver }| awk \
++ '/Address 1: '${dhcp_address}'/{ print $4 }')
++
++ if [ -n "$dhcp_hostname" ]
++ then
++ echo $dhcp_hostname > /root/etc/hostname
++ fi
++ unset dhcp_address dhcp_hostname dhcp_hostname
++ fi
+ fi
+ fi
+ fi
+--- a/scripts/live
++++ b/scripts/live
+@@ -216,6 +216,11 @@ Arguments ()
+ export NOACCESSIBILITY
+ ;;
+
++ nodhcphostname)
++ NODHCPHOSTNAME="Yes"
++ export NODHCPHOSTNAME
++ ;;
++
+ nofastboot)
+ NOFASTBOOT="Yes"
+ export NOFASTBOOT
+
--- /dev/null
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 12_uuid_support.dpatch by Michael Prokop <prokop@grml-forensic.org>
+##
+## 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 --git a/scripts/live b/scripts/live
+index abce3cd..851796c 100755
+--- a/scripts/live
++++ b/scripts/live
+@@ -63,6 +63,11 @@ Arguments ()
+ export ACCESS
+ ;;
+
++ bootid=*)
++ BOOTID="${ARGUMENT#bootid=}"
++ export BOOTID
++ ;;
++
+ console=*)
+ DEFCONSOLE="${ARGUMENT#*=}"
+ export DEFCONSOLE
+@@ -140,6 +145,11 @@ Arguments ()
+ export FROMISO
+ ;;
+
++ ignore_bootid)
++ IGNORE_BOOTID="Yes"
++ export IGNORE_BOOTID
++ ;;
++
+ ignore_uuid)
+ IGNORE_UUID="Yes"
+ export IGNORE_UUID
+@@ -392,6 +402,42 @@ is_live_path ()
+ 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 ]
+@@ -1550,7 +1596,7 @@ check_dev ()
+ fi
+
+ if is_live_path ${mountpoint} && \
+- ([ "${skip_uuid_check}" ] || matches_uuid ${mountpoint})
++ ([ "${skip_uuid_check}" ] || grml_match_bootid ${mountpoint})
+ then
+ echo ${mountpoint}
+ return 0
+@@ -1665,19 +1711,6 @@ find_livefs ()
+ return 0
+ fi
+ done
+- elif [ "${fstype}" = "squashfs" -o \
+- "${fstype}" = "btrfs" -o \
+- "${fstype}" = "ext2" -o \
+- "${fstype}" = "ext3" -o \
+- "${fstype}" = "ext4" -o \
+- "${fstype}" = "jffs2" ]
+- then
+- # This is an ugly hack situation, the block device has
+- # an image directly on it. It's hopefully
+- # live-boot, so take it and run with it.
+- ln -s "${devname}" "${devname}.${fstype}"
+- echo "${devname}.${fstype}"
+- return 0
+ fi
+ done
+
--- /dev/null
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 13_always_display_warnings_and_failures.dpatch by Michael Prokop <mika@grml.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Always display failure and warning messages.
+
+@DPATCH@
+--- live-initramfs-grml~/scripts/live-functions 2010-02-20 16:03:43.155342432 +0100
++++ live-initramfs-grml/scripts/live-functions 2010-02-20 16:04:08.675380352 +0100
+@@ -2,6 +2,17 @@
+ . /scripts/functions
+ . /live.vars
+
++# we definitely want this stuff visible
++log_failure_msg()
++{
++ printf "Failure: $@\n"
++}
++
++log_warning_msg()
++{
++ printf "Warning: $@\n"
++}
++
+ log_wait_msg ()
+ {
+ # Print a message and wait for enter
--- /dev/null
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 14_no_blkid_on_lenny.dpatch by Michael Prokop <mika@grml.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: util-linux of lenny doesn't ship the initramfs-tools file
+## DP: /usr/share/initramfs-tools/hooks/utillinux yet which ensures
+## DP: that blkid is available, so therefore fall back to
+## DP: /lib/udev/vol_id in /scripts/live as well
+
+@DPATCH@
+--- a/scripts/live
++++ b/scripts/live
+@@ -1577,7 +1577,12 @@ check_dev ()
+
+ if is_supported_fs ${fstype}
+ then
+- devuid=$(blkid -o value -s UUID "$devname")
++ # lenny
++ if command -v blkid >/dev/null 2>&1 ; then
++ devuid=$(blkid -o value -s UUID "${devname}")
++ elif [ -x /lib/udev/vol_id ]; then
++ devuid=$(/lib/udev/vol_id --uuid "${devname}" 2>/dev/null)
++ fi
+ [ -n "$devuid" ] && grep -qs "\<$devuid\>" $tried && continue
+ mount -t ${fstype} -o ro,noatime "${devname}" ${mountpoint} || continue
+ [ -n "$devuid" ] && echo "$devuid" >> $tried
--- /dev/null
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 09_fix_resolvconf_pxeboot.dpatch by Michael Prokop <mika@grml.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: fix resolvconf handling when booting via PXE
+##
+## When installing grml for PXE boot the system has network after
+## boot but no usable DNS. /etc/resolv.conf is empty except the
+## warning to not edit this file manually but to use the resolvconf
+## tool.
+##
+## The problem is, that the 23networking scripte in the initrd
+## correctly creates the resolv.conf, but it's being overwritten by
+## the resolvconf utility on boot.
+##
+## The fix for now is to remove the symlink so resolvconf breaks
+## early and DNS is working then.
+
+@DPATCH@
+diff --git a/scripts/live-bottom/23networking b/scripts/live-bottom/23networking
+index 72aaf12..244eeca 100755
+--- a/grml/23networking
++++ b/grml/23networking
+@@ -110,6 +110,11 @@ EOF
+ then
+ if [ -f /netboot.config ]
+ then
++ if [ -h /root/etc/resolv.conf ]
++ then
++ rm /root/etc/resolv.conf
++ fi
++
+ # create a resolv.conf if it is not present or empty
+ cp /netboot.config /root/var/log/netboot.config
+