2 # This file is part of Ian Kelling's automated-distro-installer
3 # Copyright (C) 2024 Ian Kelling
5 # This program is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU General Public License
7 # as published by the Free Software Foundation; either version 2
8 # of the License, or (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
22 if [[ $EUID != 0 ]]; then
23 echo "$0: error: expected to be root."
28 sed 's/^/root:/' $FAI/distro-install-common
/shadow
/community0p |
$ROOTCMD chpasswd
-e
30 # todo, need to set static ip here
31 if ifclass demohost
; then
32 cat > $target/etc
/network
/interfaces
<<EOF
35 iface lo inet loopback
39 source-directory /etc/network/interfaces.d
42 ip6
=$
(getent ahosts
$HOSTNAME |
grep ^
2001.
*RAW|
sed 's/ .*//' ||
:)
43 gateway6
=2001:470:142::1
45 # todo: this needs adjustment per machine
46 internal_ip
=10.0.0.25/16
48 if ip l show dev bond0
&>/dev
/null
; then
49 cat >$target/etc
/network
/interfaces
<<EOF
51 iface lo inet loopback
55 iface eth0 inet manual
60 iface eth1 inet manual
64 iface bond0 inet static
69 pre-up ip link add link bond0 name macvtap-bond0 type macvtap mode bridge
70 # no iptables files exist yet
71 # post-up iptables-restore < /etc/default/iptables ; ip6tables-restore < /etc/default/ip6tables || :
74 iface macvtap-bond0 inet static
77 post-up ip a add $internal_ip broadcast 10.0.255.255 dev macvtap-bond0
81 # I'm not sure ipv6 works well with the macvtap stuff. todo: research.
82 # anyways, other kvm hosts dont have it enabled.
83 if false
&& [[ $ip6 ]]; then
84 cat >>$target/etc
/network
/interfaces
<<EOF
85 iface bond0 inet6 static
86 pre-up echo 0 > /proc/sys/net/ipv6/conf/bond0/accept_dad
94 cat > $target/etc
/network
/interfaces
<<EOF
96 iface lo inet loopback
99 iface eth0 inet static
105 cat >>$target/etc
/network
/interfaces
<<EOF
106 iface eth0 inet6 static
107 pre-up echo 0 > /proc/sys/net/ipv6/conf/eth0/accept_dad
116 # previously had an else condition after
117 #elif ifclass VM || ifclass LINODE; then
118 # iface $NIC1 inet manual
119 # iface br0 inet dhcp
123 # however, on t9, on startup, br0, became
124 # rename1 and didn't come up. i dunno why,
125 # but the bridge is for vms that I rarely use,
126 # so not bothering to figure it out.
129 ##### end network setup #####
131 # note: systemd-resolved + ifupdown causes networking.service to fail in t11,
132 # https://bugs.launchpad.net/ubuntu/+source/ifupdown/+bug/1907878
133 systemctl disable systemd-resolved
134 # rm first to remove any symlink
135 rm -f $target/etc
/resolv.conf
137 if ifclass demohost ||
[[ $GATEWAYS != 209.51.188.
* ]]; then
138 cat >$target/etc
/resolv.conf
<<'EOF'
142 cat >$target/etc
/resolv.conf
<<'EOF'
145 nameserver 209.51.188.16
146 nameserver 209.51.188.27