summaryrefslogtreecommitdiff
path: root/archiso/hooks/archiso_pxe_common
diff options
context:
space:
mode:
authorNicolás Reynolds <apoyosis@correo.inta.gob.ar>2012-09-13 22:35:30 -0300
committerNicolás Reynolds <apoyosis@correo.inta.gob.ar>2012-09-13 22:35:30 -0300
commit4b38c919cbb133c35a06b330e8de9f305c5b4792 (patch)
tree0f995b2f9a80bbe1975bd33e89cb67609c46d144 /archiso/hooks/archiso_pxe_common
parentaaddf796dcaa9c62859c386d81abc4bfb9e02eec (diff)
parent83cebf9e43fb3734c003ae358c4d308728dca7e4 (diff)
Merge branch 'master' of gparabola:archiso
Conflicts: README archiso/Makefile archiso/hooks/archiso archiso/hooks/archiso_loop_mnt archiso/hooks/archiso_pxe_nbd archiso/install/archiso archiso/install/archiso_loop_mnt archiso/install/archiso_pxe_nbd archiso/mkarchiso archiso/testiso configs/baseline/build.sh configs/releng/build.sh configs/releng/packages.i686 configs/releng/packages.x86_64 configs/releng/root-image/etc/hosts configs/releng/root-image/etc/issue configs/releng/root-image/etc/rc.conf configs/releng/syslinux.dual/archiso_pxe32.cfg configs/releng/syslinux.dual/archiso_pxe64.cfg configs/releng/syslinux/archiso_head.cfg configs/releng/syslinux/archiso_pxe.cfg configs/releng/syslinux/archiso_sys.cfg
Diffstat (limited to 'archiso/hooks/archiso_pxe_common')
-rw-r--r--archiso/hooks/archiso_pxe_common42
1 files changed, 42 insertions, 0 deletions
diff --git a/archiso/hooks/archiso_pxe_common b/archiso/hooks/archiso_pxe_common
new file mode 100644
index 0000000..febb503
--- /dev/null
+++ b/archiso/hooks/archiso_pxe_common
@@ -0,0 +1,42 @@
+# vim: set ft=sh:
+
+run_hook () {
+ local i net_mac bootif_mac bootif_dev
+ # 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 [[ -n "${ip}" ]]; then
+ if [[ -n "${BOOTIF}" ]]; then
+ bootif_mac=${BOOTIF#01-}
+ bootif_mac=${bootif_mac//-/:}
+ for i in /sys/class/net/*/address; do
+ read net_mac < ${i}
+ if [[ "${bootif_mac}" == "${net_mac}" ]]; then
+ bootif_dev=${i#/sys/class/net/}
+ bootif_dev=${bootif_dev%/address}
+ break
+ fi
+ done
+ ip="${ip}::${bootif_dev}"
+ fi
+
+ # setup network and save some values
+ ipconfig "ip=${ip}"
+
+ . /tmp/net-*.conf
+
+ pxeserver=${ROOTSERVER}
+
+ # setup DNS resolver
+ if [[ "${IPV4DNS0}" != "0.0.0.0" ]]; then
+ echo "nameserver ${IPV4DNS0}" > /etc/resolv.conf
+ fi
+ if [[ "${IPV4DNS1}" != "0.0.0.0" ]]; then
+ echo "nameserver ${IPV4DNS1}" >> /etc/resolv.conf
+ fi
+ fi
+}