From: Ian Kelling <ian@iankelling.org>
Date: Sat, 13 Aug 2016 06:25:16 +0000 (-0700)
Subject: small bug fixes and improvements
X-Git-Url: https://iankelling.org/git/?a=commitdiff_plain;h=1d331faf4f315ae3356ceecb648170d3d74473df;p=automated-distro-installer

small bug fixes and improvements

Handle non-free repos. For multi-boot hosts,
have a separate file so we stop changing 50-host-classes
in git all the time.
---

diff --git a/README b/README
index c5cf1be..3993580 100644
--- a/README
+++ b/README
@@ -1,7 +1,7 @@
 Scripts for initial setup of OSes on my home network.
 
 My network is a wndr3700v2 router with openwrt on it and a few pcs
-with various gnu/linux distros on them.
+with atm: arch, debian jessie and debian stretch on them.
 
 
 Scripts meant to be called interactively:
diff --git a/dsfull b/dsfull
index c5cb230..44588ba 100755
--- a/dsfull
+++ b/dsfull
@@ -24,7 +24,7 @@ set -x
 if $reboot; then
     ssh $host sudo bash <<'EOF' || [[ $? == 255 ]]
 touch /tmp/keyscript-off
-reboot ||:
+reboot
 EOF
 fi
 
diff --git a/fai/config/class/50-host-classes b/fai/config/class/50-host-classes
index 7b23f85..624077d 100755
--- a/fai/config/class/50-host-classes
+++ b/fai/config/class/50-host-classes
@@ -10,16 +10,30 @@ echo "FAIBASE DEBIAN"
 case $HOSTNAME in
     demohost)
         echo "DESKTOP" ;;
-    tp|frodo|treetowl|x2)
+    tp)
         echo "DESKTOP PARTITION_PROMPT"
-        # non-portable way to see that we aren't in a pxe boot environment.
-        if [[ -e /a/bin/fai/fai-wrapper ]]; then
-            # We check the reverse condition in 51-multi-boot,
-            # and set what os we are installing, but don't check it
-            # into git since it changes regularly.
-            if isdebian-stable; then
-                echo "STABLE"
-            fi
+        # For multi-boot system.
+        # Check that we aren't in a pxe boot environment.
+        # There is probably a better way to do this.
+        # We check the reverse condition in 51-multi-boot,
+        # and set what os we are installing, but don't check it
+        # into git since it changes regularly.
+        # It's shell looks like this:
+        # if [[ ! -e /a/bin/fai/fai-wrapper ]]; then
+        #     case $HOSTNAME in
+        #         tp) : ;;
+        #         # add more multi-boot hostnames here
+        #     esac
+        # fi
+        #
+        if [[ -e /a/bin/fai/fai-wrapper ]] && isdebian-stable; then
+            echo "STABLE"
+        fi
+        ;;
+    x2|frodo|treetowl)
+        echo "NON_FREE"
+        if [[ -e /a/bin/fai/fai-wrapper ]] && isdebian-stable; then
+            echo "STABLE STABLE_NON_FREE"
         fi
         ;;
     lj)
diff --git a/fai/config/distro-install-common/end b/fai/config/distro-install-common/end
index 390c204..6afcd1e 100755
--- a/fai/config/distro-install-common/end
+++ b/fai/config/distro-install-common/end
@@ -76,6 +76,10 @@ fi
 
 dir=/q/p/c/machine_specific/$HOSTNAME/.unison
 $ROOTCMD mkdir -p $dir
+if ! $ROOTCMD test -L /root/.unison; then
+    $ROOTCMD rm -rf /root/.unison
+    $ROOTCMD ln -s -T $dir /root/.unison
+fi
 
 $ROOTCMD ln -sf /q/p /
 $ROOTCMD chown -R 1000:1000 $dir
