Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions backend/initramfs-tools/grml.hook
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/sh

set -e

if [ -r /etc/grml_version ]
then
cp /etc/grml_version "${DESTDIR}"/etc
fi

# vlan support
if [ -x /sbin/vconfig ]
then
copy_exec /sbin/vconfig
manual_add_modules 8021q
fi

if [ -x /sbin/ethtool ]
then
copy_exec /sbin/ethtool
fi

27 changes: 27 additions & 0 deletions backend/initramfs-tools/grml_rm_mdadm_conf.hook
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/sh
#
# The mdadm hook installs /etc/mdadm/mdadm.conf from the build chroot
# into the initramfs. This contains the build host configuration, and
# is certainly wrong for the live system.
#
# This hook deletes the installed mdadm.conf, so mdadm default
# behaviour runs once again.

set -eu

PREREQ="mdadm"
prereqs()
{
echo "$PREREQ"
}

case "${1:-}" in
prereqs)
prereqs
exit 0
;;
esac

DESTMDADMCONF=$DESTDIR/etc/mdadm/mdadm.conf
rm -f "$DESTMDADMCONF"

18 changes: 0 additions & 18 deletions backend/initramfs-tools/live.hook
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@ do
fi
done

# Grml version information:
if [ -r /etc/grml_version ]
then
cp /etc/grml_version "${DESTDIR}"/etc
fi

# Checking live-boot
if [ ! -e /bin/live-boot ]
then
Expand Down Expand Up @@ -257,16 +251,4 @@ then
echo "hosts: files dns" > "${DESTDIR}/etc/nsswitch.conf"
fi

# vlan support
if [ -x /sbin/vconfig ]
then
copy_exec /sbin/vconfig
manual_add_modules 8021q
fi

if [ -x /sbin/ethtool ]
then
copy_exec /sbin/ethtool
fi

[ "${QUIET}" ] || echo .
20 changes: 0 additions & 20 deletions components/9990-cmdline-old
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@ Cmdline_old ()
unset DNS
;;

bootid=*)
BOOTID="${_PARAMETER#bootid=}"
export BOOTID
;;

dhcp)
# Force dhcp even while netbooting
# Use for debugging in case somebody works on fixing dhclient
Expand Down Expand Up @@ -92,11 +87,6 @@ Cmdline_old ()
export FROMISO
;;

ignore_bootid)
IGNORE_BOOTID="Yes"
export IGNORE_BOOTID
;;

ignore_uuid)
IGNORE_UUID="true"
export IGNORE_UUID
Expand Down Expand Up @@ -158,11 +148,6 @@ Cmdline_old ()
export NFS_COW
;;

nodhcphostname)
NODHCPHOSTNAME="Yes"
export NODHCPHOSTNAME
;;

nofstab)
NOFSTAB="true"
export NOFSTAB
Expand Down Expand Up @@ -269,11 +254,6 @@ Cmdline_old ()
UNIONTYPE="${_PARAMETER#union=}"
export UNIONTYPE
;;

vlan=*)
VLANS="${VLANS} ${_PARAMETER#vlan=}"
export VLANS
;;
esac
done

Expand Down
16 changes: 5 additions & 11 deletions components/9990-initramfs-tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,20 +52,14 @@ panic()
printf "\n\n"
printf " \033[1;37mBOOT FAILED!\033[0m\n"
printf "\n"
printf " This image failed to boot.\n\n"
printf " This Live System image failed 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 " Please file a bug against the 'live-boot' package or email the Debian Live\n"
printf " 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 " The file ${LIVELOG} contains some debugging information but booting with the\n"
printf " ${DEBUG}=1 command-line parameter will greatly increase its verbosity which is\n"
printf " ${DEBUG} command-line parameter will greatly increase its verbosity which is\n"
printf " extremely useful when diagnosing issues.\n\n"

if [ -n "${panic}" ]; then
Expand Down
53 changes: 1 addition & 52 deletions components/9990-misc-helpers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,42 +15,6 @@ 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.">>/boot.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.">>/boot.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...">>/boot.log
return 1
fi

if [ "$BOOTID" = "$bootid_conf" ]
then
echo " * Successfully verified /conf/bootid.txt from ISO, continuing... ">>/boot.log
else
echo " * Warning: BOOTID of ISO does not match. Retrying and continuing search...">>/boot.log
return 1
fi

return 0
}


