fix host-classes to always work outside pxe boot
[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 # use a list of classes for our demo machine
9 echo "FAIBASE DEBIAN"
10 case $HOSTNAME in
11 demohost)
12 echo "DESKTOP" ;;
13 tp|frodo|treetowl|x2)
14 echo "DESKTOP PARTITION_PROMPT"
15 # non-portable way to see that we aren't in a pxe boot environment.
16 if [[ -e /a/bin/fai/fai-wrapper ]]; then
17 # We check the reverse condition in 51-multi-boot,
18 # and set what os we are installing, but don't check it
19 # into git since it changes regularly.
20 if isdebian-stable; then
21 echo "STABLE"
22 fi
23 fi
24 ;;
25 lj)
26 echo "LINODESTABLE PARTITION_PROMPT" ;;
27 li)
28 echo "LINODESTABLE PARTITION_PROMPT" ;;
29 do)
30 echo "STABLE PARTITION_PROMPT" ;;
31 # faiserver)
32 # echo "DEMO FAISERVER" ;;
33 # xfcehost)
34 # echo "DEMO XORG XFCE LVM";;
35 # gnomehost)
36 # echo "DEMO XORG GNOME";;
37 # centos)
38 # echo "FAIBASE CENTOS" # you may want to add class XORG here
39 # ifclass I386 && echo CENTOS6_32 # AFAIK there's no 32bit C7
40 # ifclass AMD64 && echo CENTOS7_64
41 # exit 0 ;; # CentOS does not use the GRUB class
42 # slchost)
43 # # Scientific Linux Cern, is very similar to CentOS. SLC should alsways use the class CENTOS
44 # echo "FAIBASE CENTOS SLC" # you may want to add class XORG here
45 # ifclass I386 && echo SLC7_32
46 # ifclass AMD64 && echo SLC7_64
47 # exit 0 ;; # CentOS/SLC does not use the GRUB class
48 *)
49 echo "DESKTOP" ;;
50 esac
51
52 if grep ^52:54:00: /sys/class/net/eth0/address &>/dev/null; then
53 # if our eth0 mac is in the kvm range, we are a vm.
54 echo "VM"
55 fi