diff --git a/fai/config/files/etc/apt/sources.list.d/stable-non-free.list/STABLE_NON_FREE b/fai/config/files/etc/apt/sources.list.d/stable-non-free.list/STABLE_NON_FREE
new file mode 100644
index 0000000..689921e
--- /dev/null
+++ b/fai/config/files/etc/apt/sources.list.d/stable-non-free.list/STABLE_NON_FREE
@@ -0,0 +1,11 @@
+deb http://http.us.debian.org/debian jessie contrib non-free
+deb-src http://http.us.debian.org/debian jessie contrib non-free
+
+deb http://security.debian.org/ jessie/updates contrib non-free
+deb-src http://security.debian.org/ jessie/updates contrib non-free
+
+deb http://http.us.debian.org/debian jessie-updates contrib non-free
+deb-src http://http.us.debian.org/debian jessie-updates contrib non-free
+
+deb http://http.debian.net/debian jessie-backports contrib non-free
+deb-src http://http.debian.net/debian jessie-backports contrib non-free
diff --git a/fai/config/files/etc/apt/sources.list.d/stable.list/STABLE b/fai/config/files/etc/apt/sources.list.d/stable.list/STABLE
index 28b57d6..0093b4f 100644
--- a/fai/config/files/etc/apt/sources.list.d/stable.list/STABLE
+++ b/fai/config/files/etc/apt/sources.list.d/stable.list/STABLE
@@ -6,3 +6,6 @@ deb-src http://security.debian.org/ jessie/updates main
 
 deb http://http.us.debian.org/debian jessie-updates main
 deb-src http://http.us.debian.org/debian jessie-updates main
+
+deb http://http.debian.net/debian jessie-backports main
+deb-src http://http.debian.net/debian jessie-backports main
diff --git a/fai/config/files/etc/apt/sources.list.d/testing-non-free.list/NON_FREE b/fai/config/files/etc/apt/sources.list.d/testing-non-free.list/NON_FREE
new file mode 100644
index 0000000..35fc32e
--- /dev/null
+++ b/fai/config/files/etc/apt/sources.list.d/testing-non-free.list/NON_FREE
@@ -0,0 +1,8 @@
+deb http://http.us.debian.org/debian testing contrib non-free
+deb-src http://http.us.debian.org/debian testing contrib non-free
+
+deb http://security.debian.org/ testing/updates contrib non-free
+deb-src http://security.debian.org/ testing/updates contrib non-free
+
+deb http://http.us.debian.org/debian testing-updates contrib non-free
+deb-src http://http.us.debian.org/debian testing-updates contrib non-free
diff --git a/fai/config/files/etc/apt/sources.list.d/unstable-non-free.list/NON_FREE b/fai/config/files/etc/apt/sources.list.d/unstable-non-free.list/NON_FREE
new file mode 100644
index 0000000..4a92405
--- /dev/null
+++ b/fai/config/files/etc/apt/sources.list.d/unstable-non-free.list/NON_FREE
@@ -0,0 +1,2 @@
+deb http://http.us.debian.org/debian unstable contrib non-free
+deb-src http://http.us.debian.org/debian unstable contrib non-free
diff --git a/fai/config/hooks/partition.DEFAULT b/fai/config/hooks/partition.DEFAULT
index dc328c0..aa74409 100755
--- a/fai/config/hooks/partition.DEFAULT
+++ b/fai/config/hooks/partition.DEFAULT
@@ -294,7 +294,7 @@ btrfs subvolume create root_$DISTRO
 chown root:1000 q
 
 mkdir -p /mnt/root_$DISTRO/boot
-for x in root/a q/a; do
+for x in q/a q/i; do
     mkdir -p $x
     chown 1000:1000 $x
     chmod 755 $x
@@ -315,7 +315,7 @@ umount /mnt
 ## end create subvols ##
 
 
-
+# note, the mount point /a seems to get automatically created somewhere
 cat > /tmp/fai/fstab <<EOF
 $first_root_crypt  /  btrfs  noatime,subvol=root_$DISTRO  0 0
 $first_root_crypt  /q  btrfs  noatime,subvol=q  0 0
@@ -326,7 +326,13 @@ EOF
 
 if ifclass treetowl; then
     cat >> /tmp/fai/fstab <<'EOF'
-UUID=3f7b31cd-f299-40b4-a86b-7604282e2715 /i btrfs  noatime    0 2
+UUID=3f7b31cd-f299-40b4-a86b-7604282e2715 /i btrfs  noatime  0 2
+EOF
+fi
+
+if ifclass frodo; then
+    cat >> /tmp/fai/fstab <<'EOF'
+/q/i  /i  none  bind  0 0
 EOF
 fi