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