2 # I, Ian Kelling, follow the GNU license recommendations at
3 # https://www.gnu.org/licenses/license-recommendations.en.html. They
4 # recommend that small programs, < 300 lines, be licensed under the
5 # Apache License 2.0. This file contains or is part of one or more small
6 # programs. If a small program grows beyond 300 lines, I plan to switch
9 # Copyright 2024 Ian Kelling
11 # Licensed under the Apache License, Version 2.0 (the "License");
12 # you may not use this file except in compliance with the License.
13 # You may obtain a copy of the License at
15 # http://www.apache.org/licenses/LICENSE-2.0
17 # Unless required by applicable law or agreed to in writing, software
18 # distributed under the License is distributed on an "AS IS" BASIS,
19 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20 # See the License for the specific language governing permissions and
21 # limitations under the License.
24 if ! test "$BASH_VERSION"; then echo "error: shell is not bash" >&2; exit 1; fi
25 shopt -s inherit_errexit
2>/dev
/null ||
: # ignore fail in bash < 4.4
27 trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" exit status: $?, PIPESTATUS: ${PIPESTATUS[*]}" >&2' ERR
43 debconf-set-selections
<<'EOF'
44 locales locales/default_environment_locale select en_US.UTF-8
45 locales locales/locales_to_be_generated multiselect en_US.UTF-8 UTF-8
48 # /a/bin/fai/fai/config/hooks/updatebase.UBUNTU
49 # shellcheck disable=SC2016
50 debconf
--owner=locales sh
-c '
51 . /usr/share/debconf/confmodule
53 db_get locales/locales_to_be_generated &&
54 mkdir -p /var/lib/locales/supported.d &&
55 echo "$RET" > /var/lib/locales/supported.d/local'
56 dpkg-reconfigure
-fnoninteractive locales
58 apt
-y remove
--purge --auto-remove netplan.io libnetplan0
60 apt
-y install linux-virtual-hwe-20.04 grub-pc-bin openssh-server ifupdown rsync
63 cat >/root
/.ssh
/authorized_keys
<<'EOF'
64 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDX42yru/h6r6UDRy/VwVZjcYEmNLG5/SUjv7xwu43OaW0wL+uHYg2rkfn4Ygh5o1I5pgBh2SWg8TeWuVGhgL1SCuBzzeai/+58Sny065Qak+D2WjVOuRonRelh+CBA5EpNZPuiWQkoWdf9NACTBCbS2Zu7r8OOgRqu/ruaDNePlG5+U0Wlpy3oBnpbzQiuSA3AKMW30fsCJtOBjz5qQaiPbYEKJy3AOvtbq10wliKx9TpsTzrq8dKWs7PLhZnzqVCsaq6D95IzjqXcSpx4Cga5bn+YEuAnJQ53PGA5eO+hpz6HDmawTbJlaV/Dufb9bJ/ZZy1DXzs07yWRtTEY54/X ian@iankelling.org
67 # https://tools.bitfolk.com/wiki/IPv6
68 cat >/etc
/network
/interfaces
<<EOF
70 iface lo inet loopback
72 # The primary network interface
74 iface eth0 inet static
78 iface eth0 inet6 static
82 post-up echo 0 > /proc/sys/net/ipv6/conf/default/accept_ra
83 post-up echo 0 > /proc/sys/net/ipv6/conf/all/accept_ra
84 post-up echo 0 > /proc/sys/net/ipv6/conf/\$IFACE/accept_ra
85 post-up echo 0 > /proc/sys/net/ipv6/conf/default/autoconf
86 post-up echo 0 > /proc/sys/net/ipv6/conf/all/autoconf
87 post-up echo 0 > /proc/sys/net/ipv6/conf/\$IFACE/autoconf
90 cat >/etc
/fstab
<<'EOF'
91 /dev/xvda1 / ext4 noatime,nodiratime 0 1
92 /dev/xvdb1 none swap nofail,x-systemd.device-timeout=30s,x-systemd.mount-timeout=30s,sw 0 0
95 cat >> /etc
/default
/grub
<<'EOF'
96 GRUB_CMDLINE_LINUX_DEFAULT=""
97 GRUB_CMDLINE_LINUX="console=hvc0"
102 cat >/etc
/systemd
/resolved.conf.d
/servers.conf
<<'EOF'
104 DNS=85.119.80.232 85.119.80.233
108 cat >/etc
/hostname
<<EOF
112 # from fai/fai/config/scripts/FAIBASE/10-misc
115 echo $TIMEZONE >/etc
/timezone
116 if [[ -L /etc
/localtime
]]; then
117 ln -sf /usr
/share
/zoneinfo
/${TIMEZONE} /etc
/localtime
119 cp -f /usr
/share
/zoneinfo
/${TIMEZONE} /etc
/localtime