465a64f51668bf853d3c148cbd1c43172c2c2967
[automated-distro-installer] / fai / config / class / 50-host-classes
1 #!/bin/bash -l
2
3 # assign classes to hosts based on their hostname
4
5 # NOTE:
6 # 51-multi-boot should have something like this
7 # for transient host configs which are not saved in
8 # git (and make it executable):
9
10 # if [[ ! -e /a/bin/fai/fai-wrapper ]]; then
11 # case $HOSTNAME in
12 # frodo) echo STABLE ;;
13 # esac
14 # fi
15
16
17 # do not use this if a menu will be presented
18 [ "$flag_menu" ] && exit 0
19
20
21 # For multi-boot system.
22 # We check that we aren't in a pxe boot environment.
23 # There is probably a better way to do this.
24 # We check the reverse condition in 51-multi-boot,
25 # and set what os we are installing, but don't check it
26 # into git since it changes regularly.
27 # It's code looks like this:
28 # if [[ ! -e /a/bin/fai/fai-wrapper ]]; then
29 # case $HOSTNAME in
30 # tp) DEBIAN STABLE VOL_STABLE STABLE_FREE;;
31 # # add more multi-boot hostnames here
32 # esac
33 # fi
34 #
35 # Each host defines the base distro: UBUNTU or DEBIAN.
36 # the disto version, also the basefile name if we aren't installing debian stable:
37 # STABLE, STRETCH64, XENIAL64, BELENOS64, FLIDAS64
38 # the distro subvol name, we can add as many of these as we want:
39 # VOL_STABLE, VOL_STABLE_BOOTSTRAP, VOL_STRETCH, VOL_XENIAL, VOL_BELENOS, VOL_FLIDAS
40 # Using VOL_STABLE_BOOTSTRAP sets up the install to act like a pxe rom if
41 # grub sets a specific var.
42 # and the class which defines the apt sources files we want,
43 # STABLE_FREE, STABLE_NONFREE, TESTING_FREE, TESTING_NONFREE,
44 # XENIAL_FREE (no XENIAL_NONFREE setup yet), BELENOS, FLIDAS, STABLE_LINODE.
45 # This is a little redundant in some cases, but it keeps things
46 # simpler.
47 #
48 #
49 # Other notable classes:
50 #
51 # REPARTITION: we try to reuse partitions/filesystems to install a new
52 # os into a multi-os system, if we see some basic hueristics, like the
53 # right amount of them. This overrides that.
54 #
55 # PARTITION_PROMPT: If we don't see partitions to reuuse, prompt
56 # to make sure we really want to repartition and use a completely
57 # fresh install. I use this in case our repartition check has
58 # a bug in it, or I accidentally set REPARTITION.
59 #
60 # ROTATIONAL: in a system with ssd and hdd, install to the hdd
61 # instead of the default ssd.
62 #
63 # RAID0: Use raid 0 even if there are >= 4 disks with boot partititions.
64 #
65 #
66 if [[ -e /a/bin/fai/fai-wrapper ]]; then
67 source /a/bin/distro-functions/src/identify-distros
68 if isdebian; then
69 echo "DEBIAN"
70 fi
71 if isdebian-stable; then
72 echo "STABLE"
73 case $HOSTNAME in
74 li|lj) echo "STABLE_LINODE" ;;
75 *)
76 # nonfree repo is not going away any time soon due to
77 # gcc-doc being in nonfree
78 echo "STABLE_NONFREE"
79 ;;
80 esac
81 elif isdebian-testing; then
82 echo "TESTING_NONFREE"
83 fi
84 fi
85
86 echo "FAIBASE"
87
88 echo "PARTITION_PROMPT"
89 #echo REPARTITION
90
91
92 if grep ^52:54:00: /sys/class/net/eth0/address &>/dev/null; then
93 # if our eth0 mac is in the kvm range, we are a vm.
94 echo "VM"
95 fi