- fix bashism

- rename mdadm.conf in mdrun.conf
- retry nfsmount
- harden init
- fix lvm boot script prereqs
This commit is contained in:
maximilian attems 2006-08-25 17:04:33 +02:00
parent fabe918dee
commit 45989c9f37
10 changed files with 69 additions and 25 deletions

20
debian/changelog vendored
View File

@ -1,3 +1,23 @@
initramfs-tools (0.77) unstable; urgency=medium
* mkinitramfs, scripts/local-top/mdrun: Use mdrun.conf as config file.
Ship mdrun unconditionally if around, should help in recovery situations.
* debian/initramfs-tools.postinst, hook-functions, mkinitramfs,
scripts/local, update-initramfs: Cleanup the "-a" and "-o" bashism.
* scripts/nfs: Retry to mount NFS on eventual failure. (closes: 377643)
Based on a patch by Vagrant Cascadian <vagrant+bugs@freegeek.org>.
* init: Make sure there is an /dev and /root. Usually passed by the kernel.
Also /dev/null or /dev/console might already be shipped.
Based on a patch by David Härdeman <david@2gen.com>. (closes: 340494)
* scripts/local-top/lvm: Fix prereqs s/mdraid/mdrun, thus urgency medium.
Thanks Rainer Gauweiler <debian@moppl.inka.de> for the notice.
-- maximilian attems <maks@sternwelten.at> Fri, 25 Aug 2006 16:55:56 +0200
initramfs-tools (0.76) unstable; urgency=medium
* debian/control: Tighten klibc to 1.4.19-2 for fixed nuke. (closes: 383730)

View File

@ -7,7 +7,7 @@ if [ ! -e /etc/initramfs-tools/modules ]; then
fi
# Regenerate initramfs on upgrade
if [ "$1" = "configure" -a -n "$2" ]; then
if [ "$1" = "configure" ] && [ -n "$2" ]; then
update-initramfs -u
fi

View File

@ -48,7 +48,7 @@ manual_add_modules()
mkdir -p "${DESTDIR}/$(dirname "${mam_x}")"
ln -s "${mam_x}" "${DESTDIR}/$(dirname "${mam_x}")"
if [ -n "${verbose}" -a "${verbose}" = "y" ]; then
if [ -n "${verbose}" ] && [ "${verbose}" = "y" ]; then
echo "Adding module ${mam_x}"
fi
done

6
init
View File

@ -2,6 +2,10 @@
echo "Loading, please wait..."
[ -d /dev ] || mkdir -m 0755 /dev
[ -d /root ] || mkdir --mode=0700 /root
[ -e /dev/console ] || mknod /dev/console c 5 1
[ -e /dev/null ] || mknod /dev/null c 1 3
mkdir /sys
mkdir /proc
mkdir /tmp
@ -18,8 +22,6 @@ fi
mount -t tmpfs -o size=$tmpfs_size,mode=0755 udev /dev
> /dev/.initramfs-tools
mkdir /dev/.initramfs
mknod /dev/console c 5 1
mknod /dev/null c 1 3
# Export the dpkg architecture
export DPKG_ARCH=

View File

@ -236,10 +236,10 @@ run_scripts /usr/share/initramfs-tools/hooks
run_scripts "${CONFDIR}"/hooks
# FIXME: Remove this Raid block after Etch releases
if [ -x /sbin/mdadm -a ! -f /usr/share/initramfs-tools/hooks/mdadm ]; then
if [ -x /sbin/mdadm ] && [ ! -f /usr/share/initramfs-tools/hooks/mdadm ]; then
# use mkinitrd magic for Sarge backwards compat
rootraiddev="$(df / | sed -rne 's,^(/dev/[^[:space:]]+).*,\1,p')"
echo "rootraiddev=${rootraiddev}" > /conf/mdadm.conf
echo "rootraiddev=${rootraiddev}" > /conf/mdrun.conf
mdadm=$(mdadm --detail "${rootraiddev}")
echo "${mdadm}" | awk '
$1 == "Number" && $2 == "Major" { start = 1; next }
@ -248,16 +248,17 @@ if [ -x /sbin/mdadm -a ! -f /usr/share/initramfs-tools/hooks/mdadm ]; then
$2 == 0 && $3 == 0 { next }
{ devices = devices " " $NF }
END { print "devices='\''" devices "'\''" }' \
>> /conf/mdadm.conf
>> /conf/mdrun.conf
copy_exec /sbin/mdadm /sbin
copy_exec /sbin/mdrun /sbin
for x in md linear multipath raid0 raid1 raid456 raid5 raid6 raid10; do
manual_add_modules ${x}
done
fi
[ -x /sbin/mdrun ] && copy_exec /sbin/mdrun /sbin
# FIXME: Remove this LVM block after Etch releases
if [ -x /sbin/vgchange -a -d /lib/lvm-200 -a ! -f /usr/share/initramfs-tools/hooks/lvm2 ]; then
if [ -x /sbin/vgchange ] && [ -d /lib/lvm-200 ] \
&& [ ! -f /usr/share/initramfs-tools/hooks/lvm2 ]; then
copy_exec /lib/lvm-200/vgchange /sbin
for x in dm_mod dm_snapshot dm_mirror; do
manual_add_modules ${x}

