File: 30-interface

package info (click to toggle)
fai 2.8.4sarge1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 1,284 kB
  • ctags: 176
  • sloc: sh: 3,362; perl: 1,591; makefile: 142
file content (33 lines) | stat: -rwxr-xr-x 772 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#! /bin/sh

error=0 ; trap "error=$((error|1))" ERR

if ifclass DHCPC
then
    cat > $target/etc/network/interfaces <<-EOF
	# generated by FAI
	auto lo eth0
	iface lo inet loopback
	iface eth0 inet dhcp
EOF
else
    cat > $target/etc/network/interfaces <<-EOF
	# generated by FAI
	auto lo eth0
	iface lo inet loopback
	iface eth0 inet static
	  address $IPADDR
	  netmask $NETMASK
	  broadcast $BROADCAST
	  gateway $GATEWAYS
EOF
    echo "localnet $NETWORK" > $target/etc/networks
    [ -s /tmp/etc/resolv.conf ] && cp -p /tmp/etc/resolv.conf $target/etc
    fcopy -i /etc/resolv.conf
fi

# here fcopy is mostly used, when installing a client for running in a
# different subnet than during the installation  
fcopy -iM /etc/network/interfaces /etc/networks

exit $error