add network-manager class
[fai-configs.git] / scripts / FAIBASE / 30-interface
1 #! /bin/bash
2
3 error=0 ; trap "error=$((error|1))" ERR
4
5 if ifclass DHCPC && [ $FAI_ACTION != "softupdate" ]
6 then
7 cat > $target/etc/network/interfaces <<-EOF
8 # generated by FAI
9 auto lo eth0
10 iface lo inet loopback
11 iface eth0 inet dhcp
12 EOF
13 elif ifclass NW_MGR && [ $FAI_ACTION != "softupdate" ]
14 then
15 cat > $target/etc/network/interfaces <<-EOF
16 # generated by FAI
17 auto lo
18 iface lo inet loopback
19 EOF
20 elif [ $FAI_ACTION != "softupdate" ]
21 then
22 [ -n "$IPADDR" ] && cat > $target/etc/network/interfaces <<-EOF
23 # generated by FAI
24 auto lo eth0
25 iface lo inet loopback
26 iface eth0 inet static
27 address $IPADDR
28 netmask $NETMASK
29 broadcast $BROADCAST
30 gateway $GATEWAYS
31 EOF
32 [ -n "$NETWORK" ] && echo "localnet $NETWORK" > $target/etc/networks
33 [ -s /etc/resolv.conf ] && cp -p /etc/resolv.conf $target/etc
34 fi
35
36 # here fcopy is mostly used, when installing a client for running in a
37 # different subnet than during the installation
38 fcopy -i /etc/resolv.conf
39 fcopy -iM /etc/network/interfaces /etc/networks
40
41 exit $error