diff options
-rw-r--r-- | hooks/net | 64 | ||||
-rw-r--r-- | install/base | 2 |
2 files changed, 18 insertions, 48 deletions
@@ -1,9 +1,13 @@ # vim: set ft=sh: run_hook () { - local line i address netmask gateway dns0 dns1 rootserver rootpath defaultrootpath defaultserver - - : > /ip_opts + local line defaultrootpath defaultserver + # These variables will be parsed from /tmp/net-*.conf generated by ipconfig + local DEVICE + local IPV4ADDR IPV4BROADCAST IPV4NETMASK IPV4GATEWAY IPV4DNS0 IPV4DNS1 + local HOSTNAME DNSDOMAIN NISDOMAIN ROOTSERVER ROOTPATH + local filename + # /tmp/net-*.conf if [ -z "${ip}" -a -n "${nfsaddrs}" ]; then ip="${nfsaddrs}" @@ -11,63 +15,29 @@ run_hook () if [ -n "${ip}" ]; then # setup network and save some values - ipconfig "ip=${ip}" | while read line; do - # echo ":: ${line}" - if [ "${line#"IP-Config:"}" != "${line}" ]; then - continue - fi - line="$(echo ${line} | sed -e 's/ :/:/g;s/: /=/g')" - for i in ${line}; do - case "${i}" in - address=*) - echo "${i}" >> /ip_opts - ;; - netmask=*) - echo "${i}" >> /ip_opts - ;; - gateway=*) - echo "${i}" >> /ip_opts - ;; - dns0=*) - echo "${i}" >> /ip_opts - ;; - dns1=*) - echo "${i}" >> /ip_opts - ;; - rootserver=*) - echo "${i}" >> /ip_opts - ;; - rootpath=*) - echo "${i}" >> /ip_opts - ;; - esac - done - done - - . /ip_opts + ipconfig "ip=${ip}" - echo "IP-Config: ${address}/${netmask}" - echo "IP-Config: gw: ${gateway} dns0: ${dns0} dns1: ${dns1}" + . /tmp/net-*.conf # calculate nfs_server, nfs_path and nfs_option for later nfs mount if [ "${root}" = "/dev/nfs" -o "${nfsroot}" != "" ]; then - # parse rootpath if defined by dhcp server - if [ -n "${rootpath}" ]; then - line="${rootpath}" + # parse ROOTPATH if defined by dhcp server + if [ -n "${ROOTPATH}" ]; then + line="${ROOTPATH}" nfs_server="${line%%:*}" - [ "${nfs_server}" = "${line}" ] && nfs_server="${rootserver}" + [ "${nfs_server}" = "${line}" ] && nfs_server="${ROOTSERVER}" defaultserver="${nfs_server}" line="${line#*:}" nfs_path="${line}" defaultrootpath="${nfs_path}" else - # define a default rootpath - if [ "${rootpath}" = "" ]; then - defaultrootpath="/tftpboot/${address}" + # define a default ROOTPATH + if [ "${ROOTPATH}" = "" ]; then + defaultrootpath="/tftpboot/${IPV4ADDR}" fi fi - # parse nfsroot if present (overrides rootpath) + # parse nfsroot if present (overrides ROOTPATH) if [ -n "${nfsroot}" ]; then line="${nfsroot}" nfs_server="${line%%:*}" diff --git a/install/base b/install/base index 0726fa2..db9752e 100644 --- a/install/base +++ b/install/base @@ -1,7 +1,7 @@ #!/bin/bash build() { - for dir in new_root proc sys dev run usr/{bin,sbin}; do + for dir in new_root proc sys dev run tmp usr/{bin,sbin}; do add_dir "/$dir" done |