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
134 # This does an exit 1 with no output. very not nice of systemd to give
135 # us no information on error. However, when i ran the command on a
136 # normal t11 system, it output that it removed 2 files, so hopefully
137 # doing that will be equivalent.
139 #$ROOTCMD systemctl disable systemd-resolved
141 rm -f $target/etc
/systemd
/system
/multi-user.target.wants
/systemd-resolved.service
142 rm -f $target/etc
/systemd
/system
/dbus-org.freedesktop.resolve1.service.
144 # remove any symlink created by systemd-resolved
145 rm -f $target/etc
/resolv.conf
147 if ifclass demohost ||
[[ $GATEWAYS != 209.51.188.
* ]]; then
148 cat >$target/etc
/resolv.conf
<<'EOF'
152 cat >$target/etc
/resolv.conf
<<'EOF'
155 nameserver 209.51.188.16
156 nameserver 209.51.188.27
160 if ifclass ECNE
; then
161 cat >$target/etc
/os-release
<<'EOF'
162 NAME="Trisquel GNU/Linux"
166 PRETTY_NAME="Trisquel GNU/Linux Ecne (12.0)"
168 VERSION_CODENAME="ecne"
169 UBUNTU_CODENAME="noble"
170 HOME_URL="https://trisquel.info/"
171 SUPPORT_URL="https://trisquel.info/wiki"
172 BUG_REPORT_URL="https://gitlab.trisquel.org/trisquel"
173 PRIVACY_POLICY_URL="https://trisquel.info/legal"
176 cat >$target/etc
/apt
/apt.conf.d
/01-vendor-trisquel <<'EOF'
177 Update-Manager::Always-Include-Phased-Updates "True";
179 rm $target/etc
/update-motd.d
/{00-header,10-help-text,50-motd-news}
180 truncate
-s0 $target/var
/run
/motd.dynamic
182 cat >$target/etc
/issue
<<'EOF'
183 Trisquel GNU/Linux 12.0 \n \l
185 cat >$target/etc
/issue.net
<<'EOF'
186 Trisquel GNU/Linux 12.0
189 cat >$target/etc
/lsb-release
<<'EOF'
192 DISTRIB_CODENAME=ecne
193 DISTRIB_DESCRIPTION="Trisquel GNU/Linux 12.0, Ecne"