static usb ethnet addresses
[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 # note, this is where this file comes from:
12 # cp /usr/share/keyrings/freesh-archive-keyring.gpg STANDARD.gpg
13
14
15 # For multi-boot system.
16 # We check that we aren't in a pxe boot environment.
17 # There is probably a better way to do this.
18 # We check the reverse condition in 51-multi-boot,
19 # and set what os we are installing, but don't check it
20 # into git since it changes regularly.
21
22 #
23 #
24 # Each host defines following:
25 # The base distro:
26 # UBUNTU or nothing. DEBIAN is always defined as a base.
27 #
28 # The base disto version, only use so far is the basefile name if it exists.
29 # Debian stable basefile gets built by faisetup and gets used otherwise.
30 # With X suffix, means it has gone through the dirinstall process and has eXtra
31 # things installed, to speed up installation.
32 #
33 # STRETCH64, BUSTER64, BULLSEYE64, BOOKWORM64
34 # FLIDAS64, FLIDAS64BIG, ETIONA64, NABIA64, ARAMO64
35 # XENIAL64, BIONIC64, FOCAL64,
36 #
37 # The distro subvol name, we can add as many of these as we want:
38 # VOL_TESTING, VOL_STRETCH, VOL_BUSTER, VOL_BULLSEYE, VOL_BOOKWORM
39 # VOL_FLIDAS, VOL_ETIONA, VOL_NABIA, VOL_ARAMO
40 # VOL_XENIAL, VOL_BIONIC VOL_FOCAL
41 # VOL_BUSTER_BOOTSTRAP.
42 # Using VOL_BUSTER_BOOTSTRAP sets up the install to act like a pxe rom if
43 # grub sets a specific var.
44 #
45 # The apt sources files we want,
46 # STRETCH_FREE, STRETCH_NONFREE, STRETCH_LINODE
47 # BUSTER_FREE, BUSTER_NONFREE,
48 # BULLSEYE_FREE, BULLSEYE_NONFREE
49 # BOOKWORM_FREE, BOOKWORM_NONFREE
50 # TESTING_FREE, TESTING_NONFREE,
51 # XENIAL_FREE, BIONIC, FOCAL, FLIDAS, ETIONA, NABIA, ARAMO.
52 #
53 # It's all a little redundant in some cases, but it keeps things
54 # simpler.
55 #
56 #
57 # Other notable classes:
58 #
59 # INSTALL: for autodiscover iso, this is needed. We could also add it to
60 # the autodiscover grub, but then we have to burn a new iso if we want a
61 # non-install one. It sets the class for the corresponding INSTALL.var,
62 # which sets FAI_ACTION=INSTALL. I'm not sure if this variable overrides
63 # FAI_ACTION outside of autodiscover, todo: test it out, if it doesn't,
64 # make install be default in 51-multi-boot, and disable it if needed.
65 #
66 # DESKTOP: install a bunch of extra packages. For creating X suffix
67 # basefiles. See README.
68 #
69 # LINODE: For running a vm on linode, especially one created with fai-cd.
70 #
71 # IANK / FSF: general setup of my machine vs FSF machines
72 # NABIA_EXTRA: extra repos for NABIA from other distros
73 # ARAMO_EXTRA: extra repos for ARAMO from other distros
74 #
75 # UBUNTU_UP: for trisquel, we want to inherit ubuntu things, except for
76 # some ubuntu things which go in this class. UP = upstream.
77 #
78 # D16: for kgpe-d16 specific settings.
79 #
80 # JAMMY_FIRMWARE: for trisquel install to get nonfree firmware from
81 # ubuntu jammy. The linux-firmware-free package in trisquel conflicts
82 # with the linux-firmware package in ubuntu, but you only find out after
83 # installing due to an error.
84 #
85 # For filesystem/partitioning related classes, see comments at the top of
86 # fai/config/hooks/partition.DEFAULT
87
88 if [[ -e /a/bin/fai/fai-wrapper ]]; then
89 source /a/bin/distro-functions/src/identify-distros
90 if isdeb; then
91 codename=$(debian-codename)
92 echo ${codename^^}
93 distro=$(distro-name)
94 case $distro in
95 debian)
96 echo ${distro^^}
97 # nonfree repo is not going away any time soon due to
98 # gcc-doc being in nonfree
99 echo ${codename^^}_NONFREE
100 ;;
101 trisquel)
102 # easier to stay with fai example config if we just call it ubuntu
103 echo UBUNTU
104 ;;
105 esac
106 fi
107 case $HOSTNAME in
108 li|lj) echo "LINODE" ;;
109 bk|je) echo "NOCRYPT" ;;
110 esac
111 fi
112
113
114 #echo "PARTITION_PROMPT"
115 #echo REPARTITION
116
117
118 if grep ^52:54:00: /sys/class/net/eth0/address &>/dev/null; then
119 # if our eth0 mac is in the kvm range, we are a vm.
120 echo "VM"
121 fi
122
123 exit 0
124 ### Below here is a comment of code, exit above is so it does not get executed ###
125
126 ###### begin Template for 51-multi-boot ######
127 #
128 # It has reasonable combinations of above classes.
129 # We must first replace _ with host name(s).
130
131 #!/bin/bash
132
133 # pick one of these:
134 #echo IANK
135 #echo FSF
136 if [[ ! -e /a/bin/fai/fai-wrapper || $FAI_ACTION == dirinstall ]]; then
137 case $HOSTNAME in
138 # bullseye based minimal recovery / bootstraping os:
139 _) echo BULLSEYE64 VOL_BULLSEYE_BOOTSTRAP BULLSEYE_FREE ;;
140 # flidas
141 _) echo UBUNTU FLIDAS64 VOL_FLIDAS FLIDAS ;;
142 # etiona
143 _) echo UBUNTU ETIONA64 VOL_ETIONA ETIONA ;;
144 # nabia
145 _) echo UBUNTU NABIA64 VOL_NABIA NABIA NABIA_EXTRA ;;
146 # aramo
147 _) echo UBUNTU ARAMO64 VOL_ARAMO ARAMO ARAMO_EXTRA ;;
148 # stretch
149 _) echo STRETCH64 VOL_STRETCH STRETCH_NONFREE ;;
150 # buster
151 _) echo BUSTER64 VOL_BUSTER BUSTER_NONFREE ;;
152 # bullseye
153 _) echo BULLSEYE64 VOL_BULLSEYE BULLSEYE_NONFREE ;;
154 # bookworm
155 _) echo BOOKWORM64 VOL_BOOKWORM BOOKWORM_NONFREE ;;
156 # testing
157 _) echo BOOKWORM64 VOL_TESTING TESTING_NONFREE ;;
158 # xenial
159 _) echo UBUNTU XENIAL64 VOL_XENIAL XENIAL_FREE ;;
160 # bionic
161 _) echo UBUNTU BIONIC64 VOL_BIONIC BIONIC ;;
162 # focal
163 _) echo UBUNTU FOCAL64 VOL_FOCAL FOCAL ;;
164 # jammy
165 _) echo UBUNTU JAMMY64 VOL_JAMMY JAMMY ;;
166 esac
167 fi
168 ###### end Template for 51-multi-boot ######