9883731fd90efbaa728267d099d3755e6ebc554e
[automated-distro-installer] / fai / config / scripts / DEBIAN / 30-interface
1 #! /bin/bash
2
3 error=0; trap 'error=$(($?>$error?$?:$error))' ERR # save maximum error code
4
5 if ifclass DHCPC && [ $FAI_ACTION = "install" -o $FAI_ACTION = "dirinstall" ]
6 then
7 cat > $target/etc/network/interfaces <<-EOF
8 # generated by FAI
9 auto lo $NIC1
10 iface lo inet loopback
11 iface $NIC1 inet dhcp
12 EOF
13 elif [ $FAI_ACTION = "install" -o $FAI_ACTION = "dirinstall" ]
14 then
15 [ -n "$IPADDR" ] && cat > $target/etc/network/interfaces <<-EOF
16 # generated by FAI
17 auto lo $NIC1
18 iface lo inet loopback
19 iface $NIC1 inet static
20 address $IPADDR
21 netmask $NETMASK
22 broadcast $BROADCAST
23 gateway $GATEWAYS
24 EOF
25 [ -n "$NETWORK" ] && echo "localnet $NETWORK" > $target/etc/networks
26 if [ ! -L $target/etc/resolv.conf -a -e /etc/resolv.conf ]; then
27 cp -p /etc/resolv.conf $target/etc
28 fi
29 fi
30
31 # here fcopy is mostly used, when installing a client for running in a
32 # different subnet than during the installation
33 fcopy -iM /etc/resolv.conf
34 fcopy -iM /etc/network/interfaces /etc/networks
35
36 exit $error