raid10 replace docs, various fixes
[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 # 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, which is also the basefile name if it exists.
23 # Debian stable basefile gets built by faisetup and gets used otherwise,:
24 # STRETCH64, XENIAL64, BELENOS64, FLIDAS64
25 #
26 # The distro subvol name, we can add as many of these as we want:
27 # VOL_TESTING, VOL_STRETCH, VOL_XENIAL, VOL_BELENOS, VOL_FLIDAS, VOL_STRETCH_BOOTSTRAP
28 # Using VOL_STRETCH_BOOTSTRAP sets up the install to act like a pxe rom if
29 # grub sets a specific var.
30 #
31 # The apt sources files we want,
32 # STRETCH_FREE, STRETCH_NONFREE, TESTING_FREE, TESTING_NONFREE,
33 # XENIAL_FREE, FLIDAS, BELENOS, STRETCH_LINODE.
34 #
35 # It's all a little redundant in some cases, but it keeps things
36 # simpler. Belenos is broken right now, planning to remove it once
37 # flidas is released and rms has upgraded.
38 #
39 #
40 # Other notable classes:
41 #
42 # REPARTITION: we try to reuse partitions/filesystems to install a new
43 # os into a multi-os system, if we see some basic hueristics, like the
44 # right amount of them. This overrides that.
45 #
46 # PARTITION_PROMPT: If we don't see partitions to reuuse, prompt
47 # to make sure we really want to repartition and use a completely
48 # fresh install. I use this in case our repartition check has
49 # a bug in it, or I accidentally set REPARTITION.
50 #
51 # ROTATIONAL: in a system with ssd and hdd, install to the hdd
52 # instead of the default ssd.
53 #
54 # RAID0: Use raid 0 even if there are >= 4 disks with boot partititions.
55 #
56 #
57 # Code in 51-multi-boot, with reasonable combinations of above
58 # uncommented for easier editing, and runs as a noop until
59 # we replace _ with host names.
60 if [[ ! -e /a/bin/fai/fai-wrapper ]]; then
61 case $HOSTNAME in
62 # stretch based minimal recovery / bootstraping os:
63 _) echo DEBIAN STRETCH64 VOL_STRETCH_BOOTSTRAP STRETCH_NONFREE ;;
64 # flidas
65 _) echo UBUNTU FLIDAS64 VOL_FLIDAS FLIDAS ;;
66 # stretch
67 _) echo DEBIAN STRETCH64 VOL_STRETCH STRETCH_NONFREE ;;
68 # testing
69 _) echo DEBIAN STRETCH64 VOL_TESTING TESTING_NONFREE ;;
70 # belenos
71 _) echo UBUNTU BELENOS64 VOL_BELENOS BELENOS ;;
72 # xenial
73 _) echo UBUNTU XENIAL64 VOL_XENIAL XENIAL_FREE ;;
74 esac
75 fi
76
77 if [[ -e /a/bin/fai/fai-wrapper ]]; then
78 source /a/bin/distro-functions/src/identify-distros
79 if isdebian; then
80 echo "DEBIAN"
81 fi
82 if isdebian-stable; then
83 echo "STRETCH"
84 case $HOSTNAME in
85 li|lj) echo "STRETCH_LINODE" ;;
86 *)
87 # nonfree repo is not going away any time soon due to
88 # gcc-doc being in nonfree
89 echo "STRETCH_NONFREE"
90 ;;
91 esac
92 elif isdebian-testing; then
93 echo "TESTING_NONFREE"
94 fi
95 fi
96
97 echo "FAIBASE"
98
99 echo "PARTITION_PROMPT"
100 #echo REPARTITION
101
102
103 if grep ^52:54:00: /sys/class/net/eth0/address &>/dev/null; then
104 # if our eth0 mac is in the kvm range, we are a vm.
105 echo "VM"
106 fi