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