changes for bullseye
[automated-distro-installer] / fai / config / class / 50-host-classes
1 #!/bin/bash
2
3 # assign classes to hosts based on their hostname
4
5 # do not use this if a menu will be presented
6 [ "$flag_menu" ] && exit 0
7
8 # set these early so they are lowest priority.
9 echo FAIBASE STANDARD DEBIAN
10
11
12 # For multi-boot system.
13 # We check that we aren't in a pxe boot environment.
14 # There is probably a better way to do this.
15 # We check the reverse condition in 51-multi-boot,
16 # and set what os we are installing, but don't check it
17 # into git since it changes regularly.
18
19 #
20 #
21 # Each host defines following:
22 # The base distro:
23 # UBUNTU or nothing. DEBIAN is always defined as a base.
24 #
25 # The base disto version, only use so far is the basefile name if it exists.
26 # Debian stable basefile gets built by faisetup and gets used otherwise.
27 # With X suffix, means it has gone through the dirinstall process and has eXtra
28 # things installed, to speed up installation.
29 #
30 # STRETCH64, BUSTER64, BULLSEYE64,
31 # FLIDAS64, FLIDAS64BIG, ETIONA64,
32 # XENIAL64, BIONIC64, FOCAL64,
33 #
34 # The distro subvol name, we can add as many of these as we want:
35 # VOL_TESTING, VOL_STRETCH, VOL_BUSTER, VOL_BULLSEYE,
36 # VOL_FLIDAS, VOL_ETIONA
37 # VOL_XENIAL, VOL_BIONIC VOL_FOCAL
38 # VOL_STRETCH_BOOTSTRAP.
39 # Using VOL_STRETCH_BOOTSTRAP sets up the install to act like a pxe rom if
40 # grub sets a specific var.
41 #
42 # The apt sources files we want,
43 # STRETCH_FREE, STRETCH_NONFREE,
44 # BUSTER_FREE, BUSTER_NONFREE,
45 # BULLSEYE_FREE, BULLSEYE_NONFREE
46 # TESTING_FREE, TESTING_NONFREE,
47 # XENIAL_FREE, BIONIC, FOCAL, FLIDAS, ETIONA, STRETCH_LINODE.
48 #
49 # It's all a little redundant in some cases, but it keeps things
50 # simpler.
51 #
52 #
53 # Other notable classes:
54 #
55 # INSTALL: for autodiscover iso, this is needed. We could also add it to
56 # the autodiscover grub, but then we have to burn a new iso if we want a
57 # non-install one. It sets the class for the corresponding INSTALL.var,
58 # which sets FAI_ACTION=INSTALL. I'm not sure if this variable overrides
59 # FAI_ACTION outside of autodiscover, todo: test it out, if it doesn't,
60 # make install be default in 51-multi-boot, and disable it if needed.
61 #
62 # DESKTOP: install a bunch of extra packages. For creating X suffix
63 # basefiles. See README.
64 #
65 # REPARTITION: we try to reuse partitions/filesystems to install a new
66 # os into a multi-os system, if we see some basic hueristics, like the
67 # right amount of them. This overrides that.
68 #
69 # PARTITION_PROMPT: If we don't see partitions to reuuse, prompt
70 # to make sure we really want to repartition and use a completely
71 # fresh install. I use this in case our repartition check has
72 # a bug in it, or I accidentally set REPARTITION.
73 #
74 # ROTATIONAL: in a system with ssd and hdd, install to the hdd
75 # instead of the default ssd.
76 #
77 # RAID0: Use raid 0 even if there are >= 4 disks with boot partititions.
78 #
79 # LINODE: For running a vm on linode, especially one created with fai-cd.
80
81 ###### begin Template for 51-multi-boot ######
82 #
83 # It has reasonable combinations of above classes.
84 # It's a noop until we replace _ with host names.
85
86 #!/bin/bash
87 if [[ ! -e /a/bin/fai/fai-wrapper || $FAI_ACTION == dirinstall ]]; then
88 case $HOSTNAME in
89 # stretch based minimal recovery / bootstraping os:
90 _) echo STRETCH64 VOL_STRETCH_BOOTSTRAP STRETCH_FREE ;;
91 # flidas
92 _) echo UBUNTU FLIDAS64 VOL_FLIDAS FLIDAS ;;
93 # etiona
94 _) echo UBUNTU ETIONA64 VOL_ETIONA ETIONA ;;
95 # stretch
96 _) echo STRETCH64 VOL_STRETCH STRETCH_FREE ;;
97 # buster
98 _) echo BUSTER64 VOL_BUSTER BUSTER_FREE ;;
99 # testing
100 _) echo STRETCH64 VOL_TESTING TESTING_FREE ;;
101 # xenial
102 _) echo UBUNTU XENIAL64 VOL_XENIAL XENIAL_FREE ;;
103 # bionic
104 _) echo UBUNTU BIONIC64 VOL_BIONIC BIONIC ;;
105 # focal
106 _) echo UBUNTU FOCAL64 VOL_FOCAL FOCAL ;;
107 esac
108 fi
109 ###### end Template for 51-multi-boot ######
110
111 if [[ -e /a/bin/fai/fai-wrapper ]]; then
112 source /a/bin/distro-functions/src/identify-distros
113 if isdeb; then
114 codename=$(debian-codename)
115 echo ${codename^^}
116 distro=$(distro-name)
117 case $distro in
118 debian)
119 echo ${distro^^}
120 # nonfree repo is not going away any time soon due to
121 # gcc-doc being in nonfree
122 echo ${codename^^}_NONFREE
123 ;;
124 trisquel)
125 # easier to stay with fai example config if we just call it ubuntu
126 echo UBUNTU
127 ;;
128 esac
129 fi
130 case $HOSTNAME in
131 li|lj) echo "LINODE" ;;
132 bk|je) echo "NOCRYPT" ;;
133 esac
134 fi
135
136
137 #echo "PARTITION_PROMPT"
138 #echo REPARTITION
139
140
141 if grep ^52:54:00: /sys/class/net/eth0/address &>/dev/null; then
142 # if our eth0 mac is in the kvm range, we are a vm.
143 echo "VM"
144 fi