3 # modified from upstream fai example
4 error
=0; trap 'error=$(($?>$error?$?:$error))' ERR
# save maximum error code
6 if ! ifclass STABLE
; then
8 # For a vm, we only get ID_NET_NAME_MAC from below,
9 # but when it reboots, it uses ID_NET_NAME_SLOT.
12 # get persistent interface name. Note, these class conditions
13 # will need to get modified for new oses. testing vm doesn't use
14 # it right now, but other vms do I'm sure.
15 for field
in ID_NET_NAME_FROM_DATABASE \
20 name
=$
(udevadm info
/sys
/class
/net
/$NIC1 |
sed -rn "s/^E: $field=(.+)/\1/p")
26 if [[ ! $name ]]; then
27 echo "$0: error: could not find systemd predictable network name"
33 if ifclass DHCPC
&& [ $FAI_ACTION = "install" -o $FAI_ACTION = "dirinstall" ]
36 cat > $target/etc
/network
/interfaces
<<-EOF
39 iface lo inet loopback
43 cat > $target/etc
/network
/interfaces
<<-EOF
46 iface lo inet loopback
47 iface $NIC1 inet manual
48 # make a bridge by default so we can have bridged vms.
49 # Some example I read had stp on, but i don't need stp,
50 # and it causes a vm to fail pxe boot, presumably unless
52 # http://wiki.libvirt.org/page/PXE_boot_%28or_dhcp%29_on_guest_failed
59 elif [ $FAI_ACTION = "install" -o $FAI_ACTION = "dirinstall" ]
61 [ -n "$IPADDR" ] && cat > $target/etc
/network
/interfaces
<<-EOF
64 iface lo inet loopback
65 iface $NIC1 inet static
71 [ -n "$NETWORK" ] && echo "localnet $NETWORK" > $target/etc
/networks
72 if [ ! -L $target/etc
/resolv.conf
-a -e /etc
/resolv.conf
]; then
73 cp -p /etc
/resolv.conf
$target/etc
77 # here fcopy is mostly used, when installing a client for running in a
78 # different subnet than during the installation
79 fcopy
-iM /etc
/resolv.conf
80 fcopy
-iM /etc
/network
/interfaces
/etc
/networks