aboutsummaryrefslogtreecommitdiff
path: root/fai/config/scripts
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/scripts
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/scripts')
-rwxr-xr-xfai/config/scripts/DEBIAN/10-rootpw15
-rwxr-xr-xfai/config/scripts/DEBIAN/20-capabilities22
-rwxr-xr-xfai/config/scripts/DEBIAN/30-interface118
-rwxr-xr-xfai/config/scripts/DEBIAN/40-misc50
-rwxr-xr-xfai/config/scripts/EDU/10-update-debian-edu-config6
-rwxr-xr-xfai/config/scripts/EDU/40-cfengine-install-workstation27
-rwxr-xr-xfai/config/scripts/FAIBASE/10-misc36
-rwxr-xr-xfai/config/scripts/FAIBASE/20-removable_media27
-rwxr-xr-xfai/config/scripts/GERMAN/10-update-debian-edu-config7
-rwxr-xr-xfai/config/scripts/GRUB_EFI/10-setup68
-rwxr-xr-xfai/config/scripts/GRUB_PC/10-setup52
-rwxr-xr-xfai/config/scripts/LAST/50-misc103
-rwxr-xr-xfai/config/scripts/WORKSTATION/10-update-debian-edu-config6
13 files changed, 537 insertions, 0 deletions
diff --git a/fai/config/scripts/DEBIAN/10-rootpw b/fai/config/scripts/DEBIAN/10-rootpw
new file mode 100755
index 0000000..8fdf4c8
--- /dev/null
+++ b/fai/config/scripts/DEBIAN/10-rootpw
@@ -0,0 +1,15 @@
+#! /bin/bash
+
+error=0; trap 'error=$(($?>$error?$?:$error))' ERR # save maximum error code
+
+# set root password
+if [ -n "$ROOTPW" ]; then
+ $ROOTCMD usermod -p "$ROOTPW" root
+else
+ $ROOTCMD usermod -L root
+ # enable sudo for user
+ ainsl /etc/sudoers "$username ALL = ALL"
+fi
+
+exit $error
+
diff --git a/fai/config/scripts/DEBIAN/20-capabilities b/fai/config/scripts/DEBIAN/20-capabilities
new file mode 100755
index 0000000..ea650fa
--- /dev/null
+++ b/fai/config/scripts/DEBIAN/20-capabilities
@@ -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
diff --git a/fai/config/scripts/DEBIAN/30-interface b/fai/config/scripts/DEBIAN/30-interface
new file mode 100755
index 0000000..34c98e8
--- /dev/null
+++ b/fai/config/scripts/DEBIAN/30-interface
@@ -0,0 +1,118 @@
+#! /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 $IPADDR"
+ echo " netmask $NETMASK"
+ echo " broadcast $BROADCAST"
+ echo " gateway $GATEWAYS"
+ ;;
+ esac
+}
+
+newnicnames() {
+
+ # determine predictable network names only for stretch and above
+
+ [ $do_init_tasks -eq 0 ] && return
+ [ -z "$NIC1" ] && return
+ ver=$($ROOTCMD dpkg-query --showformat='${Version}' --show udev)
+ if dpkg --compare-versions $ver lt 220-7; then
+ return
+ fi
+
+
+ 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
+ break
+ fi
+ done
+ if [[ ! $name ]]; then
+ 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 -o -f inet addr show $NIC1 | awk '{print $4}')
+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
diff --git a/fai/config/scripts/DEBIAN/40-misc b/fai/config/scripts/DEBIAN/40-misc
new file mode 100755
index 0000000..4376ab4
--- /dev/null
+++ b/fai/config/scripts/DEBIAN/40-misc
@@ -0,0 +1,50 @@
+#! /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
+ sed -i -e 's:^LOCAL$:UTC:' $target/etc/adjtime
+else
+ sed -i -e 's:^UTC$:LOCAL:' $target/etc/adjtime
+fi
+
+# enable linuxlogo
+if [ -f $target/etc/inittab ]; then
+ sed -i -e 's#/sbin/getty 38400#/sbin/getty -f /etc/issue.linuxlogo 38400#' ${target}/etc/inittab
+elif [ -f $target/lib/systemd/system/getty@.service ]; then
+ sed -i -e 's#sbin/agetty --noclear#sbin/agetty -f /etc/issue.linuxlogo --noclear#' $target/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 /bin/systemd-machine-id-setup ]; then
+ $ROOTCMD systemd-machine-id-setup
+fi
+
+ln -fs /proc/mounts $target/etc/mtab
+
+rm -f $target/etc/dpkg/dpkg.cfg.d/fai $target/etc/dpkg/dpkg.cfg.d/unsafe-io
+
+if [ -d /etc/fai ]; then
+ ainsl -a /etc/fai/fai.conf "FAI_CONFIG_SRC=$FAI_CONFIG_SRC"
+ fcopy -Miv /etc/fai/fai.conf
+fi
+fcopy -iv /etc/rc.local
+
+exit $error
diff --git a/fai/config/scripts/EDU/10-update-debian-edu-config b/fai/config/scripts/EDU/10-update-debian-edu-config
new file mode 100755
index 0000000..4cf18d7
--- /dev/null
+++ b/fai/config/scripts/EDU/10-update-debian-edu-config
@@ -0,0 +1,6 @@
+#!/bin/bash
+
+if [ -f /etc/debian-edu/config ] && [ -x /usr/share/doc/debian-edu-install ]; then
+ sed -i /etc/debian-edu/config -e "s/^VERSION=.*$/VERSION=\"$(/usr/lib/debian-edu-install/version)\"/"
+fi
+
diff --git a/fai/config/scripts/EDU/40-cfengine-install-workstation b/fai/config/scripts/EDU/40-cfengine-install-workstation
new file mode 100755
index 0000000..9a1ff13
--- /dev/null
+++ b/fai/config/scripts/EDU/40-cfengine-install-workstation
@@ -0,0 +1,27 @@
+#! /bin/bash
+
+set -x
+
+# Let's make sure that we have correct http proxy settings.
+if [ -x $target/usr/share/debian-edu-config/tools/update-proxy-from-wpad ]; then
+ chroot $target /usr/share/debian-edu-config/tools/update-proxy-from-wpad
+fi
+
+# The proxy settings should not have been written to /etc/environment.
+# Let's export those settings to the current shell, so that cf-agent
+# has them...
+for line in $(cat $target/etc/environment | grep -v -E "^#.*" | grep -E ".+=.*"); do
+ export $line;
+done
+
+# Now let's assume, we have http_proxy, https_proxy and ftp_proxy set in our
+# environment. We need to pass them on into the chroot...
+
+echo http_proxy=$http_proxy
+echo https_proxy=$https_proxy
+echo ftp_proxy=$ftp_proxy
+
+# Do the conversion of the vanilla Debian system to a Debian Edu system
+chroot $target strace -f /usr/sbin/cf-agent -I -D installation
+
+set +x
diff --git a/fai/config/scripts/FAIBASE/10-misc b/fai/config/scripts/FAIBASE/10-misc
new file mode 100755
index 0000000..fbf85c1
--- /dev/null
+++ b/fai/config/scripts/FAIBASE/10-misc
@@ -0,0 +1,36 @@
+#! /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
+ ln -sf /usr/share/zoneinfo/${TIMEZONE} $target/etc/localtime
+else
+ cp -f /usr/share/zoneinfo/${TIMEZONE} $target/etc/localtime
+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
+
+if [ -f $target/etc/hosts.orig ]; then
+ mv $target/etc/hosts.orig $target/etc/hosts
+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
+ainsl /etc/fstab "tmpfs /tmp tmpfs nodev,nosuid,size=50%,mode=1777 0 0"
+chmod -c 1777 ${target}/tmp
+chown -c 0:0 ${target}/tmp
+
+exit $error
diff --git a/fai/config/scripts/FAIBASE/20-removable_media b/fai/config/scripts/FAIBASE/20-removable_media
new file mode 100755
index 0000000..4ba258f
--- /dev/null
+++ b/fai/config/scripts/FAIBASE/20-removable_media
@@ -0,0 +1,27 @@
+#! /bin/bash
+
+# (c) Thomas Lange, 2006,2009, lange@debian.org
+# create entries for removable media in fstab and directories in /media
+
+[ -b $target/dev/fd0 ] && ainsl /etc/fstab "/dev/fd0 /media/floppy auto users,noauto 0 0"
+
+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
diff --git a/fai/config/scripts/GERMAN/10-update-debian-edu-config b/fai/config/scripts/GERMAN/10-update-debian-edu-config
new file mode 100755
index 0000000..d896799
--- /dev/null
+++ b/fai/config/scripts/GERMAN/10-update-debian-edu-config
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+if [ -f $target/etc/debian-edu/config ]; then
+ sed -i $target/etc/debian-edu/config -e "s/^LANGCODE=.*$/LANGCODE=\"de\"/"
+ sed -i $target/etc/debian-edu/config -e "s/^LOCALE=.*$/LOCALE=\"de_DE.UTF-8\"/"
+fi
+
diff --git a/fai/config/scripts/GRUB_EFI/10-setup b/fai/config/scripts/GRUB_EFI/10-setup
new file mode 100755
index 0000000..f586ba1
--- /dev/null
+++ b/fai/config/scripts/GRUB_EFI/10-setup
@@ -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 #788062
+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
diff --git a/fai/config/scripts/GRUB_PC/10-setup b/fai/config/scripts/GRUB_PC/10-setup
new file mode 100755
index 0000000..5563275
--- /dev/null
+++ b/fai/config/scripts/GRUB_PC/10-setup
@@ -0,0 +1,52 @@
+#! /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 #788062
+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 "/dev/$device"
+ done
+else
+ $ROOTCMD grub-install --no-floppy "$GROOT"
+ if [ $? -eq 0 ]; then
+ echo "Grub installed on $BOOT_DEVICE = $GROOT"
+ fi
+fi
+$ROOTCMD update-grub
+
+exit $error
diff --git a/fai/config/scripts/LAST/50-misc b/fai/config/scripts/LAST/50-misc
new file mode 100755
index 0000000..eebb379
--- /dev/null
+++ b/fai/config/scripts/LAST/50-misc
@@ -0,0 +1,103 @@
+#! /bin/bash
+
+# copyright Thomas Lange 2001-2016, lange@debian.org
+
+error=0; trap 'error=$(($?>$error?$?:$error))' ERR # save maximum error code
+
+if [ "$FAI_ACTION" = "dirinstall" -o $do_init_tasks -eq 0 ] ; then
+ :
+else
+ # check if mdadm has been forgotten
+ if grep -q active /proc/mdstat 2>/dev/null; then
+ if [ ! -d $target/etc/mdadm ]; then
+ echo ERROR: Found Software RAID, but the mdadm package was not installed
+ error=1
+ fi
+ fi
+
+ usedm=$(dmsetup ls 2>/dev/null | egrep -v '^live-rw|^live-base|^No devices found' | wc -l)
+ if [ $usedm -ne 0 ]; then
+ if [ ! -d $target/etc/lvm ]; then
+ echo ERROR: Found lvm devices, but the lvm2 package was not installed
+ error=1
+ fi
+ fi
+fi
+
+# remove backup files from cfengine, but only if cfengine is installed
+if [ -x /usr/sbin/cfagent ] || [ -x $target/usr/sbin/cfagent ] ; then
+ dirs="root etc var"
+ for path in $dirs; do
+ find $target/$path -maxdepth 20 -name \*.cfedited -o -name \*.cfsaved | xargs -r rm
+ done
+fi
+
+[ "$FAI_DEBMIRROR" ] &&
+ ainsl /etc/fstab "#$FAI_DEBMIRROR $MNTPOINT nfs ro 0 0"
+
+# set bios clock
+if [ $do_init_tasks -eq 1 ] ; then
+ case "$UTC" in
+ no|"") hwopt="--localtime" ;;
+ yes) hwopt="--utc" ;;
+ esac
+ hwclock $hwopt --systohc || true
+fi
+
+# Make sure everything is configured properly
+if ifclass DEBIAN ; then
+ $ROOTCMD apt-get -f install
+fi
+
+if [ $FAI_ACTION = "install" ]; then
+ lskernels=$(echo $target/boot/vmlinu*)
+ if [ ! -f ${lskernels%% *} ]; then
+ echo "ERROR: No kernel was installed. Have a look at shell.log" >&2
+ error=1
+ fi
+fi
+
+# copy sources.list
+fcopy -iSM /etc/apt/sources.list
+
+
+setrel() {
+
+ # if release is not set, try to determine it
+
+ if [ -n "$release" ]; then
+ return
+ fi
+ if [ ! -f $target/etc/os-release ]; then
+ return
+ fi
+
+ dists="jessie stretch buster bullseye bookworm bionic xenial trusty"
+ for d in $dists; do
+ if grep -iq $d $target/etc/os-release; then
+ release=$d
+ break
+ fi
+ done
+}
+
+# if installation was done from CD, replace useless sources.list
+setrel
+if [ -f $target/etc/apt/sources.list -a -n "$release" ]; then
+ grep -q 'file generated by fai-cd' $target/etc/apt/sources.list && cat <<EOF > $target/etc/apt/sources.list
+deb $apt_cdn/debian $release main contrib non-free
+deb $apt_cdn/debian-security $release/updates main contrib non-free
+#deb [trusted=yes] http://fai-project.org/download $release koeln
+EOF
+ # if the package fai-server was installed, enable the project's repository
+ if [ -f $target/var/lib/dpkg/info/fai-server.list ]; then
+ sed -i -e '/fai-project.org/s/^#//' $target/etc/apt/sources.list
+ fi
+fi
+
+# for ARM architecture, we may need the kernel and initrd to boot or flash the device
+if ifclass ARM64; then
+ cp -pv $target/boot/vmlinuz* $target/boot/initrd* $FAI_RUNDIR
+fi
+
+exit $error
diff --git a/fai/config/scripts/WORKSTATION/10-update-debian-edu-config b/fai/config/scripts/WORKSTATION/10-update-debian-edu-config
new file mode 100755
index 0000000..45062b9
--- /dev/null
+++ b/fai/config/scripts/WORKSTATION/10-update-debian-edu-config
@@ -0,0 +1,6 @@
+#!/bin/bash
+
+# tag Debian Edu machine as a workstation
+if [ -f /etc/debian-edu/config ]; then
+ sed -i /etc/debian-edu/config -e "s/^PROFILE=.*$/PROFILE=\"Workstation\"/"
+fi