69b9afe7bc10c3f2d53a8999e2795ceb1439ca5c
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."
30 #### misc configurations
31 chroot
$FAI_ROOT bash
<<'EOFOUTER'
33 if getent group systemd-journal >/dev/null; then
34 # makes the journal be saved to disk.
35 mkdir -p /var/log/journal
36 chmod 755 /var/log/journal
38 debconf-set-selections <<EOF
39 kexec-tools kexec-tools/load_kexec boolean false
41 apt-get install -y pxe-kexec
43 # this is usefull. Only thing reason I see this being disabled by default is
44 # that a non-root user can disrupt the system, eg cause a reboot.
45 sed -i '$a kernel.sysrq=1
46 /^kernel.sysrq=/d' /etc/sysctl.conf
50 cmdline_extra
="$d16_cmdline $fsf_cmdline_extra"
52 # luks options, see man systemd-cryptsetup-generator
53 # all i know is that with luks.crypttab=no, swap still timed out on boot.
54 # and with rd.luks.crypttab=no, it works.
55 cmdline
="rd.luks.crypttab=no net.ifnames=0 $cmdline_extra"
57 chroot
$FAI_ROOT bash
<<EOF
60 # https://askubuntu.com/questions/33416/how-do-i-disable-the-boot-splash-screen-and-only-show-kernel-and-boot-text-inst
62 sed -ri 's/(^GRUB_CMDLINE_LINUX_DEFAULT=")quiet/\1/;s/^(GRUB_CMDLINE_LINUX_DEFAULT=".*) quiet([ "])/\1\2/' /etc/default/grub
63 sed -ri 's/(^GRUB_CMDLINE_LINUX_DEFAULT=")splash/\1/;s/^(GRUB_CMDLINE_LINUX_DEFAULT=".*) splash([ "])/\1\2/' /etc/default/grub
65 for arg in $cmdline; do
66 if ! grep "^GRUB_CMDLINE_LINUX_DEFAULT=.*[\" ]\${arg//./\\.}[\" ]" /etc/default/grub; then
67 sed -ri "s/^GRUB_CMDLINE_LINUX_DEFAULT=\"(.*)/GRUB_CMDLINE_LINUX_DEFAULT=\"\$arg \1/" /etc/default/grub
71 if grep -qF "$cmdline" /etc/default/grub; then
72 # already set things, exit
76 # required to show vga grub on d16, at least for t11
77 echo GRUB_TERMINAL=console >>/etc/default/grub
80 sed -ri 's/^ *GRUB_CMDLINE_LINUX_DEFAULT=.*/GRUB_CMDLINE_LINUX_DEFAULT="$cmdline"/' /etc/default/grub
81 sed -ri 's/^ *GRUB_TIMEOUT_STYLE=.*/GRUB_TIMEOUT_STYLE=menu/' /etc/default/grub
82 sed -ri 's/^ *GRUB_TIMEOUT=.*/GRUB_TIMEOUT=6/' /etc/default/grub
83 # on xenial, no grub is displayed at all. fix that.
84 # found just by noticing this in the config file, and a
85 # warning about it in error.log
86 sed -i '/^ *GRUB_HIDDEN_TIMEOUT/d' /etc/default/grub
88 if type -P update-grub2 &>/dev/null; then
97 # I prefer to stick with ifup/down or networkmanager: networkd is not in its
98 # own package, so cant use in other init systems. b. it works fine.
99 chroot
$FAI_ROOT bash
<<EOF
100 systemctl disable systemd-networkd.socket systemd-networkd networkd-dispatcher systemd-networkd-wait-online
101 systemctl mask systemd-networkd.socket systemd-networkd networkd-dispatcher systemd-networkd-wait-online