summaryrefslogtreecommitdiff
path: root/scripts/nfs
diff options
context:
space:
mode:
authormaximilian attems <maks@debian.org>2006-09-04 18:54:59 +0200
committermaximilian attems <maks@debian.org>2006-09-04 18:54:59 +0200
commitcf4bba337d69510c4551ba84e8c69562873ea93f (patch)
treea57a27fa39693b3a39d57aa3a1bf4cb6e6b30d52 /scripts/nfs
parent8ae9783215c2845b50dfb70b919df0753c2b0dd9 (diff)
downloadinitramfs-tools-cf4bba337d69510c4551ba84e8c69562873ea93f.tar.gz
initramfs-tools-cf4bba337d69510c4551ba84e8c69562873ea93f.zip
- better nfs handling: merge vagrant branch :) + local changes
- cleanup stupid whitespace all over the place
Diffstat (limited to 'scripts/nfs')
-rw-r--r--scripts/nfs35
1 files changed, 18 insertions, 17 deletions
diff --git a/scripts/nfs b/scripts/nfs
index f42ed22..c66e2a1 100644
--- a/scripts/nfs
+++ b/scripts/nfs
@@ -2,6 +2,8 @@
# FIXME This needs error checking
+retry_nr=0
+
# parse nfs bootargs + launch ipconfig and nfsmount
do_nfsmount()
{
@@ -20,19 +22,21 @@ do_nfsmount()
*)
ipconfig -d $IPOPTS
- # grab device entry from full line
+ # grab device entry from ip option
NEW_DEVICE=${IPOPTS#*:*:*:*:*:*}
- NEW_DEVICE=${NEW_DEVICE%:*}
+ 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
- # grab server-ip
- SERVER_IP=${IPOPTS#*:}
- SERVER_IP=${SERVER_IP%:*:*:*:*:*:*}
;;
esac
-
- # FIXME: source ipconfig output - might overwrite aboves
+
+ # source relevant ipconfig output
. /tmp/net-${DEVICE}.conf
# get nfs root from dhcp
@@ -45,13 +49,8 @@ do_nfsmount()
NFSOPTS="-o ${NFSROOT#*,}"
fi
NFSROOT=${NFSROOT%%,*}
- # server-ip could be passed by ip
if [ "${NFSROOT#*:}" = "$NFSROOT" ]; then
- if [ -n "${SERVER_IP}" ]; then
- NFSROOT="${SERVER_IP}:${NFSROOT}"
- else
- NFSROOT=${ROOTSERVER}:${ROOTPATH}
- fi
+ NFSROOT=${ROOTSERVER}:${NFSROOT}
fi
fi
@@ -92,13 +91,15 @@ mountroot()
fi
# loop until nfsmount succeds
- # FIXME: another place of init bin hardcoding
- while [ ${delay} -gt 0 ] && [ ! -e ${rootmnt}/sbin/init ]; do
+ while [ ${delay} -gt 0 ] && [ ! -e ${rootmnt}${init} ]; do
+ [ ${retry_nr} -gt 0 ] && \
[ "$quiet" != "y" ] && log_begin_msg "Retrying nfs mount"
- do_nfsmount
+ do_nfsmount
# FIXME: ipconfig loops every min at least - better param??
delay=$(( ${delay} - 1 ))
- [ "$quiet" != "y" ] && log_end_msg
+ [ ${retry_nr} -gt 0 ] && [ "$quiet" != "y" ] && log_end_msg
+ [ ! -e ${rootmnt}/sbin/init ] && /bin/sleep 0.1
+ retry_nr=$(( ${retry_nr} + 1 ))
done
[ "$quiet" != "y" ] && log_begin_msg "Running /scripts/nfs-bottom"