matches_uuid ()
{
if [ "${IGNORE_UUID}" ] || [ ! -e /conf/uuid.conf ]
Expand Down Expand Up @@ -268,21 +232,6 @@ check_dev ()
# Adding raid support
if [ -x /scripts/local-block/mdadm ]
then
# Before actually doing anything, make sure that no auto-generated
# mdadm.conf is around in the initramfs.
# Short explanation of why this is needed:
# /usr/share/initramfs-tools/hooks/mdadm is executed as part of
# mkinitramfs, which generates an /etc/mdadm/mdadm.conf file if one
# doesn't exist yet (which should always be the case in our new
# chroot) based on the host system configuration. Eventually, this
# is copied into the generated initramfs and then causes issues on
# other systems.
# It's safe to delete the file within the initramfs. The actual
# squashfs root will not be affected by that (and, additionally,
# a FAI script makes sure that the mdadm.conf in there gets wiped
# of any auto-generated arrays).
rm -rf '/etc/mdadm/mdadm.conf'

# Back in the day, when there was still a local-top mdadm script, we
# used to select specific devices to be auto-assembled.
# This functionality was dropped in the local-block script, so just
Expand Down Expand Up @@ -393,7 +342,7 @@ check_dev ()
fi

if is_live_path ${mountpoint} && \
([ "${skip_uuid_check}" ] || grml_match_bootid ${mountpoint})
([ "${skip_uuid_check}" ] || matches_uuid ${mountpoint})
then
echo ${mountpoint}
return 0
Expand Down
39 changes: 39 additions & 0 deletions components/9995-bootid.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/sh

#set -e

# override matches_uuid from 9990-misc-helpers.sh to implement grml bootid feature
matches_uuid ()
{
path="$1"

if [ -n "$IGNORE_BOOTID" ] ; then
echo " * Ignoring verification of bootid.txt as requested via ignore_bootid.">>/boot.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.">>/boot.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...">>/boot.log
return 1
fi

if [ "$BOOTID" = "$bootid_conf" ]
then
echo " * Successfully verified /conf/bootid.txt from ISO, continuing... ">>/boot.log
else
echo " * Warning: BOOTID of ISO does not match. Retrying and continuing search...">>/boot.log
return 1
fi

return 0
}
35 changes: 35 additions & 0 deletions components/9995-cmdline.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/sh

#set -e

Cmdline_old ()
{
for _PARAMETER in ${LIVE_BOOT_CMDLINE}
do
case "${_PARAMETER}" in
bootid=*)
BOOTID="${_PARAMETER#bootid=}"
export BOOTID
;;

ignore_bootid)
IGNORE_BOOTID="Yes"
export IGNORE_BOOTID
;;

nodhcphostname)
NODHCPHOSTNAME="Yes"
export NODHCPHOSTNAME
;;

vlan=*)
VLANS="${VLANS} ${_PARAMETER#vlan=}"
export VLANS
;;
esac
done

# Call original function
. /usr/lib/live/boot/9990-cmdline-old
Cmdline_old "$@"
}
59 changes: 59 additions & 0 deletions components/9995-panic.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/bin/sh

#set -e

# Override panic from scripts/functions, _AND_ from 9990-initramfs-tools.sh
panic()
{
for _PARAMETER in ${LIVE_BOOT_CMDLINE}
do
case "${_PARAMETER}" in
panic=*)
panic="${_PARAMETER#*panic=}"
;;
esac
done

DEB_1="\033[1;31m .''\`. \033[0m"
DEB_2="\033[1;31m: :' : \033[0m"
DEB_3="\033[1;31m\`. \`'\` \033[0m"
DEB_4="\033[1;31m \`- \033[0m"

LIVELOG="\033[1;37m/boot.log\033[0m"
DEBUG="\033[1;37mdebug\033[0m"

# Reset redirections to avoid buffering
exec 1>&6 6>&-
exec 2>&7 7>&-
kill ${tailpid}

printf "\n\n"
printf " \033[1;37mBOOT FAILED!\033[0m\n"
printf "\n"
printf " This image failed 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}=1 command-line parameter will greatly increase its verbosity which is\n"
printf " extremely useful when diagnosing issues.\n\n"

if [ -n "${panic}" ]; then
printf " live-boot will now restart your system. "
else
printf " live-boot will now start a shell. "
fi
printf "The error message was:\n\n "

# Call original panic
. /scripts/functions
panic "$@"
}