3 local line i net_mac bootif_mac bootif_dev defaultrootpath defaultserver
4 # These variables will be parsed from /tmp/net-*.conf generated by ipconfig
6 local IPV4ADDR IPV4BROADCAST IPV4NETMASK IPV4GATEWAY IPV4DNS0 IPV4DNS1
7 local HOSTNAME DNSDOMAIN NISDOMAIN ROOTSERVER ROOTPATH
11 if [ -z "${ip}" -a -n "${nfsaddrs}" ]; then
15 if [ -n "${ip}" ]; then
16 if [ -n "${BOOTIF}" ]; then
17 bootif_mac=${BOOTIF#01-}
18 bootif_mac=${bootif_mac//-/:}
19 for i in /sys/class/net/*/address; do
21 if [ "${bootif_mac}" == "${net_mac}" ]; then
22 bootif_dev=${i#/sys/class/net/}
23 bootif_dev=${bootif_dev%/address}
27 ip="${ip}::${bootif_dev}"
30 # setup network and save some values
33 for conf in /tmp/net-*.conf; do
34 [ -f "$conf" ] && . "$conf"
37 # calculate nfs_server, nfs_path and nfs_option for later nfs mount
38 if [ "${root}" = "/dev/nfs" -o "${nfsroot}" != "" ]; then
39 # parse ROOTPATH if defined by dhcp server
40 if [ -n "${ROOTPATH}" ]; then
42 nfs_server="${line%%:*}"
43 [ "${nfs_server}" = "${line}" ] && nfs_server="${ROOTSERVER}"
44 defaultserver="${nfs_server}"
47 defaultrootpath="${nfs_path}"
49 # define a default ROOTPATH
50 if [ "${ROOTPATH}" = "" ]; then
51 defaultrootpath="/tftpboot/${IPV4ADDR}"
55 # parse nfsroot if present (overrides ROOTPATH)
56 if [ -n "${nfsroot}" ]; then
58 nfs_server="${line%%:*}"
59 [ -z "${nfs_server}" ] && nfs_server="${defaultserver}"
61 nfs_path="${line%%,*}"
62 line="${line#"${nfs_path}"}"
63 [ -z "${nfs_path}" ] && nfs_path="${defaultrootpath}"
64 nfs_option="${line#","}"
67 # ensure root and filesystem type are set proper for nfs boot
71 echo "NFS-Mount: ${nfs_server}:${nfs_path}"
73 # set mount handler for NFS
74 mount_handler="nfs_mount_handler"
80 if [ -z "$nfs_server" -o -z "$nfs_path" ]; then
81 err "Unable to mount root filesystem over NFS: wrong parameters."
82 echo "You are being dropped to a recovery shell"
83 echo " Type 'exit' to try and continue booting"
84 launch_interactive_shell
85 msg "Trying to continue (this will most likely fail) ..."
87 nfsmount ${nfs_option:+-o ${nfs_option}} "${nfs_server}:${nfs_path}" "$1"
90 # vim: set ft=sh ts=4 sw=4 et: