aboutsummaryrefslogtreecommitdiff
path: root/fai/config/class
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2019-09-19 22:38:13 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2019-09-19 22:42:12 +0200
commit6ecb19ada66d54cc0afeb3d27d89700473cde70a (patch)
treea3b57044b04aad7613757aa96697f4afa89c1b85 /fai/config/class
downloaddebian-edu-fai+itzks-6ecb19ada66d54cc0afeb3d27d89700473cde70a.tar.gz
debian-edu-fai+itzks-6ecb19ada66d54cc0afeb3d27d89700473cde70a.tar.bz2
debian-edu-fai+itzks-6ecb19ada66d54cc0afeb3d27d89700473cde70a.zip
initial draft of getting FAI install a Debian Edu system (profile: Minimal)
Diffstat (limited to 'fai/config/class')
-rwxr-xr-xfai/config/class/01-classes8
-rwxr-xr-xfai/config/class/10-base-classes21
-rwxr-xr-xfai/config/class/20-hwdetect.sh35
-rwxr-xr-xfai/config/class/40-parse-profiles.sh165
-rwxr-xr-xfai/config/class/41-warning.sh28
-rwxr-xr-xfai/config/class/50-host-classes13
-rwxr-xr-xfai/config/class/60-misc9
-rwxr-xr-xfai/config/class/70-itzks3
-rw-r--r--fai/config/class/DEBIAN.var19
-rw-r--r--fai/config/class/FAIBASE.var22
-rw-r--r--fai/config/class/GERMAN.var3
-rw-r--r--fai/config/class/INSTALL.var1
-rw-r--r--fai/config/class/INVENTORY.var1
-rw-r--r--fai/config/class/SYSINFO.var1
-rw-r--r--fai/config/class/debian-edu.profile40
15 files changed, 369 insertions, 0 deletions
diff --git a/fai/config/class/01-classes b/fai/config/class/01-classes
new file mode 100755
index 0000000..a435e05
--- /dev/null
+++ b/fai/config/class/01-classes
@@ -0,0 +1,8 @@
+#! /bin/bash
+
+[ "$cmdlineclasses" ] || exit 0
+
+# define the classes given on the cmdline (using -c) very early
+echo $cmdlineclasses
+
+exit 0
diff --git a/fai/config/class/10-base-classes b/fai/config/class/10-base-classes
new file mode 100755
index 0000000..3d03c8f
--- /dev/null
+++ b/fai/config/class/10-base-classes
@@ -0,0 +1,21 @@
+#! /bin/bash
+
+# do only execute if this is called on the client being installed. Do not use during fai-diskimage
+if [ X$FAI_ACTION = Xinstall -a $do_init_tasks -eq 0 ]; then
+ exit 0
+fi
+
+# Echo architecture and OS name in uppercase. Do NOT remove these two lines.
+uname -s | tr '[:lower:]' '[:upper:]'
+[ -x "`which dpkg`" ] && dpkg --print-architecture | tr a-z A-Z
+
+# determin if we are a DHCP client or not
+# count the : chars in the argument of ip=
+n="${ip//[^:]}"
+if [[ $ip =~ ^(on|any|dhcp)$ ]]; then
+ echo DHCPC
+elif [ ${#n} -lt 6 ]; then
+ echo DHCPC
+fi
+
+exit 0
diff --git a/fai/config/class/20-hwdetect.sh b/fai/config/class/20-hwdetect.sh
new file mode 100755
index 0000000..8ba48d4
--- /dev/null
+++ b/fai/config/class/20-hwdetect.sh
@@ -0,0 +1,35 @@
+#! /bin/bash
+
+# (c) Thomas Lange, 2002-2013, lange@informatik.uni-koeln.de
+
+# NOTE: Files named *.sh will be evaluated, but their output ignored.
+
+[ $do_init_tasks -eq 1 ] || return 0 # Do only execute when doing install
+
+echo 0 > /proc/sys/kernel/printk
+
+#kernelmodules=
+# here, you can load modules depending on the kernel version
+case $(uname -r) in
+ 2.6*) kernelmodules="$kernelmodules mptspi dm-mod md-mod aes dm-crypt" ;;
+ [3456]*) kernelmodules="$kernelmodules mptspi dm-mod md-mod aes dm-crypt" ;;
+esac
+
+for mod in $kernelmodules; do
+ [ X$verbose = X1 ] && echo Loading kernel module $mod
+ modprobe -a $mod 1>/dev/null 2>&1
+done
+
+ip ad show up | egrep -iv 'loopback|127.0.0.1|::1/128|_lft'
+
+echo $printk > /proc/sys/kernel/printk
+
+odisklist=$disklist
+set_disk_info # recalculate list of available disks
+if [ "$disklist" != "$odisklist" ]; then
+ echo New disklist: $disklist
+ echo disklist=\"$disklist\" >> $LOGDIR/additional.var
+fi
+
+save_dmesg # save new boot messages (from loading modules)
+
diff --git a/fai/config/class/40-parse-profiles.sh b/fai/config/class/40-parse-profiles.sh
new file mode 100755
index 0000000..c80cf7a
--- /dev/null
+++ b/fai/config/class/40-parse-profiles.sh
@@ -0,0 +1,165 @@
+#! /bin/bash
+
+# parse *.profile and build a curses menu, so the user can select a profile
+#
+# (c) 2015 by Thomas Lange, lange@informatik.uni-koeln.de
+# Universitaet zu Koeln
+
+if [ X$FAI_ACTION = Xinstall -o X$FAI_ACTION = Xdirinstall -o X$FAI_ACTION = X ]; then
+ :
+else
+ return 0
+fi
+
+[ "$flag_menu" ] || return 0
+
+out=$(tty)
+tempfile=`(tempfile) 2>/dev/null`
+tempfile2=`(tempfile) 2>/dev/null`
+trap "rm -f $tempfile $tempfile2" EXIT INT QUIT
+
+# declare the data structure, use associative arrays
+declare -A arshort
+declare -A ardesc
+declare -A arlong
+declare -A arclasses
+declare -a list
+
+
+parse_profile() {
+
+ # read a profile and add all info to the data structure
+
+ local short
+ local long
+ local desc
+ local name
+ local classes
+ local lflag=0
+
+ # disable word splitting when reading a line, this helps reading a keyword without a value
+ local OIF=$IFS
+ IFS=
+
+ while read -r line || [[ -n $line ]]; do
+
+ if [[ $line =~ "Name: " ]]; then
+ if [ -n "$long" ]; then
+ arlong[$name]="$long"
+ fi
+ short=
+ desc=
+ long=
+ classes=
+ lflag=0
+ name=${line##Name: }
+ [ $debug ] && echo "XX NAME $name found"
+ list+=("$name") # add new item to list
+ continue
+ fi
+
+ if [[ $line =~ "Description: " ]]; then
+ lflag=0
+ desc=${line##Description: }
+ [ $debug ] && echo "XX $desc found"
+ ardesc[$name]="$desc"
+ continue
+ fi
+
+ if [[ $line =~ "Short: " ]]; then
+ lflag=0
+ short=${line##Short: }
+ [ $debug ] && echo "XX $short found"
+ arshort[$name]="$short"
+ continue
+ fi
+
+ if [[ $line =~ "Classes: " ]]; then
+ lflag=0
+ classes=${line##Classes: }
+ [ $debug ] && echo "XX classes found"
+ arclasses[$name]="$classes"
+ continue
+ fi
+
+ if [[ $line =~ "Long: " ]]; then
+ lflag=1
+ long=${line##Long: }
+ [ $debug ] && echo "XX long found"
+
+ # else it's another long line
+ elif [ $lflag -eq 1 ]; then
+ long+="\n$line"
+ fi
+
+ if [[ $line =~ "Default: " ]]; then
+ lflag=0
+ default=${line##Default: }
+ continue
+ fi
+
+ done < $1
+
+ if [ -n "$long" ]; then
+ arlong[$name]="$long"
+ fi
+ IFS=$OIF
+}
+
+prtresult() {
+
+ # set newclasses which is used by fai-class(1)
+ local res=$(<$tempfile)
+ echo "$BASH_SOURCE defined new classes: ${arclasses[$res]}"
+ newclasses="${arclasses[$res]}"
+}
+
+
+# read all files with name matching *.profile
+_parsed=0
+shopt -s nullglob
+for _f in *.profile; do
+ parse_profile $_f
+ _parsed=1
+done
+unset _f
+
+# do nothing if no profile was read
+if [ $_parsed -eq 0 ]; then
+ unset _parsed
+ return 0
+fi
+
+# create the argument list containing the menu entries
+# and the help text file
+for i in "${list[@]}"; do
+ par+=("$i")
+ par+=("${ardesc[${i}]}")
+ par+=("${arshort[${i}]}")
+ echo "Name: ${i}" >> $tempfile2
+ echo -e ${arlong[${i}]} >> $tempfile2
+ echo -e "Classes: " ${arclasses[${i}]} "\n" >> $tempfile2
+done
+unset i
+
+while true; do
+
+ dialog --clear --item-help --title "FAI - Fully Automatic Installation" --help-button \
+ --default-item "$default" \
+ --menu "\nSelect your FAI profile\n\nThe profile will define a list of classes,\nwhich are used by FAI.\n\n\n"\
+ 15 70 0 "${par[@]}" 2> $tempfile 1> $out
+
+ _retval=$?
+ case $_retval in
+ 0)
+ prtresult
+ break ;;
+ 1)
+ echo "No profile selected."
+ break ;;
+ 2)
+ dialog --title "Description of all profiles" --textbox $tempfile2 0 0 1> $out;;
+ esac
+
+done
+unset par ardesc arshort arlong arclasses list tempfile tempfile2 _parsed _retval line
diff --git a/fai/config/class/41-warning.sh b/fai/config/class/41-warning.sh
new file mode 100755
index 0000000..e9f9ec5
--- /dev/null
+++ b/fai/config/class/41-warning.sh
@@ -0,0 +1,28 @@
+#! /bin/bash
+
+if [ X$FAI_ACTION = Xinstall -o X$FAI_ACTION = X ]; then
+ :
+else
+ return 0
+fi
+if [ X$action = Xdirinstall ]; then
+ return 0
+fi
+
+grep -q INSTALL $LOGDIR/FAI_CLASSES || return 0
+[ "$flag_menu" ] || return 0
+
+out=$(tty)
+red=$(mktemp)
+echo 'screen_color = (CYAN,RED,ON)' > $red
+
+DIALOGRC=$red dialog --colors --clear --aspect 6 --title "FAI - Fully Automatic Installation" --trim \
+ --msgbox "\n\n If you continue, \n all your data on the disk \n \n|\Zr\Z1 WILL BE DESTROYED \Z0\Zn|\n\n" 0 0 1>$out
+
+# stop on any error, or if ESC was hit
+if [ $? -ne 0 ]; then
+ task_error 999
+fi
+
+rm $red
+unset red
diff --git a/fai/config/class/50-host-classes b/fai/config/class/50-host-classes
new file mode 100755
index 0000000..3c3765d
--- /dev/null
+++ b/fai/config/class/50-host-classes
@@ -0,0 +1,13 @@
+#! /bin/bash
+
+# assign classes to hosts based on their hostname
+
+# do not use this if a menu will be presented
+[ "$flag_menu" ] && exit 0
+
+# use a list of classes for our demo machine
+case $HOSTNAME in
+ *)
+# echo "FAIBASE DEBIAN EDU WORKSTATION XORG MATE LVM" ;;
+ echo "FAIBASE DEBIAN EDU LVM" ;;
+esac
diff --git a/fai/config/class/60-misc b/fai/config/class/60-misc
new file mode 100755
index 0000000..01eb252
--- /dev/null
+++ b/fai/config/class/60-misc
@@ -0,0 +1,9 @@
+#! /bin/bash
+
+ifclass -o GRUB_PC GRUB_EFI && exit 0
+
+if [ -d /sys/firmware/efi ]; then
+ echo GRUB_EFI
+elif ifclass -o I386 AMD64 ; then
+ echo GRUB_PC
+fi
diff --git a/fai/config/class/70-itzks b/fai/config/class/70-itzks
new file mode 100755
index 0000000..9c0caa7
--- /dev/null
+++ b/fai/config/class/70-itzks
@@ -0,0 +1,3 @@
+#! /bin/bash
+
+echo ITZKS GERMAN
diff --git a/fai/config/class/DEBIAN.var b/fai/config/class/DEBIAN.var
new file mode 100644
index 0000000..eea3103
--- /dev/null
+++ b/fai/config/class/DEBIAN.var
@@ -0,0 +1,19 @@
+release=buster
+apt_cdn=http://deb.debian.org
+security_cdn=http://security.debian.org
+
+CONSOLEFONT=
+KEYMAP=us-latin1
+
+# MODULESLIST contains modules that will be loaded by the new system,
+# not during installation these modules will be written to /etc/modules
+# If you need a module during installation, add it to $kernelmodules
+# in 20-hwdetect.sh.
+MODULESLIST="usbhid psmouse"
+
+# if you have enough RAM (>2GB) you may want to enable this line. It
+# also puts /var/cache into a ramdisk.
+#FAI_RAMDISKS="$target/var/lib/dpkg $target/var/cache"
+
+# if you want to use the faiserver as APT proxy
+APTPROXY=http://faiserver:3142
diff --git a/fai/config/class/FAIBASE.var b/fai/config/class/FAIBASE.var
new file mode 100644
index 0000000..3112039
--- /dev/null
+++ b/fai/config/class/FAIBASE.var
@@ -0,0 +1,22 @@
+# default values for installation. You can override them in your *.var files
+
+# allow installation of packages from unsigned repositories
+FAI_ALLOW_UNSIGNED=1
+
+# Set UTC=yes if your system clock is set to UTC (GMT), and UTC=no if not.
+UTC=yes
+TIMEZONE=Europe/Berlin
+
+# the hash of the root password for the new installed linux system
+# pw is "fai"
+ROOTPW='$1$kBnWcO.E$djxB128U7dMkrltJHPf6d1'
+
+# errors in tasks greater than this value will cause the installation to stop
+STOP_ON_ERROR=700
+
+# set parameter for install_packages(8)
+MAXPACKAGES=800
+
+# a user account will be created
+username=demo
+USERPW='$1$kBnWcO.E$djxB128U7dMkrltJHPf6d1'
diff --git a/fai/config/class/GERMAN.var b/fai/config/class/GERMAN.var
new file mode 100644
index 0000000..8638a75
--- /dev/null
+++ b/fai/config/class/GERMAN.var
@@ -0,0 +1,3 @@
+# german environment (for Debian)
+KEYMAP=de-latin1-nodeadkeys
+
diff --git a/fai/config/class/INSTALL.var b/fai/config/class/INSTALL.var
new file mode 100644
index 0000000..f0c4cbd
--- /dev/null
+++ b/fai/config/class/INSTALL.var
@@ -0,0 +1 @@
+FAI_ACTION=install
diff --git a/fai/config/class/INVENTORY.var b/fai/config/class/INVENTORY.var
new file mode 100644
index 0000000..6afe995
--- /dev/null
+++ b/fai/config/class/INVENTORY.var
@@ -0,0 +1 @@
+FAI_ACTION=inventory
diff --git a/fai/config/class/SYSINFO.var b/fai/config/class/SYSINFO.var
new file mode 100644
index 0000000..617b88d
--- /dev/null
+++ b/fai/config/class/SYSINFO.var
@@ -0,0 +1 @@
+FAI_ACTION=sysinfo
diff --git a/fai/config/class/debian-edu.profile b/fai/config/class/debian-edu.profile
new file mode 100644
index 0000000..0e11891
--- /dev/null
+++ b/fai/config/class/debian-edu.profile
@@ -0,0 +1,40 @@
+Default: Edu/MATE
+
+Name: Edu/Minimal
+Description: Minimal Debian Edu installation via FAI
+Short: Installs a Debian Edu client system, text console only
+Long: Installs a Debian Edu client system, text console only.
+Use this installation profile for server-like systems that don't
+need a graphical login.
+Classes: INSTALL FAIBASE DEBIAN EDU
+
+Name: Edu/MATE
+Description: Debian Edu workstation, powered by Mate Desktop
+Short: Debian Edu workstation with Mate desktop will be installed
+Long: Debian Edu workstation with Mate desktop will be installed.
+Classes: INSTALL FAIBASE DEBIAN EDU WORKSTATION XORG MATE LVM
+
+Name: Edu/GNOME
+Description: Debian Edu workstation, powered by Gnome Desktop
+Short: Debian Edu workstation with Gnome desktop will be installed
+Long: Debian Edu workstation with Gnome desktop will be installed.
+Classes: INSTALL FAIBASE DEBIAN EDU WORKSTATION XORG GNOME LVM
+
+Name: Edu/GNOME
+Description: Debian Edu workstation, powered by Xfce Desktop
+Short: Debian Edu workstation with Xfce desktop will be installed
+Long: Debian Edu workstation with Xfce desktop will be installed.
+Classes: INSTALL FAIBASE DEBIAN EDU WORKSTATION XORG XFCE LVM
+
+Name: Inventory
+Description: Show hardware info
+Short: Show some basic hardware infos
+Long: Execute commands for showing hardware info
+Classes: INVENTORY
+
+Name: Sysinfo
+Description: Show detailed system information
+Short: Show detailed hardware and system information
+Long: Execute a lot of commands for collecting system information
+Classes: SYSINFO
+