added letsencrypt
[fai-configs.git] / scripts / FAIBASE / 30-interface
... / ...
CommitLineData
1#! /bin/bash
2
3error=0; trap 'error=$(($?>$error?$?:$error))' ERR # save maximum error code
4
5if ifclass DHCPC && [ $FAI_ACTION = "dirinstall" ]
6then
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
12EOF
13elif [ $FAI_ACTION = "dirinstall" ]
14then
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 gateway $GATEWAYS
23EOF
24 [ -n "$NETWORK" ] && echo "localnet $NETWORK" > $target/etc/networks
25 [ -L $target/etc/resolv.conf ] || cp -p /etc/resolv.conf $target/etc
26fi
27
28# here fcopy is mostly used, when installing a client for running in a
29# different subnet than during the installation
30fcopy -iM /etc/resolv.conf
31fcopy -iM /etc/network/interfaces /etc/networks
32
33exit $error