summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorVagrant Cascadian <vagrant+debianbugs@freegeek.org>2007-09-04 10:41:07 +0200
committermaximilian attems <max@stro.at>2007-09-04 10:41:07 +0200
commit5ac8a35ffa7db1c1295f46c75e6b8cc7cd698546 (patch)
treebf371a2821ca398c9a35bee8b9d74b852711a7aa /scripts
parente2094587495879e34285018ff6f2b9f46c34ca45 (diff)
downloadinitramfs-tools-5ac8a35ffa7db1c1295f46c75e6b8cc7cd698546.tar.gz
initramfs-tools-5ac8a35ffa7db1c1295f46c75e6b8cc7cd698546.zip
initramfs-tools: split networking code into separate function
ltsp in ubuntu started using NBD+unionfs+squashfs instead of NFS, and debian-live uses has a network boot methods using cifs in addition to a different way of using NFS (i think it also uses unionfs and maybe squashfs, not just a plain NFS/cifs mount)... so splitting out the networking related code into a separate function would move towards not having forked code for all of these different network boot methods. at least, that's my hope.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/functions35
-rw-r--r--scripts/nfs33
2 files changed, 37 insertions, 31 deletions
diff --git a/scripts/functions b/scripts/functions
index db223cd..fdd808f 100644
--- a/scripts/functions
+++ b/scripts/functions
@@ -270,3 +270,38 @@ parse_numeric() {
chmod 600 /dev/root
ROOT=/dev/root
}
+
+configure_networking()
+{
+ # 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
+}
diff --git a/scripts/nfs b/scripts/nfs
index 717dfe8..b9c2522 100644
--- a/scripts/nfs
+++ b/scripts/nfs
@@ -4,40 +4,11 @@
retry_nr=0
-# parse nfs bootargs + launch ipconfig and nfsmount
+# parse nfs bootargs and mount nfs
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
+ configure_networking
# get nfs root from dhcp
if [ "x${NFSROOT}" = "xauto" ]; then