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