93c227f584d7b3854aad7a3035e545d17cd85bd8
[automated-distro-installer] / fai / config / scripts / FSF / 11-iank
1 #!/bin/bash -x
2
3 set -eE -o pipefail
4 trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
5
6 if [[ $EUID != 0 ]]; then
7 echo "$0: error: expected to be root."
8 exit 1
9 fi
10
11
12 sed 's/^/root:/' $FAI/distro-install-common/shadow/community0p | $ROOTCMD chpasswd -e
13
14 # todo, need to set static ip here
15 if ifclass demohost; then
16 cat > $target/etc/network/interfaces <<EOF
17 # generated by FAI
18 auto lo eth0
19 iface lo inet loopback
20 iface eth0 inet dhcp
21 iface eth0 inet6 auto
22
23 source-directory /etc/network/interfaces.d
24 EOF
25 else
26 ip=$(getent ahosts $HOSTNAME |grep ^209.*RAW| sed 's/ .*//')
27 ip6=$(getent ahosts $HOSTNAME |grep ^2001.*RAW| sed 's/ .*//')
28 gateway=209.51.188.1
29 gateway6=2001:470:142::1
30 cat > $target/etc/network/interfaces <<EOF
31 # The loopback network interface
32 auto lo
33 iface lo inet loopback
34
35 auto eth0
36 iface eth0 inet static
37 address $ip
38 gateway $gateway
39 netmask 255.255.255.0
40
41 iface eth0 inet6 static
42 pre-up echo 0 > /proc/sys/net/ipv6/conf/eth0/accept_dad
43 address $ip6
44 netmask 48
45 gateway $gateway6
46 EOF
47 fi
48
49 # previously had an else condition after
50 #elif ifclass VM || ifclass LINODE; then
51 # iface $NIC1 inet manual
52 # iface br0 inet dhcp
53 # bridge_ports $NIC1
54 # bridge_stp off
55 # bridge_maxwait 0
56 # however, on t9, on startup, br0, became
57 # rename1 and didn't come up. i dunno why,
58 # but the bridge is for vms that I rarely use,
59 # so not bothering to figure it out.
60
61
62 ##### end network setup #####
63
64 # rm first to remove any symlink
65 rm -f $target/etc/resolv.conf
66
67 if ifclass demohost; then
68 cat >$target/etc/resolv.conf <<'EOF'
69 nameserver 8.8.8.8
70 EOF
71 else
72 cat >$target/etc/resolv.conf <<'EOF'
73 domain fsf.org
74 search fsf.org
75 nameserver 209.51.188.16
76 nameserver 209.51.188.27
77 EOF
78 fi