mirror of
https://salsa.debian.org/kernel-team/initramfs-tools.git
synced 2026-01-26 15:39:08 +00:00
* kick mdrun script * update control for lenny + ubuntu * add _all_ ide, block and drivers * use MODPROBE_OPTIONS and kill any modprobed arg * small doc + whitespace fixes
107 lines
2.4 KiB
Bash
107 lines
2.4 KiB
Bash
# NFS filesystem mounting -*- shell-script -*-
|
|
|
|
# FIXME This needs error checking
|
|
|
|
retry_nr=0
|
|
|
|
# parse nfs bootargs + launch ipconfig and nfsmount
|
|
do_nfsmount()
|
|
{
|
|
# support ip options see linux sources Documentation/nfsroot.txt
|
|
case ${IPOPTS} in
|
|
none|off)
|
|
# Do nothing
|
|
;;
|
|
""|on|any)
|
|
# Bring up device
|
|
ipconfig ${DEVICE}
|
|
;;
|
|
dhcp|bootp|rarp|both)
|
|
ipconfig -c ${IPOPTS} -d ${DEVICE}
|
|
;;
|
|
*)
|
|
ipconfig -d $IPOPTS
|
|
|
|
# grab device entry from ip option
|
|
NEW_DEVICE=${IPOPTS#*:*:*:*:*:*}
|
|
if [ "${NEW_DEVICE}" != "${IPOPTS}" ]; then
|
|
NEW_DEVICE=${NEW_DEVICE%:*}
|
|
else
|
|
# wrong parse, possibly only a partial string
|
|
NEW_DEVICE=
|
|
fi
|
|
if [ -n "${NEW_DEVICE}" ]; then
|
|
DEVICE="${NEW_DEVICE}"
|
|
fi
|
|
;;
|
|
esac
|
|
|
|
# source relevant ipconfig output
|
|
. /tmp/net-${DEVICE}.conf
|
|
|
|
# get nfs root from dhcp
|
|
if [ "x${NFSROOT}" = "xauto" ]; then
|
|
NFSROOT=${ROOTSERVER}:${ROOTPATH}
|
|
# nfsroot=[<server-ip>:]<root-dir>[,<nfs-options>]
|
|
elif [ -n "${NFSROOT}" ]; then
|
|
# nfs options are an optional arg
|
|
if [ "${NFSROOT#*,}" != "${NFSROOT}" ]; then
|
|
NFSOPTS="-o ${NFSROOT#*,}"
|
|
fi
|
|
NFSROOT=${NFSROOT%%,*}
|
|
if [ "${NFSROOT#*:}" = "$NFSROOT" ]; then
|
|
NFSROOT=${ROOTSERVER}:${NFSROOT}
|
|
fi
|
|
fi
|
|
|
|
if [ -z "${NFSOPTS}" ]; then
|
|
NFSOPTS="-o retrans=10"
|
|
fi
|
|
|
|
[ "$quiet" != "y" ] && log_begin_msg "Running /scripts/nfs-premount"
|
|
run_scripts /scripts/nfs-premount
|
|
[ "$quiet" != "y" ] && log_end_msg
|
|
|
|
if [ ${readonly} = y ]; then
|
|
roflag="-o ro"
|
|
else
|
|
roflag="-o rw"
|
|
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 nfs
|
|
# For DHCP
|
|
modprobe af_packet
|
|
|
|
# Default delay is around 180s
|
|
# FIXME: add usplash_write info
|
|
if [ -z "${ROOTDELAY}" ]; then
|
|
delay=180
|
|
else
|
|
delay=${ROOTDELAY}
|
|
fi
|
|
|
|
# loop until nfsmount succeds
|
|
while [ ${retry_nr} -lt ${delay} ] && [ ! -e ${rootmnt}${init} ]; do
|
|
[ ${retry_nr} -gt 0 ] && \
|
|
[ "$quiet" != "y" ] && log_begin_msg "Retrying nfs mount"
|
|
do_nfsmount
|
|
retry_nr=$(( ${retry_nr} + 1 ))
|
|
[ ! -e ${rootmnt}${init} ] && /bin/sleep 1
|
|
[ ${retry_nr} -gt 0 ] && [ "$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
|
|
}
|