Merge branch 'upstream'
[automated-distro-installer] / fai / config / class / 50-host-classes
index 9f4f8a6b85142eef2d23e6236659dbbd52e8fcf4..61a55934d0054397c6c89c073942d5aca3f3e7ee 100755 (executable)
@@ -5,6 +5,9 @@
 # do not use this if a menu will be presented
 [ "$flag_menu" ] && exit 0
 
+# set these early so they are lowest priority.
+echo FAIBASE STANDARD DEBIAN
+
 
 # For multi-boot system.
 # We check that we aren't in a pxe boot environment.
@@ -17,7 +20,7 @@
 #
 # Each host defines following:
 # The base distro:
-# UBUNTU, DEBIAN
+# UBUNTU or nothing. DEBIAN is always defined as a base.
 #
 # The base disto version, only use so far is the basefile name if it exists.
 # Debian stable basefile gets built by faisetup and gets used otherwise.
 
 #!/bin/bash
 if [[ ! -e /a/bin/fai/fai-wrapper || $FAI_ACTION == dirinstall ]]; then
-    case $HOSTNAME in
-        # stretch based minimal recovery / bootstraping os:
-        _) echo DEBIAN STRETCH64 VOL_STRETCH_BOOTSTRAP STRETCH_FREE ;;
-        # flidas
-        _) echo UBUNTU FLIDAS64 VOL_FLIDAS FLIDAS ;;
-        # etiona
-        _) echo UBUNTU ETIONA64 VOL_ETIONA ETIONA ;;
-        # stretch
-        _) echo DEBIAN STRETCH64 VOL_STRETCH STRETCH_FREE ;;
-        # buster
-        _) echo DEBIAN BUSTER64 VOL_BUSTER BUSTER_FREE ;;
-        # testing
-        _) echo DEBIAN STRETCH64 VOL_TESTING TESTING_FREE ;;
-        # xenial
-        _) echo UBUNTU XENIAL64 VOL_XENIAL XENIAL_FREE ;;
-        # bionic
-        _) echo UBUNTU BIONIC64 VOL_BIONIC BIONIC ;;
-        # focal
-        _) echo UBUNTU FOCAL64 VOL_FOCAL FOCAL ;;
-    esac
+  case $HOSTNAME in
+    # stretch based minimal recovery / bootstraping os:
+    _) echo STRETCH64 VOL_STRETCH_BOOTSTRAP STRETCH_FREE ;;
+    # flidas
+    _) echo UBUNTU FLIDAS64 VOL_FLIDAS FLIDAS ;;
+    # etiona
+    _) echo UBUNTU ETIONA64 VOL_ETIONA ETIONA ;;
+    # stretch
+    _) echo STRETCH64 VOL_STRETCH STRETCH_FREE ;;
+    # buster
+    _) echo BUSTER64 VOL_BUSTER BUSTER_FREE ;;
+    # testing
+    _) echo STRETCH64 VOL_TESTING TESTING_FREE ;;
+    # xenial
+    _) echo UBUNTU XENIAL64 VOL_XENIAL XENIAL_FREE ;;
+    # bionic
+    _) echo UBUNTU BIONIC64 VOL_BIONIC BIONIC ;;
+    # focal
+    _) echo UBUNTU FOCAL64 VOL_FOCAL FOCAL ;;
+  esac
 fi
 ###### end Template for 51-multi-boot ######
 
 if [[ -e /a/bin/fai/fai-wrapper ]]; then
-    source /a/bin/distro-functions/src/identify-distros
-    if isdebian; then
-        echo "DEBIAN"
-    fi
-    if isdebian-stable; then
-        echo "STRETCH"
-        case $HOSTNAME in
-            li|lj) echo "STRETCH_LINODE" ;;
-            *)
-                # nonfree repo is not going away any time soon due to
-                # gcc-doc being in nonfree
-                echo "STRETCH_NONFREE"
-                ;;
-        esac
-    fi
+  source /a/bin/distro-functions/src/identify-distros
+  if isdeb; then
+    codename=$(debian-codename)
+    echo ${codename^^}
+    distro=$(distro-name)
+    case $distro in
+      debian)
+        echo ${distro^^}
+        # nonfree repo is not going away any time soon due to
+        # gcc-doc being in nonfree
+        echo ${codename^^}_NONFREE
+        ;;
+      trisquel)
+        # easier to stay with fai example config if we just call it ubuntu
+        echo UBUNTU
+        ;;
+    esac
+  fi
+  case $HOSTNAME in
+    li|lj) echo "LINODE" ;;
+    bk|je) echo "NOCRYPT" ;;
+  esac
 fi
 
-echo FAIBASE STANDARD
 
 #echo "PARTITION_PROMPT"
 #echo REPARTITION
 
 
 if grep ^52:54:00: /sys/class/net/eth0/address &>/dev/null; then
-    # if our eth0 mac is in the kvm range, we are a vm.
-    echo "VM"
+  # if our eth0 mac is in the kvm range, we are a vm.
+  echo "VM"
 fi