bug fix
[automated-distro-installer] / fai / config / scripts / IANK / 11-iank
index ce0be4b5321fa9064258184a96c7b2eb3c409e9b..99316b84f0f376ad0568537044b66b8be241f12d 100755 (executable)
@@ -24,6 +24,9 @@ if [[ $EUID != 0 ]]; then
   exit 1
 fi
 
+# ignore this line. hack to make shellcheck ignore $target
+if [[ ! $target ]]; then target=; fi
+
 if ! type -t fcopy &>/dev/null; then
   sudo apt-get -y install fai-client
 fi
@@ -184,6 +187,21 @@ EOF
 [main]
 dns=systemd-resolved
 EOF
+
+
+  if [[ ! $FAI_WRAPPER || $SSH_CLIENT ]]; then
+    # for running from fai or remote connections, don't kill the internet
+    ethusb_arg=-c
+  fi
+  if [[ $(dig +short @10.2.0.1 -x 10.2.0.2 2>&1 ||:) == kd.b8.nz. ]] \
+       && ip n show 10.2.0.1 | grep . &>/dev/null; then
+    # we are at_home
+    $FAI/distro-install-common/ethusb-static $ethusb_arg
+  else
+    $FAI/distro-install-common/ethusb-static off $ethusb_arg
+  fi
+
+
 else
   cat > $target/etc/network/interfaces <<-EOF
 # generated by FAI
@@ -212,6 +230,7 @@ fi
 
 if ifclass LINODE; then
   mkdir -p $target/etc/initramfs-tools/conf.d
+  # shellcheck disable=SC2154 # comes with LINODE environment
   cat >$target/etc/initramfs-tools/conf.d/mine <<EOF
 # dhcp in initramfs doesn't work on linode. i dunno why, whatever.
 # man 5 initramfs.conf
@@ -323,14 +342,21 @@ for g in plugdev audio video cdrom; do
   $ROOTCMD usermod -a -G $g user2
 done
 
-
 ## begin get new kernel and btrfs-progs ##
 case $HOSTNAME in
   sy|so)
-    $FAI/distro-install-common/install-stable-kernel-debs
+    # on sy t11, severe wifi degredation on 6.8
+    # on so t11, no x11 display on 6.8
+    $FAI/distro-install-common/install-mainline-kernel-debs stable
     ;;
   *)
-    $ROOTCMD apt-get -y install linux-libre
+    if ! $ROOTCMD dpkg -s -- freesh-archive-keyring  2>&1 | grep -Fx "Status: install ok installed" &>/dev/null; then
+      apt-get -y install wget
+      wget -O /target/tmp/x.deb https://linux-libre.fsfla.org/pub/linux-libre/freesh/pool/main/f/freesh-archive-keyring/freesh-archive-keyring_1.1_all.deb
+      $ROOTCMD dpkg -i /tmp/x.deb
+      $ROOTCMD apt-get update
+      $ROOTCMD apt-get -y install linux-libre
+    fi
     ;;
 esac