Initial commit

pull/1/head
rockstable 2022-12-06 15:26:21 +01:00
commit 4406155089
115 changed files with 3512 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*.sw[a-z]

336
basefiles/mk-basefile Executable file
View File

@ -0,0 +1,336 @@
#! /bin/bash
# mk-basefile, create basefiles for some distributions
#
# Thomas Lange, Uni Koeln, 2011-2022
# based on the Makefile implementation of Michael Goetze
#
# Usage example: mk-basefile -J STRETCH64
# This will create a STRETCH64.tar.xz basefile.
# Supported distributions (each i386/amd64):
# Debian GNU/Linux
# Ubuntu 14.04/16.04/20.04/22.04
# Rocky Linux 8
# CentOS 5/6/7/8
# Scientific Linux Cern 5/6
#
# Packages you might want to install to use this command:
# debootstrap, rinse, xz-utils
# Define your local mirros here
# For the first stage, set the CentOS/SLC mirror in /etc/rinse/rinse.conf
MIRROR_DEBIAN=http://deb.debian.org/debian/
MIRROR_UBUNTU=http://mirror.netcologne.de/ubuntu/
MIRROR_CENTOS=http://mirror.netcologne.de/
EXCLUDE_SQUEEZE=isc-dhcp-client,isc-dhcp-common,info
EXCLUDE_WHEEZY=info
EXCLUDE_JESSIE=info
EXCLUDE_STRETCH=info
EXCLUDE_BUSTER=
EXCLUDE_BULLSEYE=
EXCLUDE_BOOKWORM=
EXCLUDE_TRIXIE=
EXCLUDE_FORKY=
EXCLUDE_SID=
EXCLUDE_TRUSTY=dhcp3-client,dhcp3-common,info
EXCLUDE_XENIAL=udhcpc,dibbler-client,info
EXCLUDE_BIONIC=udhcpc,dibbler-client,info
EXCLUDE_FOCAL=udhcpc,dibbler-client,info
EXCLUDE_JAMMY=udhcpc,dibbler-client,info
# here you can add packages, that are needed very early
INCLUDE_DEBIAN=
setarch() {
l32=
if [ X$1 = Xi386 ]; then
l32=linux32
fi
}
check() {
if [ $(id -u) != 0 ]; then
echo "You must be root to create chroots."
exit 1
fi
mknod $xtmp/test-dev-null c 1 3
if [ $? -eq 1 ]; then
echo "Cannot create device files on $xtmp, aborting."
echo "Perhaps this directory is mounted with option nodev."
rm -rf $xtmp
exit 1
fi
echo test > $xtmp/test-dev-null
if [ $? -eq 1 ]; then
echo "Cannot create device files on $xtmp, aborting."
echo "Perhaps this directory is mounted with option nodev."
rm -rf $xtmp
exit 1
fi
rm -f $xtmp/test-dev-null
}
mkpost-centos() {
# set local mirror for rinse post script
[ -z "$MIRROR_CENTOS" ] && return
cat <<EOM > $xtmp/post
#! /bin/sh
mkdir -p $xtmp/etc/yum.repos.d/orig
cp -p $xtmp/etc/yum.repos.d/*.repo $xtmp/etc/yum.repos.d/orig
perl -pi -e 's,mirrorlist=,#mirrorlist=,; s,#baseurl=http://mirror.centos.org,baseurl=$MIRROR_CENTOS,;' $xtmp/etc/yum.repos.d/CentOS-Base.repo
EOM
chmod 555 $xtmp/post
}
mkpost-slc() {
# set local mirror for rinse post script
ver=$1
[ -z "$MIRROR_SLC" ] && return
cat <<EOM > $xtmp/post
#! /bin/sh
mkdir -p $xtmp/etc/yum.repos.d/orig
cp -p $xtmp/etc/yum.repos.d/*.repo $xtmp/etc/yum.repos.d/orig
perl -pi -e 's,baseurl=http://linuxsoft.cern.ch,baseurl=$MIRROR_SLC,;' $xtmp/etc/yum.repos.d/slc$ver-os.repo
perl -pi -e 's,baseurl=http://linuxsoft.cern.ch,baseurl=$MIRROR_SLC,;' $xtmp/etc/yum.repos.d/slc$ver-updates.repo
EOM
chmod 555 $xtmp/post
}
cleanup-deb() {
chroot $xtmp apt-get clean
rm -f $xtmp/etc/hostname $xtmp/etc/resolv.conf \
$xtmp/var/lib/apt/lists/*_* $xtmp/usr/bin/qemu-*-static \
$xtmp/etc/udev/rules.d/70-persistent-net.rules \
$xtmp/var/lib/dbus/machine-id
> $xtmp/etc/machine-id
}
cleanup-rinse() {
# check if chroot works
echo "Installed packages in chroot:"
chroot $xtmp rpm -qa|sort
echo -n "CHROOT rpm -qa: "
chroot $xtmp rpm -qa|wc -l
rm -f $xtmp/etc/resolv.conf $xtmp/post
if [ -d $xtmp/etc/yum.repos.d/orig ]; then
mv $xtmp/etc/yum.repos.d/orig/* $xtmp/etc/yum.repos.d/
rm -rf $xtmp/etc/yum.repos.d/orig
fi
}
tarit() {
tar $attributes --numeric-owner --one-file-system -C $xtmp -cf - . | $zip > $target.$ext
}
rocky() {
local arch=$1
local vers=$2
local domain=$(domainname)
check
setarch $arch
# mkpost-centos
$l32 rinse --directory $xtmp --distribution rocky-$vers --arch $arch --before-post-install $xtmp/post
domainname $domain # workaround for #613377
cleanup-rinse
tarit
}
centos() {
local arch=$1
local vers=$2
local domain=$(domainname)
check
setarch $arch
mkpost-centos
$l32 rinse --directory $xtmp --distribution centos-$vers --arch $arch --before-post-install $xtmp/post
domainname $domain # workaround for #613377
cleanup-rinse
tarit
}
slc() {
local arch=$1
local vers=$2
check
setarch $arch
mkpost-slc $vers
$l32 rinse --directory $xtmp --distribution slc-$vers --arch $arch --before-post-install $xtmp/post
cleanup-rinse
tarit
}
debgeneric() {
local DIST=$1
shift
local mirror=$1
shift
local arch=$1
dist=${DIST%%[0-9][0-9]}
local exc="EXCLUDE_$dist"
[ -n "${!exc}" ] && exc="--exclude=${!exc}" || unset exc
dist=${dist,,}
check
if [ -n "$INCLUDE_DEBIAN" ]; then
local inc="--include=$INCLUDE_DEBIAN"
fi
if [ -n "$arch" ]; then
qemu-debootstrap --arch $arch ${exc} $inc $dist $xtmp $mirror
target="${target}_${arch^^}"
else
if [[ $DIST =~ 64 ]]; then
arch=amd64
else
arch=i386
fi
debootstrap --arch $arch ${exc} $inc $dist $xtmp $mirror
fi
cleanup-deb
tarit
}
prtdists() {
echo "Available:
ROCKY8_64
CENTOS5_32 CENTOS5_64
CENTOS6_32 CENTOS6_64
CENTOS7_32 CENTOS7_64
CENTOS8_64
SLC5_32 SLC5_64
SLC6_32 SLC6_64
SLC7_64
TRUSTY32 TRUSTY64
XENIAL32 XENIAL64
BIONIC64
FOCAL64
JAMMY64
SQUEEZE32 SQUEEZE64
WHEEZY32 WHEEZY64
JESSIE32 JESSIE64
STRETCH32 STRETCH64
BUSTER32 BUSTER64
BULLSEYE32 BULLSEYE64
BOOKWORM32 BOOKWORM64
TRIXIE32 TRIXIE64
FORKY32 FORKY64
SID32 SID64
"
}
usage() {
cat <<EOF
mk-basefile, create minimal base files for a Linux distritubtion
Copyright (C) 2011-2022 by Thomas Lange
Usage: mk-basefile [OPTION] ... DISTRIBUTION
-s Show list of supported linux distributions
-f ARCH Build for foreign architecture ARCH.
-d DIR Use DIR for creating the temporary subtree structure.
-z Use zstd for compressing the tar file.
-J Use xz for compressing the tar file.
-k Keep the temporary subtree structure, do not remove it.
-h Print help.
Usage example: mk-basefile -J STRETCH64
This will create a STRETCH64.tar.xz basefile.
EOF
exit 0
}
# main routine
ext=tar
zip=cat
attributes=
cleanup=1
attributes="--xattrs --selinux --acls"
while getopts ashzJd:kf: opt ; do
case "$opt" in
a) echo "$0: Warning. -a is ignored, because xtattrs, acls and selinux are always added." ;;
d) export TMPDIR=$OPTARG ;;
f) export ARCH=$OPTARG ;;
z) zip="zstd -9"; ext=tar.zst ;;
J) zip="xz -8" ext=tar.xz ;;
k) cleanup=0 ;;
h) usage ;;
s) prtdists ; exit 0;;
?) exit 3 ;; # error in option parsing
esac
done
shift $((OPTIND - 1))
xtmp=$(mktemp --tmpdir -d basefiles.XXXXXXXX)
if [ $? -eq 1 ]; then
echo "mktemp failed. Aborting."
exit 2
fi
chmod 755 $xtmp
target=$1 # also the name of the output file
[ -z "$target" ] && usage
case "$target" in
CENTOS5_32) centos i386 5 ;;
CENTOS5_64) centos amd64 5 ;;
CENTOS6_32) centos i386 6 ;;
CENTOS6_64) centos amd64 6 ;;
CENTOS7_32) centos i386 7 ;;
CENTOS7_64) centos amd64 7 ;;
CENTOS8_64) centos amd64 8 ;;
ROCKY8_64) rocky amd64 8 ;;
SLC5_32) slc i386 5 ;;
SLC5_64) slc amd64 5 ;;
SLC6_32) slc i386 6 ;;
SLC6_64) slc amd64 6 ;;
SLC7_64) slc amd64 7 ;;
TRUSTY*|XENIAL*|BIONIC*|FOCAL*|JAMMY*)
debgeneric $target $MIRROR_UBUNTU ;;
SQUEEZE*|WHEEZY*|JESSIE*|STRETCH*|BUSTER*|BULLSEYE*|BOOKWORM*|TRIXIE*|SID*)
debgeneric $target $MIRROR_DEBIAN $ARCH;;
*) echo "Unknown distribution. Aborting."
prtdists
exit 99 ;;
esac
# cleanup
if [ $cleanup -eq 1 ]; then
rm -rf $xtmp
fi

79
class/00-menu.profile Normal file
View File

@ -0,0 +1,79 @@
Default: HW4F Desktop
Name: HW4F Desktop
Description: Desktop installation for Hardware for Future
Short: HW4F
Long: Ubuntu 20.04 LTS (Focal Fossa) desktop installation
Login: user, Password: dezentrale, Login: root, Password: dezentrale
Classes: INSTALL HW4F_DESKTOP HW4F_DESKTOP_LAST UBUNTU GERMAN
Name: Secure erase SSD
Description: Run a secure erase for SSD
Short: Secure erase
Long: Run a secure erase on SSD
Classes: SECURE_ERASE
Name: Ubuntu
Description: Ubuntu
Short: Ubuntu
Long: Ubuntu 20.04 LTS (Focal Fossa)
Classes: INSTALL UBUNTU
Name: Minimalist debian
Description: Minimal debian installation
Short: Simple debian
Long: Simple debian without additional packages
Classes: DEBIAN
Name: Debian Desktop with Cinnamon
Description: Xfce desktop, LVM partitioning
Short: A fancy Xfce desktop will be installed, the user account is demo
Long: This is the Xfce desktop example. Additional account called
demo with password: fai, root password: fai
All needed packages are already on the CD or USB stick.
Classes: INSTALL DEBIAN CINNAMON
Name: Xfce
Description: Xfce desktop, LVM partitioning
Short: A fancy Xfce desktop will be installed, the user account is demo
Long: This is the Xfce desktop example. Additional account called
demo with password: fai, root password: fai
All needed packages are already on the CD or USB stick.
Classes: INSTALL FAIBASE DEBIAN DEMO XORG XFCE LVM
Name: Gnome
Description: Gnome desktop installation
Short: A Gnome desktop, no LVM, You will get an account called demo
Long: This is the Gnome desktop example. Additional account called
demo with password: fai, root password: fai
You should have a fast network connection, because most packages are
downloaded from the internet.
Classes: INSTALL FAIBASE DEBIAN DEMO XORG GNOME
Name: CentOS 8
Description: CentOS 8 with Xfce desktop
Short: A normal Xfce desktop, running CentOS 8
Long: We use the Debian nfsroot for installing the CentOS 8 OS.
You should have a fast network connection, because most packages are
downloaded from the internet.
Classes: INSTALL FAIBASE CENTOS CENTOS8_64 XORG
Name: Ubuntu
Description: Ubuntu 20.04 LTS desktop installation
Short: Unity desktop
Long: We use the Debian nfsroot for installing the Ubuntu OS.
You should have a fast network connection, because most packages are
downloaded from the internet.
Classes: INSTALL FAIBASE DEMO DEBIAN UBUNTU FOCAL FOCAL64 XORG
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 defailed system information
Short: Show detailed hardware and system information
Long: Execute a lot of commands for collecting system information
Classes: SYSINFO

8
class/01-classes Executable file
View File

@ -0,0 +1,8 @@
#! /bin/bash
[ "$cmdlineclasses" ] || exit 0
# define the classes given on the cmdline (using -c) very early
echo $cmdlineclasses
exit 0

21
class/10-base-classes Executable file
View File

@ -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:]'
command -v dpkg >&/dev/null && 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

35
class/20-hwdetect.sh Executable file
View File

@ -0,0 +1,35 @@
#! /bin/bash
# (c) Thomas Lange, 2002-2013, lange@cs.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
# example how to 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
# show the basic information about the network interface
ip -br li show up|egrep -v ^lo; ip -br a show up|egrep -v ^lo
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)

165
class/40-parse-profiles.sh Executable file
View File

@ -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@cs.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=$(mktemp)
tempfile2=$(mktemp)
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

28
class/41-warning.sh Executable file
View File

@ -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

26
class/50-host-classes Executable file
View File

@ -0,0 +1,26 @@
#! /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
faiserver)
echo "FAIBASE DEBIAN DEMO FAISERVER" ;;
demohost|client*)
echo "FAIBASE DEBIAN DEMO" ;;
xfcehost)
echo "FAIBASE DEBIAN DEMO XORG XFCE LVM";;
gnomehost)
echo "FAIBASE DEBIAN DEMO XORG GNOME";;
ubuntuhost)
echo "FAIBASE DEBIAN DEMO UBUNTU JAMMY JAMMY64 XORG";;
rocky)
echo "FAIBASE ROCKY" # you may want to add class XORG here
ifclass AMD64 && echo ROCKY8_64
;;
*)
echo "FAIBASE DEBIAN DEMO" ;;
esac

11
class/60-misc Executable file
View File

@ -0,0 +1,11 @@
#! /bin/bash
ifclass -o CENTOS ROCKY && exit 0
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

14
class/85-efi-classes Executable file
View File

@ -0,0 +1,14 @@
#! /bin/bash
# define classes for disk_config in an EFI environment
if [ ! -d /sys/firmware/efi ] || ifclass GRUB_PC; then
exit 0
fi
for c in CLOUD LVM FAISERVER FAIBASE HW4F_DESKTOP; do
if ifclass $c; then
echo ${c}_EFI
break
fi
done

1
class/CLOUD.var Normal file
View File

@ -0,0 +1 @@
NIC1=eth0

26
class/DEBIAN.var Normal file
View File

@ -0,0 +1,26 @@
release=bullseye
apt_cdn=http://deb.debian.org
security_cdn=http://security.debian.org
# since bullseye Debian changed the suite name for security
if [ $release = buster ]; then
secsuite=buster/updates
else
secsuite=$release-security
fi
CONSOLEFONT=
KEYMAP=de-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

29
class/FAIBASE.var Normal file
View File

@ -0,0 +1,29 @@
# 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
# Account on the FAI server for saving log files and calling fai-chboot.
# Remove the hash character in the next line to activate this feature
#LOGUSER=fai
# a user account will be created
username=demo
USERPW='$1$kBnWcO.E$djxB128U7dMkrltJHPf6d1'
# set a default
FAI_DEBOOTSTRAP="bullseye http://deb.debian.org/debian"

3
class/GERMAN.var Normal file
View File

@ -0,0 +1,3 @@
# german environment (for Debian)
KEYMAP=de-latin1-nodeadkeys

15
class/HW4F_DESKTOP.var Normal file
View File

@ -0,0 +1,15 @@
# set time
UTC=yes
TIMEZONE=Europe/Berlin
# some install parameters
STOP_ON_ERROR=700
MAXPACKAGES=800
KEYMAP=de-latin1-nodeadkeys
# start user and password
username=user
USERPW='$5$n4TiokMaqws2PC/i$eqDh77it8N/haBU6OeE6WqbBjI0E1IUczp2EJ7Tr4J/'
SUPRESS_GNOME_INITIAL_SCREEN=1

1
class/INSTALL.var Normal file
View File

@ -0,0 +1 @@
FAI_ACTION=install

1
class/INVENTORY.var Normal file
View File

@ -0,0 +1 @@
FAI_ACTION=inventory

9
class/ROCKY.var Normal file
View File

@ -0,0 +1,9 @@
CONSOLEFONT=lat9v-16
KEYMAP=us
DEFAULTLOCALE=en_US.UTF-8
SUPPORTEDLOCALE=en_US.UTF-8:en_US:en
# if you install much software and have only few RAM, use the RAM disk
# not for var/cache/yum
#FAI_RAMDISKS="$target/var/lib/rpm $target/var/cache/yum"
FAI_RAMDISKS="$target/var/lib/rpm"

1
class/SYSINFO.var Normal file
View File

@ -0,0 +1 @@
FAI_ACTION=sysinfo

2
class/UBUNTU.var Normal file
View File

@ -0,0 +1,2 @@
ubuntumirror=http://archive.ubuntu.com
ubuntudist=jammy

54
class/example.profile Normal file
View File

@ -0,0 +1,54 @@
Default: Xfce
Name: Simple
Description: My first FAI installation
Short: just a very simple example, no xorg, an account called demo
Long: This is the demohost example of FAI.
Additional account called demo with password: fai, root password: fai
All needed packages are already on the CD or USB stick.
Classes: INSTALL FAIBASE DEBIAN DEMO
Name: Xfce
Description: Xfce desktop, LVM partitioning
Short: A fancy Xfce desktop will be installed, the user account is demo
Long: This is the Xfce desktop example. Additional account called
demo with password: fai, root password: fai
All needed packages are already on the CD or USB stick.
Classes: INSTALL FAIBASE DEBIAN DEMO XORG XFCE LVM
Name: Gnome
Description: Gnome desktop installation
Short: A Gnome desktop, no LVM, You will get an account called demo
Long: This is the Gnome desktop example. Additional account called
demo with password: fai, root password: fai
You should have a fast network connection, because most packages are
downloaded from the internet.
Classes: INSTALL FAIBASE DEBIAN DEMO XORG GNOME
Name: Rocky Linux 8
Description: Rocky Linux 8 with Xfce desktop
Short: A normal Xfce desktop, running Rocky Linux 8
Long: We use the Debian nfsroot for installing the Rocky Linux 8 OS.
You should have a fast network connection, because most packages are
downloaded from the internet.
Classes: INSTALL FAIBASE ROCKY ROCKY8_64 XORG
Name: Ubuntu
Description: Ubuntu 22.04 LTS desktop installation
Short: Unity desktop
Long: We use the Debian nfsroot for installing the Ubuntu OS.
You should have a fast network connection, because most packages are
downloaded from the internet.
Classes: INSTALL FAIBASE DEMO DEBIAN UBUNTU JAMMY JAMMY64 XORG
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 defailed system information
Short: Show detailed hardware and system information
Long: Execute a lot of commands for collecting system information
Classes: SYSINFO

2
debconf/CLOUD Normal file
View File

@ -0,0 +1,2 @@
# Linux command line:
grub-pc grub2/linux_cmdline_default string elevator=noop quiet

9
debconf/DEBIAN Normal file
View File

@ -0,0 +1,9 @@
exim4-config exim4/dc_eximconfig_configtype select local delivery only; not on a network
locales locales/default_environment_locale select de_DE.UTF-8
locales locales/locales_to_be_generated multiselect de_DE.UTF-8 UTF-8
keyboard-configuration keyboard-configuration/modelcode string pc105
keyboard-configuration keyboard-configuration/xkb-keymap select us
keyboard-configuration keyboard-configuration/variant select Deutsch
keyboard-configuration keyboard-configuration/model select Generic 105-key (Intl) PC
keyboard-configuration keyboard-configuration/layoutcode string de
keyboard-configuration keyboard-configuration/optionscode string ctrl:nocaps,terminate:ctrl_alt_bksp

8
debconf/GERMAN Normal file
View File

@ -0,0 +1,8 @@
locales locales/default_environment_locale select de_DE.UTF-8
locales locales/locales_to_be_generated multiselect de_DE.UTF-8 UTF-8
keyboard-configuration keyboard-configuration/modelcode string pc105
keyboard-configuration keyboard-configuration/xkb-keymap select de
keyboard-configuration keyboard-configuration/variant select Germany
keyboard-configuration keyboard-configuration/model select Generic 105-key (Intl) PC
keyboard-configuration keyboard-configuration/layoutcode string de
keyboard-configuration keyboard-configuration/optionscode string ctrl:nocaps,terminate:ctrl_alt_bksp

36
debconf/HW4F_DESKTOP Normal file
View File

@ -0,0 +1,36 @@
locales locales/default_environment_locale select de_DE.UTF-8
locales locales/locales_to_be_generated multiselect de_DE.UTF-8 UTF-8
xserver-xorg xserver-xorg/config/inputdevice/keyboard/layout string de
xserver-xorg xserver-xorg/config/inputdevice/keyboard/model string pc105
xserver-xorg xserver-xorg/config/inputdevice/keyboard/options string lv3:ralt_switch
xserver-xorg xserver-xorg/autodetect_monitor boolean false
xserver-xorg xserver-xorg/autodetect_keyboard boolean true
xserver-xorg xserver-xorg/autodetect_mouse boolean true
xserver-xorg xserver-xorg/autodetect_video_card boolean true
console-setup console-setup/variant select Germany
console-setup console-setup/charmap select UTF-8
console-setup console-setup/layoutcode string de
console-setup console-setup/compose select No compose key
console-setup console-setup/fontsize-text select 16
console-setup console-setup/optionscode string lv3:ralt_switch
console-setup console-setup/layout select Germany
console-setup console-setup/detected note
console-setup console-setup/variantcode string
console-setup console-setup/codesetcode string Lat15
console-setup console-setup/modelcode string pc105
console-setup console-setup/ask_detect boolean false
console-setup console-setup/altgr select Right Alt
console-setup console-setup/ttys string /dev/tty[1-6]
console-setup console-setup/model select Generic 105-key (Intl) PC
console-setup console-setup/fontsize-fb select 16
console-setup console-setup/switch select No temporary switch
console-setup console-setup/codeset select # Latin1 and Latin5 - western Europe and Turkic languages
console-setup console-setup/toggle select No toggling
console-setup console-setup/fontface select VGA
console-setup console-setup/fontsize string 16
tzdata tzdata/Zones/Etc select UTC
tzdata tzdata/Zones/Europe select Berlin
tzdata tzdata/Areas select Europe

132
debconf/HW4F_DESKTOP2 Normal file

File diff suppressed because one or more lines are too long

261
debconf/UBUNTU_DESKTOP Normal file

File diff suppressed because one or more lines are too long

7
disk_config/CLOUD Normal file
View File

@ -0,0 +1,7 @@
# config for a disk image for a VM
#
# <type> <mountpoint> <size> <fs type> <mount options> <misc options>
disk_config disk1 disklabel:msdos bootable:1 fstabkey:uuid align-at:1M
primary / 300- ext4 rw,discard,barrier=0,noatime,errors=remount-ro tuneopts="-c 0 -i 0"

8
disk_config/CLOUD_EFI Normal file
View File

@ -0,0 +1,8 @@
# config for a disk image for a VM
#
# p=<partlabel> <mountpoint> <size> <fs type> <mount options> <misc options>
disk_config disk1 disklabel:gpt bootable:1 fstabkey:uuid align-at:1M
p=efi /boot/efi 64M vfat defaults createopts="-F 32"
p=root / 300- ext4 rw,discard,barrier=0,noatime,errors=remount-ro tuneopts="-c 0 -i 0"

9
disk_config/FAIBASE Normal file
View File

@ -0,0 +1,9 @@
# example of new config file for setup-storage
#
# <type> <mountpoint> <size> <fs type> <mount options> <misc options>
disk_config disk1 disklabel:msdos bootable:1 fstabkey:uuid
primary / 2G-50G ext4 rw,noatime,errors=remount-ro
logical swap 200-10G swap sw
logical /home 100- ext4 rw,noatime,nosuid,nodev createopts="-L home -m 1" tuneopts="-c 0 -i 0"

10
disk_config/FAIBASE_EFI Normal file
View File

@ -0,0 +1,10 @@
# example of new config file for setup-storage
#
# p=<partlabel> <mountpoint> <size> <fs type> <mount options> <misc options>
disk_config disk1 disklabel:gpt bootable:1 fstabkey:uuid
p=efi /boot/efi 512M vfat rw
p=root / 2G-50G ext4 rw,noatime,errors=remount-ro
p= swap 200-10G swap sw
p=home /home 100- ext4 rw,noatime,nosuid,nodev createopts="-L home -m 1" tuneopts="-c 0 -i 0"

11
disk_config/FAISERVER Normal file
View File

@ -0,0 +1,11 @@
# config file for an FAI install server
#
# <type> <mountpoint> <size> <fs type> <mount options> <misc options>
disk_config disk1 disklabel:msdos fstabkey:uuid
primary / 2G-15G ext4 rw,noatime,errors=remount-ro
logical swap 200-1000 swap sw
logical /tmp 100-1000 ext4 rw,noatime,nosuid,nodev createopts="-m 0" tuneopts="-c 0 -i 0"
logical /home 100-40% ext4 rw,noatime,nosuid,nodev createopts="-m 1" tuneopts="-c 0 -i 0"
logical /srv 1G-50% ext4 rw,noatime createopts="-m 1" tuneopts="-c 0 -i 0"

12
disk_config/FAISERVER_EFI Normal file
View File

@ -0,0 +1,12 @@
# config file for an FAI install server
#
# p=<partlabel> <mountpoint> <size> <fs type> <mount options> <misc options>
disk_config disk1 disklabel:gpt fstabkey:uuid
p=efi /boot/efi 512M vfat rw
p=system / 2G-15G ext4 rw,noatime,errors=remount-ro
p=swap swap 200-1000 swap sw
p= /tmp 100-1000 ext4 rw,noatime,nosuid,nodev createopts="-m 0" tuneopts="-c 0 -i 0"
p=home /home 100-40% ext4 rw,noatime,nosuid,nodev createopts="-m 1" tuneopts="-c 0 -i 0"
p=data /srv 1G-50% ext4 rw,noatime createopts="-m 1" tuneopts="-c 0 -i 0"

5
disk_config/HW4F_DESKTOP Normal file
View File

@ -0,0 +1,5 @@
disk_config disk1 disklabel:msdos bootable:1 fstabkey:uuid
logical swap 200-10G swap sw
primary / 4G-50G ext4 rw,noatime,errors=remount-ro
logical /home 100- ext4 rw,noatime,nosuid,nodev createopts="-L home -m 1" tuneopts="-c 0 -i 0"

View File

@ -0,0 +1,6 @@
disk_config disk1 disklabel:gpt bootable:1 fstabkey:uuid
primary /boot/efi 512M vfat rw
primary / 4G-50G ext4 rw,noatime,errors=remount-ro
primary swap 200-10G swap sw
primary /home 100- ext4 rw,noatime,nosuid,nodev createopts="-L home -m 1" tuneopts="-c 0 -i 0"

15
disk_config/LVM Normal file
View File

@ -0,0 +1,15 @@
# <type> <mountpoint> <size> <fs type> <mount options> <misc options>
# entire disk with LVM, separate /home
disk_config disk1 fstabkey:uuid align-at:1M
primary /boot 200 ext4 rw,noatime
primary - 4G- - -
disk_config lvm
vg vg1 disk1.2
vg1-root / 3G-50G ext4 noatime,rw
vg1-swap swap 200-4G swap sw
vg1-home /home 600- ext4 noatime,nosuid,nodev,rw

16
disk_config/LVM_EFI Normal file
View File

@ -0,0 +1,16 @@
# p=<partlabel> <mountpoint> <size> <fs type> <mount options> <misc options>
# entire disk with LVM, separate /home
disk_config disk1 disklabel:gpt fstabkey:uuid align-at:1M
p=efi /boot/efi 512M vfat rw
p=boot /boot 200 ext4 rw,noatime
p=system - 4G- - -
disk_config lvm
vg vg1 disk1.3
vg1-root / 3G-50G ext4 noatime,rw
vg1-swap swap 200-4G swap sw
vg1-home /home 600- ext4 noatime,nosuid,nodev,rw

10
disk_config/ROCKY Normal file
View File

@ -0,0 +1,10 @@
# example of new config file for setup-storage
#
# <type> <mountpoint> <size> <fs type> <mount options> <misc options>
disk_config disk1 disklabel:msdos bootable:1 fstabkey:label
primary / 4G-50G ext4 rw,noatime,errors=remount-ro createopts="-L ROOT"
logical swap 200-10G swap sw createopts="-L SWAP"
logical /home 100- ext4 rw,noatime,nosuid,nodev createopts="-L HOME -m 1" tuneopts="-c 0 -i 0"

12
disk_config/XENIAL Normal file
View File

@ -0,0 +1,12 @@
# example of new config file for setup-storage
#
# <type> <mountpoint> <size> <fs type> <mount options> <misc options>
# this is a copy of FAIBASE, but with metadata_csum disabled.
# Ubuntu XENIAL does not yet suport this option
disk_config disk1 disklabel:msdos bootable:1 fstabkey:uuid
primary / 2G-50G ext4 rw,noatime,errors=remount-ro createopts="-O ^metadata_csum"
logical swap 200-1G swap sw
logical /home 100- ext4 rw,noatime,nosuid,nodev createopts="-L home -m 1 -O ^metadata_csum" tuneopts="-c 0 -i 0"

13
disk_config/XENIAL_EFI Normal file
View File

@ -0,0 +1,13 @@
# example of new config file for setup-storage
#
# <type> <mountpoint> <size> <fs type> <mount options> <misc options>
# this is a copy of FAIBASE, but with metadata_csum disabled.
# Ubuntu XENIAL does not yet suport this option
disk_config disk1 disklabel:gpt bootable:1 fstabkey:uuid
primary /boot/efi 512M vfat rw
primary / 2G-50G ext4 rw,noatime,errors=remount-ro createopts="-O ^metadata_csum"
primary swap 200-1G swap sw
primary /home 100- ext4 rw,noatime,nosuid,nodev createopts="-L home -m 1 -O ^metadata_csum" tuneopts="-c 0 -i 0"

View File

View File

@ -0,0 +1 @@
Acquire::http::Proxy "http://hw4f-fai-vagrant:3142";

View File

@ -0,0 +1,5 @@
DPkg {
Options {
"--force-confdef";
}
};

View File

@ -0,0 +1,11 @@
Package: *
Pin: origin live.linuxmint.com
Pin-Priority: 750
Package: *
Pin: release o=linuxmint,c=upstream
Pin-Priority: 700
Package: *
Pin: release o=Ubuntu
Pin-Priority: 500

View File

@ -0,0 +1,3 @@
deb {%apt_cdn%}/debian {%release%} main
deb {%security_cdn%}/debian-security {%secsuite%} main
deb {%apt_cdn%}/debian {%release%}-updates main

BIN
files/etc/apt/trusted.gpg/DEBIAN Executable file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
files/etc/apt/trusted.gpg/UBUNTU Executable file

Binary file not shown.

View File

@ -0,0 +1,49 @@
# A configuration file for setupcon
# Change to "yes" and setupcon will explain what is being doing
VERBOSE_OUTPUT=no
# Setup these consoles. Most people do not need to change this.
ACTIVE_CONSOLES="/dev/tty[1-6]"
# Put here your encoding. Valid charmaps are: UTF-8 ARMSCII-8 CP1251
# CP1255 CP1256 GEORGIAN-ACADEMY GEORGIAN-PS IBM1133 ISIRI-3342
# ISO-8859-1 ISO-8859-2 ISO-8859-3 ISO-8859-4 ISO-8859-5 ISO-8859-6
# ISO-8859-7 ISO-8859-8 ISO-8859-9 ISO-8859-10 ISO-8859-11 ISO-8859-13
# ISO-8859-14 ISO-8859-15 ISO-8859-16 KOI8-R KOI8-U TIS-620 VISCII
CHARMAP="UTF-8"
# The codeset determines which symbols are supported by the font.
# Valid codesets are: Arabic Armenian CyrAsia CyrKoi CyrSlav Ethiopian
# Georgian Greek Hebrew Lao Lat15 Lat2 Lat38 Lat7 Thai Uni1 Uni2 Uni3
# Vietnamese. Read README.fonts for explanation.
CODESET="Lat15"
# Valid font faces are: VGA (sizes 8, 14 and 16), Terminus (sizes
# 12x6, 14, 16, 20x10, 24x12, 28x14 and 32x16), TerminusBold (sizes
# 14, 16, 20x10, 24x12, 28x14 and 32x16), TerminusBoldVGA (sizes 14
# and 16), Fixed (sizes 13, 14, 15, 16 and 18), Goha (sizes 12, 14 and
# 16), GohaClassic (sizes 12, 14 and 16).
FONTFACE="VGA"
FONTSIZE="16"
# You can also directly specify nonstandard font and ACM to load:
# FONT=/usr/local/share/funnyfonts/sarge16.psf
# ACM=/usr/local/share/consoletrans/my_special_encoding.acm
# The following variables describe your keyboard and can have the same
# values as the XkbModel, XkbLayout, XkbVariant and XkbOptions options
# in /etc/X11/xorg.conf.
XKBMODEL="pc105"
XKBLAYOUT="de"
XKBVARIANT=""
XKBOPTIONS=""
# Do not update the following md5 sum if you change
# /etc/console-setup/boottime.kmap.gz and Debconf will not overwrite
# your custom keymap. Do not update it even if you want to make
# Debconf overwrite it. Instead simply specify the empty string as
# a md5 sum.
BOOTTIME_KMAP_MD5=""

View File

@ -0,0 +1,6 @@
# Disable systemd's network interface name management.
# References:
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=863385
# https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/
GRUB_CMDLINE_LINUX_DEFAULT="$GRUB_CMDLINE_LINUX_DEFAULT net.ifnames=0"

View File

@ -0,0 +1 @@
LANG="de_DE.UTF-8"

View File

@ -0,0 +1,32 @@
# dhcpd.conf for a fai installation server
# replace faiserver with the name of your install server
ignore-client-uids on;
deny unknown-clients;
option dhcp-max-message-size 2048;
use-host-decl-names on;
#always-reply-rfc1048 on;
subnet 192.168.33.0 netmask 255.255.255.0 {
option routers 192.168.33.1;
option domain-name "fai.example";
option domain-name-servers 192.168.33.250;
option time-servers faiserver;
# option ntp-servers faiserver;
server-name faiserver;
next-server faiserver;
if substring(option vendor-class-identifier, 0, 20) = "PXEClient:Arch:00000" {
filename "fai/pxelinux.0";
}
if substring(option vendor-class-identifier, 0, 20) = "PXEClient:Arch:00007" {
filename "fai/syslinux.efi";
}
allow unknown-clients;
pool {
range 192.168.33.100 192.168.33.150;
}
}
# generate a lot of entries with:
# perl -e 'for (1..10) {printf "host client%02s {hardware ethernet XXX:$_;fixed-address client%02s;}\n",$_,$_;}'
# then replace XXX with the hardware addresses of your clients

View File

@ -0,0 +1,8 @@
# See fai.conf(5) for detailed information.
# Account for saving log files and calling fai-chboot.
LOGUSER=fai
# URL to access the fai config space
# If undefined, use default nfs://<install server>/$FAI_CONFIGDIR
FAI_CONFIG_SRC=nfs://faiserver/srv/fai/config

View File

@ -0,0 +1,15 @@
# For a detailed description see nfsroot.conf(5)
# "<suite> <mirror>" for debootstrap
FAI_DEBOOTSTRAP="bullseye http://deb.debian.org/debian"
FAI_ROOTPW='$1$kBnWcO.E$djxB128U7dMkrltJHPf6d1'
NFSROOT=/srv/fai/nfsroot
TFTPROOT=/srv/tftp/fai
NFSROOT_HOOKS=/etc/fai/nfsroot-hooks/
FAI_DEBOOTSTRAP_OPTS="--exclude=info"
# Configuration space
FAI_CONFIGDIR=/srv/fai/config
NFSROOT_ETC_HOSTS="192.168.33.250 faiserver"

4
files/etc/motd/FAIBASE Executable file
View File

@ -0,0 +1,4 @@
Plan your installation, and FAI installs your plan.

8
files/etc/rc.local/CLOUD Executable file
View File

@ -0,0 +1,8 @@
#! /bin/bash
# regenerate ssh_host keys
ls /etc/ssh/ssh_host_* >/dev/null 2>&1
if [ $? -ne 0 ]; then
dpkg-reconfigure -fnoninteractive openssh-server
fi
rm $0

106
files/etc/rc.local/FAISERVER Executable file
View File

@ -0,0 +1,106 @@
#! /bin/bash
# setup script that is only run once at boot time
# set up an FAI install server
NORMAL='\E(B\E[m'
RED='\E[31m'
GREEN='\E[32m'
set -o pipefail
# setup network
nic=$(cat /etc/network/interfaces /etc/network/interfaces.d/* 2>/dev/null | awk '$1 == "iface" && $2 != "lo" {print $2; exit}')
if [ -n "$nic" ]; then
ifup $nic
fi
# regenerate ssh_host keys
ls /etc/ssh/ssh_host_* > /dev/null
if [ $? -ne 0 ]; then
dpkg-reconfigure -fnoninteractive openssh-server
fi
sleep 8
[ -x /etc/init.d/nscd ] && invoke-rc.d nscd restart
echo "================================="
echo "Setting up the FAI install server"
echo "This will take a few minutes"
echo "================================="
. /etc/fai/fai.conf
. /etc/fai/nfsroot.conf
# copy the simple examples and pimp my config space
if [ ! -d "$FAI_CONFIGDIR/class" ]; then
mkdir -p $FAI_CONFIGDIR
cp -a /usr/share/doc/fai-doc/examples/simple/* $FAI_CONFIGDIR
ainsl /srv/fai/config/class/FAIBASE.var "^LOGUSER=fai"
_nic=$(ip route | awk '/^default/ {print $5}'|head -1)
myip=$(ip -br ad sh $_nic | awk '{print $3}')
myip=${myip%/*}
echo "APTPROXY=http://$myip:3142" >> /srv/fai/config/class/DEBIAN.var
fi
# set the LOGUSER, wo we get all the logs from our install clients
ainsl /etc/fai/fai.conf "^LOGUSER=fai"
# make index, then import the packages from the CD mirror
apt-get update >/dev/null
curl -fs 'http://127.0.0.1:3142/acng-report.html?doImport=Start+Import&calcSize=cs&asNeeded=an#bottom' >/dev/null
# setup the FAI server, including creating the nfsroot, use my own proxy
export APTPROXY="http://127.0.0.1:3142"
if [ -f /var/tmp/base.tar.xz ]; then
fai-setup -fvB /var/tmp/base.tar.xz > /var/log/fai/fai-setup.log 2>&1
else
fai-setup -fv > /var/log/fai/fai-setup.log 2>&1
fi
if [ $? -eq 0 ]; then
rm /var/tmp/base.tar.xz
echo ""
echo "================================================"
echo -e "Setting up the FAI server was ${GREEN}successful${NORMAL}"
echo "================================================"
echo ""
sleep 10
else
echo ""
echo "=================================================="
echo -e "${RED}ERROR${NORMAL}: Setting up the FAI install server ${RED}FAILED${NORMAL}!"
echo "Read /var/log/fai/fai-setup.log for more debugging"
echo "=================================================="
echo ""
sleep 10
exit 99
fi
cat <<EOF >> /srv/fai/nfsroot/etc/fai/fai.conf
# use short hostname instead of FQDN
export HOSTNAME=\${HOSTNAME%%.*}
echo \$HOSTNAME > /proc/sys/kernel/hostname
EOF
# create default pxelinux boot configuration
fai-chboot -o default
# create a template for booting the installation
fai-chboot -Iv -f verbose,sshd,createvt,menu -u nfs://faiserver/srv/fai/config bullseye.tmpl
# Since we do not know the MAC address, our DHCP cannot provide the hostname.
# Therefore we do explicitly set the hostname
fai-chboot -Iv -f verbose,sshd,createvt,menu -u nfs://faiserver/srv/fai/config -k hostname=xfcehost xfcehost
fai-chboot -Iv -f verbose,sshd,createvt,menu -u nfs://faiserver/srv/fai/config -k hostname=demohost demohost
for c in {01..10}; do
fai-chboot -Iv -f verbose,sshd,createvt,menu -u nfs://faiserver/srv/fai/config -k hostname=client$c client$c
done
fai-monitor > /var/log/fai/fai-monitor.log &
# move me away
mv $0 /var/tmp
# create new rc.local for next reboot
echo '#! /bin/bash' > /etc/rc.local
echo 'fai-monitor > /var/log/fai/fai-monitor.log &' >> /etc/rc.local
chmod a+rx /etc/rc.local
exit 0

12
files/etc/selinux/config/ROCKY Executable file
View File

@ -0,0 +1,12 @@
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
# targeted - Only targeted network daemons are protected.
# strict - Full SELinux protection.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
# SETLOCALDEFS= Check local definition changes

45
hooks/debconf.IMAGE Executable file
View File

@ -0,0 +1,45 @@
#! /bin/bash
# hook for installing a file system image (tar file)
# this works for Ubuntu 14.04
#
# Copyright (C) 2015 Thomas Lange, lange@cs.uni-koeln.de
# I use this tar command to create the image of an already running and configured machine
# tar -cf /tmp/IMAGE.tar --exclude /tmp/\* --exclude /run/\* --exclude /proc/\* --exclude /sys/\* --exclude /dev/\* /
# add --xattrs --selinux --acls if needed (for CentOS 7)
# Then copy this image to /srv/fai/config/basefiles/IMAGE.tar and make sure your client belongs to the class IMAGE
skiptask extrbase debconf repository updatebase instsoft
skiptask configure # do not run the usual configure scripts
# we assume, that the new host will get its hostname and IP via DHCP
# remove old hostname
fgrep -v 127.0.1.1 $target/etc/hosts >> /tmp/fai/hosts
mv /tmp/fai/hosts $target/etc/hosts
rm $target/etc/hostname
#install grub
mount -t proc proc $FAI_ROOT/proc
mount -t sysfs sysfs $FAI_ROOT/sys
mount --bind /dev $FAI_ROOT/dev
if [ -f $target/etc/debian_version ]; then
$ROOTCMD grub-install $BOOT_DEVICE
$ROOTCMD update-grub
fi
if [ -f $target/etc/centos-release ]; then
rm $target/etc/grub2/device.map
$FAI/scripts/ROCKY/40-install-grub
$FAI/scripts/ROCKY/30-mkinitrd
$ROOTCMD fixfiles onboot # this fixes the SELinux security contexts during the first boot
fi
# things that may be adjusted:
#
# MAC address ?? (not needed for Ubuntu, it uses iftab(5)
# /etc/hosts may contain the IP and name of the original host
# /etc/hostname (for Ubuntu just remove it)
# /var/lib/NetworkManager/dhclient-eth0.conf?

3
hooks/debconf.ROCKY Executable file
View File

@ -0,0 +1,3 @@
#! /bin/bash
skiptask debconf

25
hooks/instsoft.DEBIAN Executable file
View File

@ -0,0 +1,25 @@
#! /bin/bash
# if package locales will be installed, then install it early, before
# other packages
if [ $FAI_ACTION != "install" -a $FAI_ACTION != "dirinstall" ]; then
exit 0
fi
fcopy -Bi /etc/apt/apt.conf.d/force_confdef
ainsl -a /etc/ucf.conf "^conf_force_conffold=YES"
# in case the locales are already included inside the base file (Ubuntu)
if [ -f $target/usr/sbin/locale-gen ]; then
exit
fi
# if we want to install locales, install them now
install_packages -l 2>/dev/null | egrep -q ' locales|locales '
if [ $? -eq 0 ]; then
if [ X$verbose = X1 ]; then
$ROOTCMD apt-get -y install locales
else
$ROOTCMD apt-get -y install locales > /dev/null
fi
fi

31
hooks/repository.ROCKY Executable file
View File

@ -0,0 +1,31 @@
#! /bin/bash
# (c) Michael Goetze, 2010-2011, mgoetze@mgoetze.net
error=0; trap 'error=$(($?>$error?$?:$error))' ERR # save maximum error code
if [ $FAI_ACTION = "install" ]; then
mount -t proc proc $target/proc
mount -t sysfs sysfs $target/sys
[ -L $target/etc/mtab ] || cp /etc/mtab $target/etc/mtab
cat > $target/etc/sysconfig/network <<-EOF
NETWORKING=yes
HOSTNAME=$HOSTNAME.$DOMAIN
EOF
echo "127.0.0.1 localhost" > $target/etc/hosts
ifclass DHCPC || ainsl -s /etc/hosts "$IPADDR $HOSTNAME.$DOMAIN $HOSTNAME"
cp /etc/resolv.conf $target/etc
fi
mkdir $target/dev/pts
mknod -m 000 $target/dev/pts/ptmx c 5 2
fcopy -riv /etc/yum.repos.d/
# disable the fastestmirror plugin
#fai-sed 's/enabled=1/enabled=0/' /etc/yum/pluginconf.d/fastestmirror.conf
skiptask repository
exit $error

223
hooks/savelog.LAST.sh Executable file
View File

@ -0,0 +1,223 @@
#! /bin/bash
# parse all log files for error messages
# print errors and warnings found to error.log
# WARNING: This will only work with english error messages!
errfile=$LOGDIR/error.log
# Define grep patterns. Do not start or end with an empty line!
globalerrorpatterns="error
fail
warn
bad
bad
no space
Couldn't stat
Cannot access
conflict
is bigger than the limit
did not exist
non existent
not found
couldn't
can't
E: Sorry, broken packages
^E:
operator expected
ambiguous redirect
No previous regular expression
No such
Device or resource busy
unknown option
[a-z]\+\.log:E:
No candidate version found
segfault
Couldn't find any package whose name or description matched
cannot create
The following packages have unmet dependencies"
globalignorepatterns="[a-z]\+\.log:#
Error: Driver 'pcspkr' is already registered, aborting
: bytes packets errors dropped
:+ error=0
:+ trap error=
task_error_func=
STOP_ON_ERROR=
courier-webadmin
plugins-bad
Enabling conf localized-error-pages
ibwebadmin
kernel-patch-badram
kolab-webadmin
kolabadmin
gstreamer.\+-plugins-really-bad
liberrors.so
liberrors-samba
libsamba-errors
gsambad
libad
libtest-nowarnings-perl
libtest-warn-perl
libclass-errorhandler-perl
zope-ploneerrorreporting
libroxen-errormessage
liberror-perl
perl-Error
libgpg-error-dev
libgpg-error0
Opts:.\+errors=remount
[RT]X packets:
WARNING: unexpected IO-APIC
warned about = ( )
daemon.warn
kern.warn
rw,errors=
Expect some cache
no error
failmsg
RPC call returned error 101
deverror.out
(floppy), sector 0
mount version older than kernel
Can't locate module
Warning only .\+MB will be used.
hostname: Host name lookup failure
I can't tell the difference.
warning, not much extra random data, consider using the -rand option
confC._FILE
Warning: 3 database(s) sources
were not found, (but were created)
removing exim
The home dir you specified already exists.
No Rule for /usr/lib/ispell/default.hash.
/usr/sbin/update-fonts-.\+: warning: absolute path
hostname: Unknown server error
EXT2-fs warning: checktime reached
RPC: sendmsg returned error 101
can't print them to stdout. Define these classes
warning: downgrading
suppress emacs errors
echo Error:
Can't open dependencies file
documents in /usr/doc are no longer supported
if you have both a SCSI and an IDE CD-ROM
Warning: /proc/ide/hd?/settings interface is obsolete, and will be removed soon
Monitoring disabled
Error: only one processor found.
Error Recovery Strategy:
sector 0 does not have an
syslogin_perform_logout: logout() returned an error
grub is not in an XFS filesystem.
grub-install: line 374:
grub-probe: error: Cannot open \`/boot/grub/device.map'
is harmless
not updating .\+ font directory data.
register_serial(): autoconfig failed
Fontconfig error: Cannot load default config file
asking for cache data failed
However, I can not read the target:
Warning: The partition table looks like it was made
task_error=0
task_local_error=0
^info: Trying to set
warning: /usr/lib/X11/fonts
can't read /etc/udev/rules.d/z25_persistent-net.rules
/cow': No such file or directory
Dummy start-stop-daemon called
X: bytes packets errors
ACPI Error
ACPI Warning
AE_NOT_FOUND
conflicts with ACPI region
cannot stat \`/etc/modprobe.d/\*.conf'
cdrom: open failed.
libgpg-error
process \`kudzu' used the deprecated sysctl system call
PM: Resume from disk failed
JBD: barrier-based sync failed
aufs: module is from the staging directory, the quality is unknown
warning: linuxlogo stop runlevel arguments (none) do not match
insserv: warning: script .\+ missing LSB tags and overrides
live-premount.\+ If this fails
cannot read table of mounted file systems
error: no alternatives for
ERST: Error Record Serialization Table (ERST) support is initialized
ERST: Table is not found
HEST: Table not found
failed to stat /dev/pts
Failed to connect to socket /var/run/dbus/system_bus_socket
fail to add MMCONFIG information
can't initialize iptables table
can't initialize ip6tables table
Authentication warning overridden
41-warning.sh
PCCT header not found
Download is performed unsandboxed as root as file
update-alternatives: warning: skip creation of
loop: module verification failed: signature
Warning: apt-key output should not be parsed
WARNING: Failed to connect to lvmetad. Falling back to device scanning
Warning: The home dir /var/lib/usbmux you specified
diff: /var/lib/apparmor/profiles/.apparmor.md5sums: No such file or directory
error reporting disabled
Enabling Firmware First mode for corrected errors
errors: 0
0 errors
Memory Error Correction:
Memory Controller 0 - Channel . Error
IIO RAS/Control Status/Global Errors
RAS: Correctable Errors collector initialized
__stack_chk_fail
grub.cfg.new: Directory nonexistent
can't derive routing for PCI INT A
failed to load isci/isci_firmware.bin
Direct firmware load for isci/isci_firmware.bin failed with error
Loading user firmware failed, using default values
stunnel4 you specified can't be accessed: No such file or directory
install-docs --verbose --check file_name' may give more details about the above errors
cannot open '/etc/ssl/certs/java/cacerts' for reading: No such file or directory
can't claim BAR
disabling ASPM
data block query control method not found
subprocess.py.\+RuntimeWarning: line buffering
Resource conflict.\+ found
update-rc.d: warning: start and stop actions are no longer supported"
# add pattern on some conditions
if [ -n $FAI_ALLOW_UNSIGNED ] ; then
globalignorepatterns="$globalignorepatterns
WARNING: untrusted versions
WARNING: The following packages cannot be authenticated
Ignoring these trust violations"
fi
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Here you can define your own patterns. Put one pattern in a line,
# do not create empty lines.
myerrorpatterns="X_X-X_XX"
myignorepatterns="X_X-X_XX"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# The main routine
errorpatterns="$globalerrorpatterns
$myerrorpatterns"
ignorepatterns="$globalignorepatterns
$myignorepatterns"
cd $LOGDIR || exit 3
if [ -s $errfile ]; then
echo "Errorfile already exists. Aborting." >&2
exit
fi
grep -i "$errorpatterns" *.log | grep -vi "$ignorepatterns" > $errfile
if [ X$verbose = X1 ]; then
egrep -v '^software.log:' $errfile > $LOGDIR/tempfile
mv $LOGDIR/tempfile $errfile
fi
if [ -s $errfile ]; then
echo "ERRORS found in log files. See $errfile" >&2
else
echo "Congratulations! No errors found in log files."
# export flag_reboot=1 # if you want to reboot if no errors are found
fi

7
hooks/setup.DEFAULT.sh Executable file
View File

@ -0,0 +1,7 @@
#! /bin/bash
# use short hostname instead of FQDN
export HOSTNAME=${HOSTNAME%%.*}
if [ $do_init_tasks -eq 1 ]; then
echo $HOSTNAME > /proc/sys/kernel/hostname
fi

14
hooks/updatebase.DEBIAN Executable file
View File

@ -0,0 +1,14 @@
#! /bin/bash
if [ -n "$APTPROXY" ]; then
echo "Acquire::http::Proxy \"$APTPROXY\";" > $target/etc/apt/apt.conf.d/02proxy
else
rm -f $target/etc/apt/apt.conf.d/02proxy
fi
echo force-unsafe-io > $target/etc/dpkg/dpkg.cfg.d/unsafe-io
# you may want to add i386 arch to amd64 hosts
# if ifclass AMD64; then
# $ROOTCMD dpkg --add-architecture i386
# fi

25
hooks/updatebase.ROCKY Executable file
View File

@ -0,0 +1,25 @@
#! /bin/bash
if [ ! -f $target/etc/resolv.conf ]; then
cp /etc/resolv.conf $target/etc
fi
if [ X$verbose = X1 ]; then
echo "Updating base"
$ROOTCMD yum -y update |& tee -a $LOGDIR/software.log
else
$ROOTCMD yum -y update >> $LOGDIR/software.log
fi
$ROOTCMD systemd-machine-id-setup
cat > $target/etc/sysconfig/kernel <<EOF
# UPDATEDEFAULT specifies if new-kernel-pkg should make
# new kernels the default
UPDATEDEFAULT=yes
# DEFAULTKERNEL specifies the default kernel package type
DEFAULTKERNEL=kernel-core
EOF
skiptask updatebase

30
hooks/updatebase.UBUNTU Executable file
View File

@ -0,0 +1,30 @@
#! /bin/bash
# use external mirror, remove this script when using a mirror from CD
cat <<EOM > $target/etc/apt/sources.list
# external mirror
deb $ubuntumirror/ubuntu $ubuntudist main restricted universe multiverse
deb $ubuntumirror/ubuntu $ubuntudist-updates main restricted universe multiverse
deb $ubuntumirror/ubuntu $ubuntudist-security main restricted universe multiverse
EOM
# https://lists.uni-koeln.de/pipermail/linux-fai/2016-July/011398.html
# In Ubuntu 16.04 (but not 14.04), the locales configuration mechanism has
# changed. There is a /var/lib/dpkg/info/locales.config file, which
# overrides /var/lib/dpkg/info/locales.postinst and consults
# /var/lib/locales/supported.d/local instead of the debconf system. (See
# the code in /usr/share/debconf/frontend that prefers locales.config.) This
# hook applies the debconf setting. It must run after FAI's debconf task
# but before dpkg gets a chance to clobber debconf with an empty setting.
if [ ! -f "$target/var/lib/locales/supported.d/local" ]; then
$ROOTCMD debconf --owner=locales sh -c '
. /usr/share/debconf/confmodule
db_version 2.0
db_get locales/locales_to_be_generated &&
mkdir -p /var/lib/locales/supported.d &&
echo "$RET" > /var/lib/locales/supported.d/local' &&
$ROOTCMD dpkg-reconfigure locales
fi

10
package_config/CINNAMON Normal file
View File

@ -0,0 +1,10 @@
PACKAGES install DEBIAN
task-cinnamon-desktop
network-manager
network-manager-applet
network-manager-config-connectivity-debian
network-manager-gnome
PACKAGES install UBUNTU
cinnamon-desktop-environment
network-manager

65
package_config/DEBIAN Normal file
View File

@ -0,0 +1,65 @@
PACKAGES install-norec
#cryptsetup-initramfs # needed if you use an encrypted partition
apt-transport-https # is only needed for stretch
debconf-utils
file
zstd
less
linuxlogo
rsync
openssh-client openssh-server
time
procinfo
nullmailer
eject
locales
console-setup kbd
pciutils usbutils
unattended-upgrades
PACKAGES install NONFREE
# you may want these non-free kernel drivers
firmware-bnx2 firmware-bnx2x firmware-realtek
firmware-linux-nonfree
# a list of firmware for wifi/wireless
atmel-firmware firmware-atheros firmware-brcm80211
firmware-iwlwifi firmware-libertas firmware-ralink firmware-zd1211
firmware-brcm80211 firmware-ti-connectivity
firmware-netronome firmware-netxen firmware-realtek
firmware-cavium
# firmware-ipw2x00 # needs a debconf question
PACKAGES install-norec I386
linux-image-686-pae
memtest86+
PACKAGES install-norec CHROOT
linux-image-686-pae-
linux-image-amd64-
PACKAGES install-norec AMD64
linux-image-amd64
memtest86+
PACKAGES install-norec ARM64
grub-efi-arm64
linux-image-arm64
PACKAGES install GRUB_PC
grub-pc
PACKAGES install GRUB_EFI
grub-efi dosfstools
PACKAGES install LVM
lvm2
PACKAGES install CLOUD
unattended-upgrades
PACKAGE install-norec CINNAMON
task-cinnamon-desktop
task-desktop
PACKAGE install-norec GERMAN
task-german

BIN
package_config/DEBIAN.gpg Normal file

Binary file not shown.

9
package_config/DEMO Normal file
View File

@ -0,0 +1,9 @@
# some packages we need on a demo machine
PACKAGES install-norec
htop iotop nmon
# only when also class XORG is defined
PACKAGES install-norec XORG
bb xpenguins
#frozen-bubble

13
package_config/FAISERVER Normal file
View File

@ -0,0 +1,13 @@
PACKAGES install-norec
fai-quickstart
debmirror tcpdump
xorriso grub-pc
lftp curl
netselect
syslinux-common pxelinux
apt-cacher-ng
nscd psmisc
bind9 dnsutils
iptables-persistent
zile

5
package_config/GERMAN Normal file
View File

@ -0,0 +1,5 @@
PACKAGES install
task-german
PACKAGES install GNOME
firefox-esr-l10n-de thunderbird-l10n-de

9
package_config/GNOME Normal file
View File

@ -0,0 +1,9 @@
PACKAGES install-norec
firefox-esr
#thunderbird
menu gdm3
gnome-core
gconf-editor
gnome-screensaver gnome-system-monitor gnome-system-tools
network-manager-gnome

View File

@ -0,0 +1,16 @@
PACKAGES install
ubuntu-desktop
language-pack-de
language-pack-gnome-de
thunderbird
thunderbird-locale-de
firefox
firefox-locale-de
libreoffice
libreoffice-l10n-de
libreoffice-help-de
ubuntu-software
ubuntu-snappy
snapd
APTPROXY=http://hw4f-fai:3142

7
package_config/MINT Normal file
View File

@ -0,0 +1,7 @@
PACKAGES install-norec DESKTOP
linuxmint-keyring
mint-info-cinnamon
mint-info
mint-meta-cinnamon
mint-meta-core
mint-meta-codecs

35
package_config/ROCKY Normal file
View File

@ -0,0 +1,35 @@
PACKAGES dnfgroup
core
minimal-environment
#server-product-environment
#headless-management
PACKAGES dnfgroup XORG
graphical-server-environment
workstation-product-environment
PACKAGES dnfi
NetworkManager
chrony
kernel
dracut
less
openssh
openssh-clients
openssh-server
vim-enhanced
man
curl
unzip
which
ncurses ncurses-base
PACKAGES dnfi GRUB_PC
grub2-pc
PACKAGES dnfi GRUB_EFI
grub2-efi
PACKAGES dnfi LVM
lvm2

38
package_config/STANDARD Normal file
View File

@ -0,0 +1,38 @@
PACKAGES install-norec
# the list of standard packages, without any libs and a few packages removed
apt-listchanges
bash-completion
bind9-host
dbus
dnsutils
doc-debian
file
gettext-base
groff-base
hdparm
less
locales
lsof
man-db
manpages
mime-support
ncurses-term
netcat-traditional
openssh-client
pciutils
perl
reportbug
telnet
traceroute
ucf
xz-utils
vim
PACKAGES install-norec STRETCH BUSTER
python
python-minimal
PACKAGES install-norec BULLSEYE
python3
python3-minimal

23
package_config/UBUNTU Normal file
View File

@ -0,0 +1,23 @@
PACKAGES install I386
linux-image-generic
memtest86+
PACKAGES install CHROOT
linux-image-generic-
PACKAGES install AMD64
linux-image-generic
memtest86+
PACKAGES install GRUB_PC
grub-pc
PACKAGES install GRUB_EFI
grub-efi dosfstools
PACKAGES install
ubuntu-minimal
ubuntu-server
PACKAGES install GERMAN
language-pack-gnome-de

6
package_config/XFCE Normal file
View File

@ -0,0 +1,6 @@
PACKAGES install-norec
xfce4 # base system
xfce4-goodies # additional tools
lightdm
firefox-esr
network-manager-gnome

12
package_config/XORG Normal file
View File

@ -0,0 +1,12 @@
PACKAGES install-norec DEBIAN
xorg xserver-xorg-video-all xserver-xorg-input-all
fonts-freefont-ttf
xscreensaver
xscreensaver-gl
xterm
desktop-base
PACKAGES install UBUNTU
ubuntu-server-
ubuntu-standard
ubuntu-desktop

11
scripts/CLOUD/10-network Executable file
View File

@ -0,0 +1,11 @@
#!/bin/bash
error=0; trap 'error=$(($?>$error?$?:$error))' ERR # save maximum error code
# Disable systemd's network interface name management.
# References:
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=863385
# https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/
fcopy -M /etc/default/grub.d/10_cloud_disable_net.ifnames.cfg
$ROOTCMD update-grub

27
scripts/CLOUD/99-cleanup Executable file
View File

@ -0,0 +1,27 @@
#! /bin/bash
#fcopy /etc/init.d/expand-root
#if [ -f $target/files/etc/init.d/expand-root ]; then
# $ROOTCMD insserv --default expand-root
#fi
fai-sed "s/PermitRootLogin yes/PermitRootLogin without-password/" /etc/ssh/sshd_config
ainsl /etc/ssh/sshd_config 'ClientAliveInterval 120'
ainsl -a /etc/modprobe.d/blacklist.conf 'blacklist pcspkr'
ainsl -a /etc/modprobe.d/blacklist.conf 'blacklist floppy'
rm -f $target/etc/resolv.conf \
$target/etc/udev/rules.d/70-persistent-net.rules \
$target/lib/udev/write_net_rules \
$target/etc/mailname \
$target/var/lib/dbus/machine-id
> $target/etc/machine-id
shred --remove $target/etc/ssh/ssh_host_*
# FIXME: DHCP RFC3442 is used incorrect in Azure
if [ -f $target/etc/dhcp/dhclient.conf ]; then
fai-sed 's,rfc3442-classless-static-routes,disabled-\0,' /etc/dhcp/dhclient.conf
fi

18
scripts/DEBIAN/10-rootpw Executable file
View File

@ -0,0 +1,18 @@
#! /bin/bash
error=0; trap 'error=$(($?>$error?$?:$error))' ERR # save maximum error code
# set root password
if [ -n "$ROOTPW" ]; then
$ROOTCMD chpasswd --encrypted <<< "root:${ROOTPW}"
elif [ -n "$username" ]; then
$ROOTCMD usermod -L root
# enable sudo for user
ainsl /etc/sudoers "$username ALL = ALL"
if [ ! -f $target/usr/bin/sudo ]; then
echo "WARNING. Package sudo is not installed"
fi
fi
exit $error

22
scripts/DEBIAN/20-capabilities Executable file
View File

@ -0,0 +1,22 @@
#!/bin/bash
#
# Capabilities get lost when creating the fai base.tar.xz image.
# Restore them here.
#
set -e
if [ ! -x $target/sbin/setcap ] ; then
exit 0
fi
for FILE in /bin/ping /bin/ping6 /usr/bin/fping /usr/bin/fping6; do
if [ -x $target/$FILE -a ! -h $target/$FILE ] ; then
if $ROOTCMD /sbin/setcap cap_net_raw+ep $FILE; then
echo "Setcap worked! $FILE is not suid!"
fi
fi
done
if [ -x $target/usr/bin/systemd-detect-virt ] ; then
$ROOTCMD /sbin/setcap cap_dac_override,cap_sys_ptrace+ep /usr/bin/systemd-detect-virt
fi

117
scripts/DEBIAN/30-interface Executable file
View File

@ -0,0 +1,117 @@
#! /bin/bash
netplan_yaml() {
# network configuration using ubuntu's netplan.io
local IFNAME="$1"
local METHOD="$2"
echo "Generating netplan configuration for $IFNAME ($METHOD)" >&2
echo "# generated by FAI"
echo "network:"
echo " version: 2"
echo " renderer: $RENDERER"
case "$RENDERER" in
networkd)
echo " ethernets:"
echo " $IFNAME:"
case "$METHOD" in
dhcp)
echo " dhcp4: true"
;;
static)
echo " addresses: [$CIDR]"
echo " gateway4: $GATEWAYS_1"
echo " nameservers:"
echo " search: [$DOMAIN]"
echo " addresses: [${DNSSRVS// /, }]"
;;
esac
esac
}
iface_stanza() {
# classic network configuration using /etc/network/interfaces
local IFNAME="$1"
local METHOD="$2"
echo "Generating interface configuration for $IFNAME ($METHOD)" >&2
echo "# generated by FAI"
echo "auto $IFNAME"
echo "iface $IFNAME inet $METHOD"
case "$METHOD" in
static)
echo " address $CIDR"
echo " gateway $GATEWAYS"
;;
esac
}
newnicnames() {
local name
[ $do_init_tasks -eq 0 ] && return
[ -z "$NIC1" ] && return
fields="ID_NET_NAME_FROM_DATABASE ID_NET_NAME_ONBOARD ID_NET_NAME_SLOT ID_NET_NAME_PATH"
for field in $fields; do
name=$(udevadm info /sys/class/net/$NIC1 | sed -rn "s/^E: $field=(.+)/\1/p")
if [[ $name ]]; then
NIC1=$name
return
fi
done
# try to get altname net dev
name=$(ip link show $NIC1 | awk '/altname / { print $2 }')
if [[ $name ]]; then
NIC1=$name
return
else
echo "$0: error: could not find systemd predictable network name. Using $NIC1."
fi
}
if [ -z "$NIC1" ]; then
echo "WARNING: \$NIC1 is not defined. Cannot add ethernet to /etc/network/interfaces."
fi
CIDR=$(ip --br ad sh $NIC1|awk '{print $3}')
newnicnames
case "$FAI_ACTION" in
install|dirinstall)
ifclass DHCPC && METHOD=dhcp || METHOD=static
ifclass XORG && RENDERER=NetworkManager || RENDERER=networkd
if [ -d $target/etc/netplan ]; then
# Ubuntu >= 17.10 with netplan.io
if [ -n "$NIC1" ]; then
netplan_yaml $NIC1 $METHOD > $target/etc/netplan/01-${NIC1}.yaml
fi
elif [ -d $target/etc/network/interfaces.d ]; then
# ifupdown >= 0.7.41 (Debian >= 8, Ubuntu >= 14.04)
iface_stanza lo loopback > $target/etc/network/interfaces.d/lo
if [ -n "$NIC1" -a ! -f $target/etc/NetworkManager/NetworkManager.conf ]; then
iface_stanza $NIC1 $METHOD > $target/etc/network/interfaces.d/$NIC1
fi
else
(
iface_stanza lo loopback
iface_stanza $NIC1 $METHOD
) > $target/etc/network/interfaces
fi
if ! ifclass DHCPC ; then
[ -n "$NETWORK" ] && echo "localnet $NETWORK" > $target/etc/networks
if [ ! -L $target/etc/resolv.conf -a -e /etc/resolv.conf ]; then
cp -p /etc/resolv.conf $target/etc
fi
fi
;;
esac
# here fcopy is mostly used, when installing a client for running in a
# different subnet than during the installation
fcopy -iM /etc/resolv.conf
fcopy -iM /etc/network/interfaces /etc/networks
exit $error

51
scripts/DEBIAN/40-misc Executable file
View File

@ -0,0 +1,51 @@
#! /bin/bash
# (c) Thomas Lange, 2001-2016, lange@debian.org
# (c) Michael Goetze, 2010-2011, mgoetze@mgoetze.net
error=0; trap 'error=$(($?>$error?$?:$error))' ERR # save maximum error code
# a list of modules which are loaded at boot time
for module in $MODULESLIST; do
ainsl -a /etc/modules "^$module$"
done
fcopy -Mv /etc/hostname || echo $HOSTNAME > $target/etc/hostname
ainsl -a /etc/mailname ${HOSTNAME}
if [ ! -e $target/etc/adjtime ]; then
printf "0.0 0 0.0\n0\nUTC\n" > $target/etc/adjtime
fi
if [ "$UTC" = "yes" ]; then
fai-sed 's:^LOCAL$:UTC:' /etc/adjtime
else
fai-sed 's:^UTC$:LOCAL:' /etc/adjtime
fi
# enable linuxlogo
if [ -f $target/etc/inittab ]; then
fai-sed 's#/sbin/getty 38400#/sbin/getty -f /etc/issue.linuxlogo 38400#' /etc/inittab
elif [ -f $target/lib/systemd/system/getty@.service ]; then
fai-sed 's#sbin/agetty --noclear#sbin/agetty -f /etc/issue.linuxlogo --noclear#' /lib/systemd/system/getty@.service
fi
# make sure a machine-id exists
if [ ! -f $target/etc/machine-id ]; then
> $target/etc/machine-id
fi
# recreate machine-id if the file is empty
if [ X"$(stat -c '%s' $target/etc/machine-id 2>/dev/null)" = X0 -a -f $target/bin/systemd-machine-id-setup ]; then
$ROOTCMD systemd-machine-id-setup
fi
fai-link /etc/mtab ../proc/self/mounts
rm -f $target/etc/dpkg/dpkg.cfg.d/unsafe-io
if [ -d /etc/fai ]; then
if ! fcopy -Mv /etc/fai/fai.conf; then
ainsl -a /etc/fai/fai.conf "FAI_CONFIG_SRC=$FAI_CONFIG_SRC"
fi
fi
fcopy -iv /etc/rc.local
exit $error

39
scripts/DEMO/10-misc Executable file
View File

@ -0,0 +1,39 @@
#! /bin/bash
# (c) Thomas Lange, 2001-2017, lange@debian.org
error=0; trap 'error=$(($?>$error?$?:$error))' ERR # save maximum error code
ifclass XORG && {
fcopy -M /etc/X11/xorg.conf
}
if ifclass UBUNTU; then
groups="adm cdrom sudo dip plugdev lpadmin sambashare"
$ROOTCMD addgroup --system lpadmin || true
$ROOTCMD addgroup --system sambashare || true
fi
# add additional user account
if [ -n "$username" ]; then
if ! $ROOTCMD getent passwd $username ; then
$ROOTCMD adduser --disabled-login --gecos "$username user" $username
$ROOTCMD usermod -p "$USERPW" $username
userdir=$($ROOTCMD getent passwd "$username" | cut -d: -f6 )
# disable xfce question about default or empty panel
if [ -f $target/etc/xdg/xfce4/panel/default.xml ]; then
xfdir=$userdir/.config/xfce4/xfconf/xfce-perchannel-xml
if [ ! -d $target/$xfdir ]; then
$ROOTCMD mkdir -p $xfdir
$ROOTCMD cp /etc/xdg/xfce4/panel/default.xml $xfdir/xfce4-panel.xml
# group name is the same as user name
$ROOTCMD chown -R $username:$username $userdir/.config
fi
fi
for g in $groups; do
$ROOTCMD adduser $username $g
done
fi
fi

37
scripts/FAIBASE/10-misc Executable file
View File

@ -0,0 +1,37 @@
#! /bin/bash
# (c) Thomas Lange, 2001-2012, lange@debian.org
error=0; trap 'error=$(($?>$error?$?:$error))' ERR # save maximum error code
echo $TIMEZONE > $target/etc/timezone
if [ -L $target/etc/localtime ]; then
fai-link /etc/localtime /usr/share/zoneinfo/${TIMEZONE}
else
cp -f /usr/share/zoneinfo/${TIMEZONE} $target/etc/localtime
fi
if [ -f $target/etc/hosts.orig ]; then
mv $target/etc/hosts.orig $target/etc/hosts
fi
if [ -n "$IPADDR" ]; then
ifclass DHCPC || ainsl -s /etc/hosts "$IPADDR $HOSTNAME.$DOMAIN $HOSTNAME"
else
ifclass DHCPC && ainsl -s /etc/hosts "127.0.0.1 $HOSTNAME"
fi
fcopy -iM /etc/hosts /etc/motd
# make /root accessible only by root
chmod -c 0700 $target/root
chown -c root:root $target/root
# copy default dotfiles for root account
fcopy -ir /root
# use tmpfs for /tmp if not defined in disk_config
if ! grep -Pq '\s/tmp\s' $target/etc/fstab; then
ainsl /etc/fstab "tmpfs /tmp tmpfs nodev,nosuid,size=50%,mode=1777 0 0"
fi
chmod -c 1777 ${target}/tmp
chown -c 0:0 ${target}/tmp
exit $error

35
scripts/FAIBASE/15-root-ssh-key Executable file
View File

@ -0,0 +1,35 @@
#! /bin/bash
# (c) Thomas Lange, 2022, lange@debian.org
#
# Add public ssh key for user root to get login access
error=0; trap 'error=$(($?>$error?$?:$error))' ERR # save maximum error code
SSHDIR=$target/root/.ssh
AUKEY=$SSHDIR/authorized_keys
# reverse order of classes
for c in $classes; do
revclasses="$c $revclasses"
done
for c in $revclasses; do
if [ -f $FAI/files/root-ssh-key/$c ]; then
if [ -f $AUKEY ]; then
cmp -s $FAI/files/root-ssh-key/$c $AUKEY
if [ $? -eq 0 ]; then
exit
fi
fi
if [ ! -d $SSHDIR ]; then
mkdir -m 700 $SSHDIR
fi
cp -v $FAI/files/root-ssh-key/$c $AUKEY
chown root:root $AUKEY
chmod 700 $AUKEY
break
fi
done
exit $error

View File

@ -0,0 +1,25 @@
#! /bin/bash
# (c) Thomas Lange, 2006,2009, lange@debian.org
# create entries for removable media in fstab and directories in /media
cdromlist() {
[ -f /proc/sys/dev/cdrom/info ] || return
devs=$(grep 'drive name:' /proc/sys/dev/cdrom/info | cut -d ":" -f 2)
for d in $devs; do
echo $d
done
}
fstabline () {
line=$(printf "%-15s %-15s %-7s %-15s %-7s %s\n" "$1" "$2" "$3" "$4" "$5" "$6")
ainsl /etc/fstab "$line"
}
i=0
for cdrom in $(cdromlist | tac); do
[ $i -eq 0 ] && ln -sfn cdrom0 $target/media/cdrom
mkdir -p $target/media/cdrom$i
fstabline /dev/$cdrom /media/cdrom$i udf,iso9660 ro,user,noauto 0 0
i=$((i + 1))
done

49
scripts/FAISERVER/10-conffiles Executable file
View File

@ -0,0 +1,49 @@
#! /bin/bash
fcopy -BvrS /etc/fai
fcopy -BvS /etc/dhcp/dhcpd.conf
if [ $FAI_ACTION = "install" -o $FAI_ACTION = "dirinstall" ] ; then
# use the same sources.list for the server itself and the clients
cp -a $target/etc/fai/apt $target/etc/
if ifclass DHCPC; then
rm -f $target/etc/resolv.conf
else
echo 127.0.0.1 > $target/etc/resolv.conf
fi
# faiserver uses its own apt cache
ainsl -av /etc/apt/apt.conf.d/02proxy 'Acquire::http::Proxy "http://127.0.0.1:3142";'
# create some host entries
_nic=$(ip route | awk '/^default/ {print $5}'|head -1)
myip=$(ip -br ad sh $_nic | awk '{print $3}')
myip=${myip%/*}
ainsl /etc/hosts "$myip faiserver" # that's me
ainsl /etc/hosts "192.168.33.100 demohost"
ainsl /etc/hosts "192.168.33.101 xfcehost"
# add entries for 10 hosts called client 01 .. 10
perl -e 'for (1..10) {printf "192.168.33.%s client%02s\n",101+$_,$_;}' >> $target/etc/hosts
fai-sed '/# ReuseConnections: 1/d' /etc/apt-cacher-ng/acng.conf
ainsl -v /etc/apt-cacher-ng/acng.conf "ReuseConnections: 0"
# copy base file for faster building of nfsroot
if [ -f /var/tmp/base.tar.xz ]; then
cp -p /var/tmp/base.tar.xz $target/var/tmp
fi
if [ -d /media/mirror/pool ]; then
mkdir $target/var/cache/apt-cacher-ng/_import
cp -p /media/mirror/pool/*/*/*/*.deb $target/var/cache/apt-cacher-ng/_import
$ROOTCMD chown -R apt-cacher-ng:apt-cacher-ng /var/cache/apt-cacher-ng/_import
fi
# copy basefiles from CD to config space
if [ -d $FAI/basefiles ]; then
mkdir -p $target/srv/fai/config/basefiles
cp -vp $FAI/basefiles/*.tar.* $target/srv/fai/config/basefiles 2>/dev/null || true
fi
fi

68
scripts/GRUB_EFI/10-setup Executable file
View File

@ -0,0 +1,68 @@
#! /bin/bash
# support for GRUB version 2
error=0; trap 'error=$(($?>$error?$?:$error))' ERR # save maximum error code
# This script assumes that the disk has a GPT partition table and
# that the extended system partition (ESP) is mounted on /boot/efi.
# When building a disk image, we don't change the NVRAM to point at
# the boot image we made available, because the disk image is likely
# not installed on the current system. As a result, we force
# installation into the removable media paths as well as the standard
# debian path.
set -a
# do not set up grub during dirinstall
if [ "$FAI_ACTION" = "dirinstall" ] ; then
exit 0
fi
# during softupdate use this file
[ -r $LOGDIR/disk_var.sh ] && . $LOGDIR/disk_var.sh
if [ -z "$BOOT_DEVICE" ]; then
exit 189
fi
# disable os-prober because of #802717
ainsl /etc/default/grub 'GRUB_DISABLE_OS_PROBER=true'
# skip the rest, if not an initial installation
if [ $FAI_ACTION != "install" ]; then
$ROOTCMD update-grub
exit $error
fi
GROOT=$($ROOTCMD grub-probe -tdrive -d $BOOT_DEVICE)
# handle /boot in lvm-on-md
_bdev=$(readlink -f $BOOT_DEVICE)
if [ "${_bdev%%-*}" = "/dev/dm" ]; then
BOOT_DEVICE=$( lvs --noheadings -o devices $BOOT_DEVICE | sed -e 's/^*\([^(]*\)(.*$/\1/' )
fi
# Check if RAID is used for the boot device
if [[ $BOOT_DEVICE =~ '/dev/md' ]]; then
raiddev=${BOOT_DEVICE#/dev/}
# install grub on all members of RAID
for device in $(LC_ALL=C perl -ne 'if(/^'$raiddev'\s.+raid\d+\s(.+)/){ $_=$1; s/\d+\[\d+\]//g; print }' /proc/mdstat); do
echo Install grub on /dev/$device
$ROOTCMD grub-install --no-floppy --force-extra-removable "/dev/$device"
done
elif [[ $BOOT_DEVICE =~ '/dev/loop' ]]; then
# do not update vmram when using a loop device
$ROOTCMD grub-install --no-floppy --force-extra-removable --modules=part_gpt --no-nvram $BOOT_DEVICE
if [ $? -eq 0 ]; then
echo "Grub installed on hostdisk $BOOT_DEVICE"
fi
else
$ROOTCMD grub-install --no-floppy --modules=part_gpt "$GROOT"
if [ $? -eq 0 ]; then
echo "Grub installed on $BOOT_DEVICE = $GROOT"
fi
fi
$ROOTCMD update-grub
exit $error

84
scripts/GRUB_PC/10-setup Executable file
View File

@ -0,0 +1,84 @@
#! /bin/bash
# support for GRUB version 2
error=0; trap 'error=$(($?>$error?$?:$error))' ERR # save maximum error code
set -a
# do not set up grub during dirinstall
if [ "$FAI_ACTION" = "dirinstall" ] ; then
exit 0
fi
# during softupdate use this file
[ -r $LOGDIR/disk_var.sh ] && . $LOGDIR/disk_var.sh
if [ -z "$BOOT_DEVICE" ]; then
exit 189
fi
# disable os-prober because of #802717
ainsl /etc/default/grub 'GRUB_DISABLE_OS_PROBER=true'
# skip the rest, if not an initial installation
if [ $FAI_ACTION != "install" ]; then
$ROOTCMD update-grub
exit $error
fi
get_stable_devname() {
local _DEV="$1"
local i
declare -a _RES
# prefer SCSI over ATA over WWN over path
# do not use by-path
for i in $($ROOTCMD udevadm info -r --query=symlink "$_DEV"); do
if [[ "$i" =~ /by-id/scsi ]]; then
_RES[10]="$i"
elif [[ "$i" =~ /by-id/ata ]]; then
_RES[20]="$i"
elif [[ "$i" =~ /by-id/wwn ]]; then
_RES[99]="$i"
fi
done
echo "${_RES[@]::1}"
}
# handle /boot in lvm-on-md
_bdev=$(readlink -f $BOOT_DEVICE)
if [ "${_bdev%%-*}" = "/dev/dm" ]; then
BOOT_DEVICE=$( lvs --noheadings -o devices $BOOT_DEVICE | sed -e 's/^*\([^(]*\)(.*$/\1/' )
fi
# Check if RAID is used for the boot device
if [[ $BOOT_DEVICE =~ '/dev/md' ]]; then
raiddev=${BOOT_DEVICE#/dev/}
# install grub on all members of RAID
for device in $(LC_ALL=C perl -ne 'if(/^'$raiddev'\s.+raid\d+\s(.+)/){ $_=$1; s/\d+\[\d+\]//g; s/(nvme.+?)p/$1/g; print }' /proc/mdstat); do
pdevice=$(get_stable_devname /dev/$device)
if [ -z "$pdevice" ]; then
# if we cannot find a persistent name (for e.g. in a VM) use old name
pdevice="/dev/$device"
fi
mbrdevices+="$pdevice, "
echo Installing grub on /dev/$device = $pdevice
$ROOTCMD grub-install --no-floppy "/dev/$device"
done
# remove last ,
mbrdevices=${mbrdevices%, }
else
mbrdevices=$(get_stable_devname $BOOT_DEVICE)
if [ -z "$mbrdevices" ]; then
# if we cannot find a persistent name (for e.g. in a VM) use old name
mbrdevices=$BOOT_DEVICE
fi
echo "Installing grub on $BOOT_DEVICE = $mbrdevices"
$ROOTCMD grub-install --no-floppy "$mbrdevices"
fi
echo "grub-pc grub-pc/install_devices multiselect $mbrdevices" | $ROOTCMD debconf-set-selections
$ROOTCMD dpkg-reconfigure grub-pc
exit $error

View File

@ -0,0 +1,3 @@
#!/bin/bash
$ROOTCMD rm -f /etc/apt/apt.conf.d/00-proxy

View File

@ -0,0 +1,13 @@
#!/bin/bash
# allow configure NICs globally over network manager
#$ROOTCMD touch /etc/NetworkManager/conf.d/10-globally-managed-devices.conf
# enable resolved
$ROOTCMD systemctl enable systemd-resolved
$ROOTCMD tee /etc/netplan/01-network-manager-all.yaml <<EOF
# NetworkManager should configure all network devices
network:
version: 2
renderer: NetworkManager
EOF

View File

@ -0,0 +1,13 @@
#!/bin/bash
#$ROOTCMD apt update -y
#$ROOTCMD apt upgrade -y
if [ "xSUPRESS_GNOME_INITIAL_SCREEN" = "x1" ] ; then
$ROOTCMD tee /home/demo/.config/gnome-initial-setup-done <<EOF
yes
EOF
$ROOTCMD chown -Rc demo:demo /home/demo
fi

Some files were not shown because too many files have changed in this diff Show More