#! /bin/bash

# assign classes to hosts

# Most of the classes in $MAINSERVER_* should be self-contained and not
# specific to a given setup.  Use the SERVER_* or CLIENT_* class for
# all setup-specific details.

##
##   Setup A
##   =======
##
##   Mainserver variants (FLAVOR) c.f. wiki documentation:
##
##     The network configuration (cf. 'class/SERVER_A.var') determines
##     if the mainserver acts as gateway to the external network.
##
##     *LVM7_A | *LVM8_A DISKLESS_SERVER  -->  diskless client server
##
##     LVM*_A | RAIDLVM*_A RAID -->  RAID1 (mirroring)
##
##     *BAK_A  -->  Extra backup disk, recommended.  Setups without backup
##                  disk are intended for testing only.
##
##   Example classes that might be added:
##
##     DEVTOOLS   optional development packages
##     EDU        package selection for education
##     GERMAN     localization class
##

## Choose your mainserver setting:
#FLAVOR="LVM7_A"  ## simple setup for testing in a vm
#FLAVOR="LVM6BAK_A"  ## backup disk
#FLAVOR="RAIDLVM7_A RAID"  ## RAID1
#FLAVOR="RAIDLVM6BAK_A RAID"  ## RAID1, backup disk
FLAVOR="LVM8_A DISKLESS_SERVER"  ## simple diskless, default for testing in a VM
#FLAVOR="LVM7BAK_A DISKLESS_SERVER"  ## diskless, backup disk
#FLAVOR="RAIDLVM8_A RAID DISKLESS_SERVER"  ## diskless, RAID1
#FLAVOR="RAIDLVM7BAK_A RAID DISKLESS_SERVER"  ## diskless, RAID1, backup disk

## Setup with graphical user management tool GOsa.  Remove GOSA class if it is not needed:
MAINSERVER_A="$FLAVOR FIREWALL CUPS_SERVER LOG_SERVER PROXY NTP_SERVER DNS_SERVER NFS_SERVER \
MAIL_SERVER LDAP_CLIENT LDAP_SERVER KERBEROS_CLIENT KERBEROS_KDC KDC_LDAP SERVER_A GOSA"

WORKSTATION_A="LVM5_A CUPS_CLIENT LOG_CLIENT LDAP_CLIENT NFS_CLIENT KERBEROS_CLIENT \
CLIENT_A"

# Use a list of classes for your machine:
case $HOSTNAME in
## The following hosts are kept for reference only (FAI project).
## They are not tested and probably do not work with Debian-LAN:
    faiserver)
       echo "FAIBASE DEBIAN DHCPD DEMO FAISERVER" ;;
    demohost|client*)
       echo "FAIBASE DEBIAN DHCPC DEMO" ;;
    xfcehost)
       echo "FAIBASE DEBIAN DHCPC DEMO XORG XFCE" ;;
    gnomehost)
       echo "FAIBASE DEBIAN DHCPC DEMO XORG GNOME" ;;
    atom*)
       echo "FAIBASE DEBIAN DHCPC DEMO" ;;
    bear)
       echo "FAIBASE DEBIAN DHCPC LVM_XEN_SERVER XEN" ;;
    puma)
       echo "FAIBASE DEBIAN DHCPC RAID_XEN_VIRTUAL" ;;
##
## These hosts are part of the Debian-LAN:
##
    gateway)
        echo "FAIBASE DEBIAN DHCPC FIREWALL GATEWAY_A" ;;
    mainserver)
        echo "FAIBASE DEBIAN FAISERVER $MAINSERVER_A" ;;
## For individualizing machines, define the host before the
## general workstation* case and add a specializing class:
#    workstation00)
#        echo "FAIBASE DEBIAN DHCPC $WORKSTATION_A XORG DESKTOP SPECIAL" ;;
## And/or add ROAMING class to cache credentials for off-line use:
#        echo "FAIBASE DEBIAN DHCPC $WORKSTATION_A XORG DESKTOP ROAMING" ;;
    workstation*)
        ## You might want to add some localization class like:
        # echo "FAIBASE DEBIAN DHCPC $WORKSTATION_A XORG DESKTOP GERMAN" ;;
        echo "FAIBASE DEBIAN DHCPC $WORKSTATION_A XORG DESKTOP" ;;
    diskless)
        ## You might want to add some localization class like:
        # echo "DEBIAN $WORKSTATION_A XORG DISKLESS_CLIENT GERMAN"
        ## Add SSHFS_CLIENT if you prefer sshfs for the home directory:
        # echo "DEBIAN $WORKSTATION_A XORG DISKLESS_CLIENT SSHFS_CLIENT"
        echo "DEBIAN $WORKSTATION_A XORG DISKLESS_CLIENT"
        ## skip GRUB_PC below:
        exit 0 ;;
    *)
        ## Unknown machines are installed as roaming workstation by default:
        echo "FAIBASE DEBIAN DHCPC $WORKSTATION_A XORG DESKTOP ROAMING" ;;
esac

ifclass -o I386 AMD64 && echo GRUB_PC
exit 0
