various fixes for bullseye and new ssh key changes
[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, BOOKWORM64
31 # FLIDAS64, FLIDAS64BIG, ETIONA64, NABIA64
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, VOL_BOOKWORM
36 # VOL_FLIDAS, VOL_ETIONA, VOL_NABIA
37 # VOL_XENIAL, VOL_BIONIC VOL_FOCAL
38 # VOL_BUSTER_BOOTSTRAP.
39 # Using VOL_BUSTER_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 # BOOKWORM_FREE, BOOKWORM_NONFREE
47 # TESTING_FREE, TESTING_NONFREE,
48 # XENIAL_FREE, BIONIC, FOCAL, FLIDAS, ETIONA, NABIA, STRETCH_LINODE.
49 #
50 # It's all a little redundant in some cases, but it keeps things
51 # simpler.
52 #
53 #
54 # Other notable classes:
55 #
56 # INSTALL: for autodiscover iso, this is needed. We could also add it to
57 # the autodiscover grub, but then we have to burn a new iso if we want a
58 # non-install one. It sets the class for the corresponding INSTALL.var,
59 # which sets FAI_ACTION=INSTALL. I'm not sure if this variable overrides
60 # FAI_ACTION outside of autodiscover, todo: test it out, if it doesn't,
61 # make install be default in 51-multi-boot, and disable it if needed.
62 #
63 # DESKTOP: install a bunch of extra packages. For creating X suffix
64 # basefiles. See README.
65 #
66 # REPARTITION: we try to reuse partitions/filesystems to install a new
67 # os into a multi-os system, if we see some basic hueristics, like the
68 # right amount of them. This overrides that.
69 #
70 # PARTITION_PROMPT: If we don't see partitions to reuuse, prompt
71 # to make sure we really want to repartition and use a completely
72 # fresh install. I use this in case our repartition check has
73 # a bug in it, or I accidentally set REPARTITION.
74 #
75 # ROTATIONAL: in a system with ssd and hdd, install to the hdd
76 # instead of the default ssd.
77 #
78 # RAID0: Use raid 0 even if there are >= 4 disks with boot partititions.
79 #
80 # LINODE: For running a vm on linode, especially one created with fai-cd.
81
82
83 if [[ -e /a/bin/fai/fai-wrapper ]]; then
84 source /a/bin/distro-functions/src/identify-distros
85 if isdeb; then
86 codename=$(debian-codename)
87 echo ${codename^^}
88 distro=$(distro-name)
89 case $distro in
90 debian)
91 echo ${distro^^}
92 # nonfree repo is not going away any time soon due to
93 # gcc-doc being in nonfree
94 echo ${codename^^}_NONFREE
95 ;;
96 trisquel)
97 # easier to stay with fai example config if we just call it ubuntu
98 echo UBUNTU
99 ;;
100 esac
101 fi
102 case $HOSTNAME in
103 li|lj) echo "LINODE" ;;
104 bk|je) echo "NOCRYPT" ;;
105 esac
106 fi
107
108
109 #echo "PARTITION_PROMPT"
110 #echo REPARTITION
111
112
113 if grep ^52:54:00: /sys/class/net/eth0/address &>/dev/null; then
114 # if our eth0 mac is in the kvm range, we are a vm.
115 echo "VM"
116 fi
117
118 exit 0
119 ### Below here is a comment of code, exit above is so it does not get executed ###
120
121 ###### begin Template for 51-multi-boot ######
122 #
123 # It has reasonable combinations of above classes.
124 # It's a noop until we replace _ with host names.
125
126 #!/bin/bash
127 if [[ ! -e /a/bin/fai/fai-wrapper || $FAI_ACTION == dirinstall ]]; then
128 case $HOSTNAME in
129 # bullseye based minimal recovery / bootstraping os:
130 _) echo BULLSEYE64 VOL_BULLSEYE_BOOTSTRAP BULLSEYE_FREE ;;
131 # flidas
132 _) echo UBUNTU FLIDAS64 VOL_FLIDAS FLIDAS ;;
133 # etiona
134 _) echo UBUNTU ETIONA64 VOL_ETIONA ETIONA ;;
135 # nabia
136 _) echo UBUNTU NABIA64 VOL_NABIA NABIA ;;
137 # stretch
138 _) echo STRETCH64 VOL_STRETCH STRETCH_NONFREE ;;
139 # buster
140 _) echo BUSTER64 VOL_BUSTER BUSTER_NONFREE ;;
141 # bullseye
142 _) echo BULLSEYE64 VOL_BULLSEYE BULLSEYE_NONFREE ;;
143 # bookworm
144 _) echo BOOKWORM64 VOL_BOOKWORM BOOKWORM_NONFREE ;;
145 # testing
146 _) echo BOOKWORM64 VOL_TESTING TESTING_NONFREE ;;
147 # xenial
148 _) echo UBUNTU XENIAL64 VOL_XENIAL XENIAL_FREE ;;
149 # bionic
150 _) echo UBUNTU BIONIC64 VOL_BIONIC BIONIC ;;
151 # focal
152 _) echo UBUNTU FOCAL64 VOL_FOCAL FOCAL ;;
153 esac
154 fi
155 ###### end Template for 51-multi-boot ######