80b86b51b86f478b63a2415bc272153bc4d87252
[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, ARAMO64
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, VOL_ARAMO
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, STRETCH_LINODE
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, ARAMO.
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 # LINODE: For running a vm on linode, especially one created with fai-cd.
67 #
68 # IANK / FSF: general setup of my machine vs FSF machines
69 # NABIA_EXTRA: extra repos for NABIA from other distros
70 # ARAMO_EXTRA: extra repos for ARAMO from other distros
71 #
72 # UBUNTU_UP: for trisquel, we want to inherit ubuntu things, except for
73 # some ubuntu things which go in this class. UP = upstream.
74 #
75 # D16: for kgpe-d16 specific settings.
76 #
77 # For filesystem/partitioning related classes, see comments at the top of
78 # fai/config/hooks/partition.DEFAULT
79
80 if [[ -e /a/bin/fai/fai-wrapper ]]; then
81 source /a/bin/distro-functions/src/identify-distros
82 if isdeb; then
83 codename=$(debian-codename)
84 echo ${codename^^}
85 distro=$(distro-name)
86 case $distro in
87 debian)
88 echo ${distro^^}
89 # nonfree repo is not going away any time soon due to
90 # gcc-doc being in nonfree
91 echo ${codename^^}_NONFREE
92 ;;
93 trisquel)
94 # easier to stay with fai example config if we just call it ubuntu
95 echo UBUNTU
96 ;;
97 esac
98 fi
99 case $HOSTNAME in
100 li|lj) echo "LINODE" ;;
101 bk|je) echo "NOCRYPT" ;;
102 esac
103 fi
104
105
106 #echo "PARTITION_PROMPT"
107 #echo REPARTITION
108
109
110 if grep ^52:54:00: /sys/class/net/eth0/address &>/dev/null; then
111 # if our eth0 mac is in the kvm range, we are a vm.
112 echo "VM"
113 fi
114
115 exit 0
116 ### Below here is a comment of code, exit above is so it does not get executed ###
117
118 ###### begin Template for 51-multi-boot ######
119 #
120 # It has reasonable combinations of above classes.
121 # We must first replace _ with host name(s).
122
123 #!/bin/bash
124
125 # pick one of these:
126 #echo IANK
127 #echo FSF
128 if [[ ! -e /a/bin/fai/fai-wrapper || $FAI_ACTION == dirinstall ]]; then
129 case $HOSTNAME in
130 # bullseye based minimal recovery / bootstraping os:
131 _) echo BULLSEYE64 VOL_BULLSEYE_BOOTSTRAP BULLSEYE_FREE ;;
132 # flidas
133 _) echo UBUNTU FLIDAS64 VOL_FLIDAS FLIDAS ;;
134 # etiona
135 _) echo UBUNTU ETIONA64 VOL_ETIONA ETIONA ;;
136 # nabia
137 _) echo UBUNTU NABIA64 VOL_NABIA NABIA NABIA_EXTRA ;;
138 # aramo
139 _) echo UBUNTU ARAMO64 VOL_ARAMO ARAMO ARAMO_EXTRA ;;
140 # stretch
141 _) echo STRETCH64 VOL_STRETCH STRETCH_NONFREE ;;
142 # buster
143 _) echo BUSTER64 VOL_BUSTER BUSTER_NONFREE ;;
144 # bullseye
145 _) echo BULLSEYE64 VOL_BULLSEYE BULLSEYE_NONFREE ;;
146 # bookworm
147 _) echo BOOKWORM64 VOL_BOOKWORM BOOKWORM_NONFREE ;;
148 # testing
149 _) echo BOOKWORM64 VOL_TESTING TESTING_NONFREE ;;
150 # xenial
151 _) echo UBUNTU XENIAL64 VOL_XENIAL XENIAL_FREE ;;
152 # bionic
153 _) echo UBUNTU BIONIC64 VOL_BIONIC BIONIC ;;
154 # focal
155 _) echo UBUNTU FOCAL64 VOL_FOCAL FOCAL ;;
156 # jammy
157 _) echo UBUNTU JAMMY64 VOL_JAMMY JAMMY ;;
158 esac
159 fi
160 ###### end Template for 51-multi-boot ######