various fixes and initial focal support
[automated-distro-installer] / fai / config / scripts / GRUB_PC / 11-iank
index 485175fb7c370cb0670257606ae6b861ea8147ff..d8fb48dc5120cf49dbfe8dd2c5ec3bb0916329c7 100755 (executable)
@@ -19,18 +19,7 @@ if [[ -e /a/bin/fai/fai-wrapper ]]; then
   }
 fi
 
-chroot $FAI_ROOT bash <<'EOFOUTER'
-set -eE -o pipefail
-if getent group systemd-journal >/dev/null; then
-  # makes the journal be saved to disk.
-  mkdir -p /var/log/journal
-  chmod 755 /var/log/journal
-fi
-debconf-set-selections <<EOF
-kexec-tools kexec-tools/load_kexec boolean false
-EOF
-apt-get install -y pxe-kexec
-EOFOUTER
+
 
 # -r = recursive
 # -i = ignore non-matching class warnings, always exit 0
@@ -80,7 +69,20 @@ if [[ ! -r $f ]] || (( $(( $(date +%s) - $(stat -c %Y $f ) )) > 60*60*2 )); then
 fi
 
 
-chroot $FAI_ROOT bash <<'EOF'
+
+#### misc configurations
+chroot $FAI_ROOT bash <<'EOFOUTER'
+if getent group systemd-journal >/dev/null; then
+  # makes the journal be saved to disk.
+  mkdir -p /var/log/journal
+  chmod 755 /var/log/journal
+fi
+debconf-set-selections <<EOF
+kexec-tools kexec-tools/load_kexec boolean false
+EOF
+apt-get install -y pxe-kexec
+
+
 #### begin .ssh setup ###
 set -x
 set -eE -o pipefail
@@ -104,15 +106,14 @@ sudo -u iank mkdir -p $d
 sudo -u iank ln -sf /usr/lib/systemd/user/ssh-agent.service $d
 #### end .ssh setup ###
 
-### duplicated in ssh-emacs-setup
+
+## duplicated in ssh-emacs-setup
 # done here so its setup earlier for convenience
 line='AcceptEnv INSIDE_EMACS BRC COLUMNS'
 f=/etc/ssh/sshd_config
 grep -xFq "$line" $f || tee -a $f <<<"$line"
 
 
-
-
 # default jessie groups + kvm, systemd-journal, adm
 for g in adm cdrom floppy sudo audio dip video plugdev netdev; do
   if getent gropu $g >/dev/null; then
@@ -129,23 +130,19 @@ fi
 # that a normal user can disrupt the system, eg cause a reboot.
 sed -i '$a kernel.sysrq=1
 /^kernel.sysrq=/d' /etc/sysctl.conf
-EOF
+EOFOUTER
 
 
 if [[ $FAI_ACTION != dirinstall ]]; then
-
-
   # luks options, see man systemd-cryptsetup-generator
   # all i know is that with luks.crypttab=no, swap still timed out on boot.
   # and with rd.luks.crypttab=no, it works.
-  cmdline="rd.luks.crypttab=no console=ttyS0 net.ifnames=0"
   if ifclass LINODE; then
     speed=19200
-    cmdline+=",${speed}n8"
-    cmdline="rd.luks.crypttab=no console=ttyS0,${speed}n8"
+    cmdline="rd.luks.crypttab=no net.ifnames=0 console=ttyS0,${speed}n8"
   else
     speed=115200
-    cmdline+=",${speed}n8 console=tty0"
+    cmdline="rd.luks.crypttab=no net.ifnames=0 console=ttyS0,${speed}n8 console=tty0"
   fi
 
   cat >$FAI_ROOT/etc/grub.d/40_custom <<EOF
@@ -181,7 +178,7 @@ sed -i '/^ *GRUB_HIDDEN_TIMEOUT/d' /etc/default/grub
 
 update-grub2
 EOF
-fi # end != dirinstall
+fi ##### end != dirinstall
 
 
 # reading through the groups that iank is in but user2 isn't,
@@ -190,7 +187,8 @@ for g in plugdev audio video cdrom; do
 done
 
 
-## begin network setup
+
+###### begin network setup ####
 
 # use old names. the idea of them changing between boots has never
 # happened to me and I usually only have 1 wired or other type.
@@ -228,20 +226,24 @@ iface eth0 inet dhcp
 iface eth0 inet6 auto
 EOF
 
-# previously had an else condition after
-#elif ifclass VM || ifclass LINODE; then
-# iface br0 inet dhcp
-#   bridge_ports $NIC1
-#   bridge_stp off
-#   bridge_maxwait 0
-# however, on t9, on startup, br0, became
-# rename1 and didn't come up. i dunno why,
-# but the bridge is for vms that I rarely use,
-# so not bothering to figure it out.
+  # previously had an else condition after
+  #elif ifclass VM || ifclass LINODE; then
+  # iface $NIC1 inet manual
+  # iface br0 inet dhcp
+  #   bridge_ports $NIC1
+  #   bridge_stp off
+  #   bridge_maxwait 0
+  # however, on t9, on startup, br0, became
+  # rename1 and didn't come up. i dunno why,
+  # but the bridge is for vms that I rarely use,
+  # so not bothering to figure it out.
 
 
 fi
 
+rm -f $target/etc/resolv.conf
+ln -s ../run/systemd/resolve/stub-resolv.conf $target/etc/resolv.conf
+
 if ifclass LINODE; then
   mkdir -p $target/etc/initramfs-tools/conf.d
   cat >$target/etc/initramfs-tools/conf.d/mine <<EOF
@@ -260,5 +262,4 @@ systemctl disable systemd-networkd.socket systemd-networkd networkd-dispatcher s
 systemctl mask systemd-networkd.socket systemd-networkd networkd-dispatcher systemd-networkd-wait-online
 EOF
 
-
-## end network setup
+##### end network setup  #####