4 trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
6 if [[ $EUID != 0 ]]; then
7 echo "$0: error: expected to be root."
14 #### misc configurations
15 chroot
$FAI_ROOT bash
<<'EOFOUTER'
16 if getent group systemd-journal >/dev/null; then
17 # makes the journal be saved to disk.
18 mkdir -p /var/log/journal
19 chmod 755 /var/log/journal
21 debconf-set-selections <<EOF
22 kexec-tools kexec-tools/load_kexec boolean false
24 apt-get install -y pxe-kexec
26 # this is usefull. Only thing reason I see this being disabled by default is
27 # that a non-root user can disrupt the system, eg cause a reboot.
28 sed -i '$a kernel.sysrq=1
29 /^kernel.sysrq=/d' /etc/sysctl.conf
33 # luks options, see man systemd-cryptsetup-generator
34 # all i know is that with luks.crypttab=no, swap still timed out on boot.
35 # and with rd.luks.crypttab=no, it works.
36 cmdline
="rd.luks.crypttab=no net.ifnames=0 $cmdline_extra"
39 chroot
$FAI_ROOT bash
<<EOF
41 # https://askubuntu.com/questions/33416/how-do-i-disable-the-boot-splash-screen-and-only-show-kernel-and-boot-text-inst
43 sed -ri 's/(^GRUB_CMDLINE_LINUX_DEFAULT=")quiet/\1/;s/^(GRUB_CMDLINE_LINUX_DEFAULT=".*) quiet([ "])/\1\2/' /etc/default/grub
44 sed -ri 's/(^GRUB_CMDLINE_LINUX_DEFAULT=")splash/\1/;s/^(GRUB_CMDLINE_LINUX_DEFAULT=".*) splash([ "])/\1\2/' /etc/default/grub
46 for arg in $cmdline; do
47 if ! grep "^GRUB_CMDLINE_LINUX_DEFAULT=.*[\" ]\${arg//./\\.}[\" ]" /etc/default/grub; then
48 sed -ri "s/^GRUB_CMDLINE_LINUX_DEFAULT=\"(.*)/GRUB_CMDLINE_LINUX_DEFAULT=\"\$arg \1/" /etc/default/grub
52 if grep -qF "$cmdline" /etc/default/grub; then
53 # already set things, exit
56 sed -ri 's/^ *GRUB_CMDLINE_LINUX_DEFAULT=.*/GRUB_CMDLINE_LINUX_DEFAULT="$cmdline"/' /etc/default/grub
57 sed -ri 's/^ *GRUB_TIMEOUT_STYLE=.*/GRUB_TIMEOUT_STYLE=menu/' /etc/default/grub
58 sed -ri 's/^ *GRUB_TIMEOUT=.*/GRUB_TIMEOUT=6/' /etc/default/grub
59 # on xenial, no grub is displayed at all. fix that.
60 # found just by noticing this in the config file, and a
61 # warning about it in error.log
62 sed -i '/^ *GRUB_HIDDEN_TIMEOUT/d' /etc/default/grub
64 if type -P update-grub2 &>/dev/null; then
73 # I prefer to stick with ifup/down or networkmanager: networkd is not in its
74 # own package, so cant use in other init systems. b. it works fine.
75 chroot
$FAI_ROOT bash
<<EOF
76 systemctl disable systemd-networkd.socket systemd-networkd networkd-dispatcher systemd-networkd-wait-online
77 systemctl mask systemd-networkd.socket systemd-networkd networkd-dispatcher systemd-networkd-wait-online