fix chboot, add partition options
[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 # 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. Each host needs
27 # to have a class of either DEBIAN + (STABLE or STRETCH64 or STABLE_BOOTSTRAP),
28 # or UBUNTU + XENIAL64.
29 #
30 # Other notable classes:
31 #
32 # REPARTITION: we try to reuse partitions/filesystems to install a new
33 # os into a multi-os system, if we see some basic hueristics, like the
34 # right amount of them. This overrides that.
35 #
36 # PARTITION_PROMPT: If we don't see partitions to reuuse, prompt
37 # to make sure we really want to repartition and use a completely
38 # fresh install. I use this in case our repartition check has
39 # a bug in it, or I accidentally set REPARTITION.
40 #
41 # ROTATIONAL: in a system with ssd and hdd, install to the hdd
42 # instead of the default ssd.
43 #
44 # RAID0: Use raid 0 even if there are >= 4 disks with boot partititions.
45 #
46 # It's shell looks like this:
47 # if [[ ! -e /a/bin/fai/fai-wrapper ]]; then
48 # case $HOSTNAME in
49 # tp) DEBIAN STABLE ;;
50 # # add more multi-boot hostnames here
51 # esac
52 # fi
53 #
54 if [[ -e /a/bin/fai/fai-wrapper ]] && isdebian-stable; then
55 echo "STABLE"
56 fi
57
58 # use a list of classes for our demo machine
59 echo "FAIBASE PARTITION_PROMPT"
60 case $HOSTNAME in
61 frodo|treetowl)
62 echo "DEBIAN_NON_FREE"
63 if [[ -e /a/bin/fai/fai-wrapper ]] && isdebian-stable; then
64 echo "STABLE_NON_FREE"
65 fi
66 ;;
67 lj|lj)
68 echo "LINODESTABLE" ;;
69 esac
70
71 if grep ^52:54:00: /sys/class/net/eth0/address &>/dev/null; then
72 # if our eth0 mac is in the kvm range, we are a vm.
73 echo "VM"
74 fi