View File

@ -23,7 +23,7 @@ mountroot ()
fi
slumber=$(( ${slumber} * 10 ))
while [ ${slumber} -gt 0 -a ! -e "${ROOT}" ]; do
while [ ${slumber} -gt 0 ] && [ ! -e "${ROOT}" ]; do
/bin/sleep 0.1
slumber=$(( ${slumber} - 1 ))
done

View File

@ -1,6 +1,6 @@
#!/bin/sh
PREREQ="mdadm mdraid lvm2"
PREREQ="mdadm mdrun lvm2"
prereqs()
{

View File

@ -37,7 +37,7 @@ done
[ "${gotraid}" = y ] || exit
# source the presumed root md and it's info
. ./conf/mdadm.conf
. ./conf/mdrun.conf
# assemble root raid first due to initrd-tools compatibility
mdadm -A ${rootraiddev} -R -u $uuid $devices

View File

@ -2,17 +2,9 @@
# FIXME This needs error checking
# Paramter: Where the root should be mounted
mountroot ()
# parse nfs bootargs + launch ipconfig and nfsmount
do_nfsmount()
{
[ "$quiet" != "y" ] && log_begin_msg "Running /scripts/nfs-top"
run_scripts /scripts/nfs-top
[ "$quiet" != "y" ] && log_end_msg
modprobe -q nfs
# For DHCP
modprobe -q af_packet
# support ip options see linux sources Documentation/nfsroot.txt
case ${IPOPTS} in
none|off)
@ -40,7 +32,7 @@ mountroot ()
;;
esac
# FIXME: who writes that?
# FIXME: source ipconfig output - might overwrite aboves
. /tmp/net-${DEVICE}.conf
# get nfs root from dhcp
@ -78,9 +70,38 @@ mountroot ()
fi
nfsmount -o nolock ${roflag} ${NFSOPTS} ${NFSROOT} ${rootmnt}
}
# NFS root mounting
mountroot()
{
[ "$quiet" != "y" ] && log_begin_msg "Running /scripts/nfs-top"
run_scripts /scripts/nfs-top
[ "$quiet" != "y" ] && log_end_msg
modprobe -q nfs
# For DHCP
modprobe -q af_packet
# Default delay is around 180s
# FIXME: add usplash info
if [ -z "${ROOTDELAY}" ]; then
delay=180
else
delay=${ROOTDELAY}
fi
# loop until nfsmount succeds
# FIXME: another place of init bin hardcoding
while [ ${delay} -gt 0 ] && [ ! -e ${rootmnt}/sbin/init ]; do
[ "$quiet" != "y" ] && log_begin_msg "Retrying nfs mount"
do_nfsmount
# FIXME: ipconfig loops every min at least - better param??
delay=$(( ${delay} - 1 ))
[ "$quiet" != "y" ] && log_end_msg
done
[ "$quiet" != "y" ] && log_begin_msg "Running /scripts/nfs-bottom"
run_scripts /scripts/nfs-bottom
[ "$quiet" != "y" ] && log_end_msg
}

View File

@ -95,7 +95,7 @@ run_lilo()
# or if "do_bootloader = yes" is set
run_bootloader()
{
if [ -x /sbin/grub -o -e /boot/grub/menu.lst ]; then
if [ -x /sbin/grub ] || [ -e /boot/grub/menu.lst ]; then
if [ -e /etc/lilo.conf ]; then
[ -r "${KPKGCONF}" ] && \
do_b=$(awk '/bootloader/{print $3}' "${KPKGCONF}")