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