Version in base suite: 5.10.3 Base version: fai_5.10.3 Target version: fai_6.0.3+deb12u1 Base file: /srv/ftp-master.debian.org/ftp/pool/main/f/fai/fai_5.10.3.dsc Target file: /srv/ftp-master.debian.org/policy/pool/main/f/fai/fai_6.0.3+deb12u1.dsc Makefile | 11 NEWS | 20 + README | 8 bin/ainsl | 2 bin/dhcp-edit | 4 bin/fai | 23 + bin/fai-cd | 26 + bin/fai-chboot | 16 - bin/fai-class | 12 bin/fai-debconf | 2 bin/fai-diskimage | 30 +- bin/fai-do-scripts | 48 ++- bin/fai-make-nfsroot | 81 +++--- bin/fai-mirror | 14 - bin/fai-monitor | 2 bin/fai-monitor-gui | 2 bin/fai-setup | 9 bin/fcopy | 10 bin/ftar | 6 bin/install_packages | 130 +++++---- bin/setup-storage | 14 - conf/NFSROOT | 18 - conf/fai.conf | 7 conf/grub.cfg | 64 +++- conf/nfsroot.conf | 2 conf/sources.list | 13 debian/changelog | 149 ++++++++++- debian/control | 12 debian/copyright | 2 debian/fai-doc.doc-base.package | 3 debian/fai-nfsroot.install | 1 debian/rules | 3 debian/tests/common.sh | 64 ++++ debian/tests/config-space | 19 + debian/tests/control | 24 + debian/tests/dirinstall | 45 +++ debian/tests/diskimage | 91 ++++++ debian/tests/fai-cd | 22 + debian/tests/fai-cd-tests | 22 + debian/tests/fai-mirror | 34 ++ debian/tests/fcopy | 12 debian/tests/nfsroot | 42 +++ debian/tests/utils | 30 ++ debian/watch | 4 dev-utils/fai-kvm | 26 + dev-utils/fai-mk-network | 34 -- doc/Makefile | 9 doc/fai-guide.txt | 87 +++--- doc/includes/fai-1st-part.txt | 4 doc/setup-storage-overview.txt | 17 - examples/etc/netgroup | 43 --- examples/simple/basefiles/mk-basefile | 41 ++- examples/simple/class/20-hwdetect.sh | 13 examples/simple/class/40-parse-profiles.sh | 6 examples/simple/class/50-host-classes | 14 - examples/simple/class/60-misc | 2 examples/simple/class/85-efi-classes | 4 examples/simple/class/CENTOS.var | 9 examples/simple/class/DEBIAN.var | 23 + examples/simple/class/FAIBASE.var | 7 examples/simple/class/ROCKY.var | 9 examples/simple/class/UBUNTU.var | 2 examples/simple/class/example.profile | 14 - examples/simple/disk_config/CENTOS | 16 - examples/simple/disk_config/CLOUD_EFI | 8 examples/simple/disk_config/FAIBASE | 3 examples/simple/disk_config/FAIBASE_EFI | 13 examples/simple/disk_config/FAISERVER_EFI | 14 - examples/simple/disk_config/LVM | 4 examples/simple/disk_config/LVM_EFI | 8 examples/simple/disk_config/ROCKY | 13 examples/simple/files/etc/fai/nfsroot.conf/FAISERVER | 2 examples/simple/files/etc/rc.local/FAISERVER | 8 examples/simple/files/etc/selinux/config/CENTOS | 12 examples/simple/files/etc/selinux/config/ROCKY | 12 examples/simple/hooks/debconf.CENTOS | 3 examples/simple/hooks/debconf.IMAGE | 6 examples/simple/hooks/debconf.ROCKY | 3 examples/simple/hooks/repository.CENTOS | 31 -- examples/simple/hooks/repository.ROCKY | 31 ++ examples/simple/hooks/savelog.LAST.sh | 2 examples/simple/hooks/updatebase.CENTOS | 25 - examples/simple/hooks/updatebase.DEBIAN | 5 examples/simple/hooks/updatebase.ROCKY | 25 + examples/simple/package_config/CENTOS | 30 -- examples/simple/package_config/DEBIAN | 23 - examples/simple/package_config/ROCKY | 38 ++ examples/simple/package_config/STANDARD | 6 examples/simple/package_config/UBUNTU | 24 - examples/simple/scripts/CENTOS/10-security | 14 - examples/simple/scripts/CENTOS/30-mkinitrd | 25 - examples/simple/scripts/CENTOS/40-install-grub | 96 ------- examples/simple/scripts/CENTOS/50-sysconfig | 29 -- examples/simple/scripts/CENTOS/60-network-scripts | 40 -- examples/simple/scripts/CENTOS/80-misc | 21 - examples/simple/scripts/CENTOS/90-cleanup | 3 examples/simple/scripts/CLOUD/99-cleanup | 9 examples/simple/scripts/DEBIAN/30-interface | 1 examples/simple/scripts/DEBIAN/40-misc | 12 examples/simple/scripts/DEMO/10-misc | 4 examples/simple/scripts/FAIBASE/10-misc | 2 examples/simple/scripts/FAIBASE/15-root-ssh-key | 35 ++ examples/simple/scripts/FAISERVER/10-conffiles | 4 examples/simple/scripts/GRUB_EFI/10-setup | 10 examples/simple/scripts/GRUB_PC/10-setup | 10 examples/simple/scripts/LAST/50-misc | 24 + examples/simple/scripts/ROCKY/10-security | 14 + examples/simple/scripts/ROCKY/30-mkinitrd | 25 + examples/simple/scripts/ROCKY/40-install-grub | 87 ++++++ examples/simple/scripts/ROCKY/50-sysconfig | 35 ++ examples/simple/scripts/ROCKY/60-network-scripts | 81 ++++++ examples/simple/scripts/ROCKY/80-misc | 21 + examples/simple/scripts/ROCKY/90-cleanup | 3 examples/simple/tests/Faitest.pm | 2 lib/check-cross-arch | 11 lib/dracut/80fai-autodiscover/module-setup.sh | 2 lib/fai-abort | 3 lib/fai-divert | 4 lib/fai-savelog | 2 lib/fetch-basefile | 7 lib/get-boot-info | 13 lib/get-config-dir-http | 2 lib/get-config-dir-https | 2 lib/get-config-dir-scp | 2 lib/get-config-dir-sftp | 2 lib/mkramdisk | 7 lib/mount2dir | 4 lib/prcopyleft | 4 lib/setup-storage/Commands.pm | 113 +++----- lib/setup-storage/Exec.pm | 34 -- lib/setup-storage/Fstab.pm | 36 ++ lib/setup-storage/Init.pm | 1 lib/setup-storage/Parser.pm | 23 + lib/setup-storage/Sizes.pm | 1 lib/setup-storage/Volumes.pm | 254 +++---------------- lib/subroutines | 134 ++++++---- lib/task_inventory | 10 lib/task_sysinfo | 36 +- lib/udev.patch | 11 lib/updatebase | 5 man/ainsl.1 | 2 man/fai-cd.8 | 5 man/fai-chboot.8 | 18 + man/fai-class.1 | 2 man/fai-debconf.1 | 2 man/fai-diskimage.8 | 6 man/fai-do-scripts.1 | 14 - man/fai-link.1 | 2 man/fai-make-nfsroot.8 | 11 man/fai-mirror.1 | 2 man/fai-mk-configspace.1 | 2 man/fai-monitor-gui.1 | 2 man/fai-monitor.8 | 2 man/fai-sed.1 | 2 man/fai-setup.8 | 2 man/fai-statoverride.8 | 2 man/fai.8 | 2 man/fai.conf.5 | 10 man/fcopy.8 | 6 man/ftar.8 | 2 man/install_packages.8 | 2 man/nfsroot.conf.5 | 11 man/setup-storage.8 | 242 +++++++++--------- utils/mkdebmirror | 8 164 files changed, 2120 insertions(+), 1451 deletions(-) diff -Nru fai-5.10.3/Makefile fai-6.0.3+deb12u1/Makefile --- fai-5.10.3/Makefile 2021-04-14 13:02:27.000000000 +0000 +++ fai-6.0.3+deb12u1/Makefile 2023-06-23 20:43:21.000000000 +0000 @@ -75,7 +75,7 @@ install: mkdir -p $(DESTDIR)/{sbin,man} $(DESTDIR)/etc/{modutils,apt/apt.conf.d} mkdir -p $(DESTDIR)/usr/{sbin,bin} $(DESTDIR)/usr/lib/fai $(DESTDIR)/etc/fai/apt/trusted.gpg.d - mkdir -p $(DESTDIR)/etc/{init,init.d} $(DESTDIR)/usr/share/fai/{pixmaps/small,setup-storage} + mkdir -p $(DESTDIR)/etc/{init,init.d} $(SHAREDIR)/{pixmaps/small,setup-storage} mkdir -p $(DESTDIR)/usr/lib/dracut/modules.d install man/* $(DESTDIR)/man pod2man -c '' -r '' -s8 bin/dhcp-edit > $(DESTDIR)/man/dhcp-edit.8 @@ -84,12 +84,13 @@ -install $(libfiles) $(LIBDIR) cp -a lib/dracut/80fai-autodiscover $(DESTDIR)/usr/lib/dracut/modules.d install lib/setup-storage/* $(SHAREDIR)/setup-storage + install -m644 lib/udev.patch $(SHAREDIR)/ cd bin ; install $(USRSBIN_SCRIPTS) $(DESTDIR)/usr/sbin cd bin ; install $(USRBIN_SCRIPTS) $(DESTDIR)/usr/bin install dev-utils/fai-kvm $(DESTDIR)/usr/bin install dev-utils/fai-mk-network $(DESTDIR)/usr/sbin - install bin/dhclient-fai-script $(DESTDIR)/usr/share/fai - install -m644 conf/dhclient-fai.conf $(DESTDIR)/usr/share/fai + install bin/dhclient-fai-script $(SHAREDIR)/ + install -m644 conf/dhclient-fai.conf $(SHAREDIR)/ install -m644 conf/apt.conf $(DESTDIR)/etc/apt/apt.conf.d/90fai cd conf ; install -m644 fai.conf grub.cfg grub.cfg.autodiscover $(DESTDIR)/etc/fai/ install -m644 conf/nfsroot.conf $(DESTDIR)/etc/fai/ @@ -97,8 +98,8 @@ install -m644 conf/fai-project.gpg $(DESTDIR)/etc/fai/apt/trusted.gpg.d/ install -m644 conf/NFSROOT $(DESTDIR)/etc/fai install -m755 lib/fai-abort $(DESTDIR)/etc/init.d - cp -a pixmaps/*.gif $(DESTDIR)/usr/share/fai/pixmaps - cp -a pixmaps/small/*.gif $(DESTDIR)/usr/share/fai/pixmaps/small + cp -a pixmaps/*.gif $(SHAREDIR)/pixmaps + cp -a pixmaps/small/*.gif $(SHAREDIR)/pixmaps/small sed -i 's/FAIVERSIONSTRING/$(VERSIONSTRING)/' $(DESTDIR)/usr/sbin/fai cp -a examples $(DOCDIR) rm -f $(DOCDIR)/examples/simple/.git diff -Nru fai-5.10.3/NEWS fai-6.0.3+deb12u1/NEWS --- fai-5.10.3/NEWS 2021-05-01 20:23:53.000000000 +0000 +++ fai-6.0.3+deb12u1/NEWS 2022-11-12 23:32:00.000000000 +0000 @@ -1,3 +1,23 @@ +fai (6.0) unstable; urgency=low + + * enhance disk_config format for partition label support + * support partition labels and partition uuids in fstab + * support for Alpine Linux and Arch Linux package managers + * use zstd instead of gzip + * add support for release specification in PACKAGES line + via release= + * fai-chboot: variable substitution for $IP and $HOST when coping a + template + * all customization scripts now write to scripts.log. The old + behaviour can be enable by setting $FAI_USE_OLD_SCRIPT_LOGS + * drop support of .asc signatures of your repository, use .gpg + instead + * add support for NVme devices in fai-kvm + * rename CENTOS classes to ROCKY + * add ssh key for root remote access using classes + + -- Thomas Lange Sun, 13 Nov 2022 00:17:41 +0100 + fai (5.10) unstable; urgency=low * fai-sed: change exit value if file was changed, add options -E, -n diff -Nru fai-5.10.3/README fai-6.0.3+deb12u1/README --- fai-5.10.3/README 2021-05-01 20:23:53.000000000 +0000 +++ fai-6.0.3+deb12u1/README 2023-06-23 20:43:21.000000000 +0000 @@ -9,9 +9,9 @@ needs, without any interaction necessary. It can be used for creating custom disk images used in virtual machines or on a cloud-computing platform. FAI uses Debian Linux but it can install and deploy multiple -distributions like Debian, Ubuntu, CentOS, RHEL and SUSE. Changes to -the configuration files of the operating system can be made by shell -or Perl scripts or any other configuration software. +distributions like Debian, Ubuntu, Rocky Linux, CentOS, RHEL and SUSE. +Changes to the configuration files of the operating system can be made +by shell or Perl scripts or any other configuration software. The home page for FAI is @@ -47,4 +47,4 @@ My GPG Key is: 4096R/074BCDE4 B11E E327 3F6B 2DEB 528C 93DA 2BF8 D9FE 074B CDE4 -------------------------------------------------------------------------------- -Copyright (c) 1999-2021 Thomas Lange. All rights reserved. +Copyright (c) 1999-2022 Thomas Lange. All rights reserved. diff -Nru fai-5.10.3/bin/ainsl fai-6.0.3+deb12u1/bin/ainsl --- fai-5.10.3/bin/ainsl 2014-05-21 13:46:46.000000000 +0000 +++ fai-6.0.3+deb12u1/bin/ainsl 2022-10-28 18:48:42.000000000 +0000 @@ -5,7 +5,7 @@ # ainsl -- AppendIfNoSuchLine written in Perl # # This script is part of FAI (Fully Automatic Installation) -# Copyright (C) 2006-2012 Thomas Lange, lange@informatik.uni-koeln.de +# Copyright (C) 2006-2012 Thomas Lange, lange@cs.uni-koeln.de # Universitaet zu Koeln # #********************************************************************* diff -Nru fai-5.10.3/bin/dhcp-edit fai-6.0.3+deb12u1/bin/dhcp-edit --- fai-5.10.3/bin/dhcp-edit 2018-01-19 13:00:17.000000000 +0000 +++ fai-6.0.3+deb12u1/bin/dhcp-edit 2022-10-28 18:48:42.000000000 +0000 @@ -5,7 +5,7 @@ # dhcp-edit -- managing dhcpd entries made easy # # This script is part of FAI (Fully Automatic Installation) -# Copyright (C) 2010-2015 Thomas Lange, lange@informatik.uni-koeln.de +# Copyright (C) 2010-2015 Thomas Lange, lange@cs.uni-koeln.de # Universitaet zu Koeln # #********************************************************************* @@ -202,6 +202,6 @@ =head1 COPYRIGHT -This program is Copyright (C) 2010-2015 by Thomas Lange +This program is Copyright (C) 2010-2015 by Thomas Lange =cut diff -Nru fai-5.10.3/bin/fai fai-6.0.3+deb12u1/bin/fai --- fai-5.10.3/bin/fai 2021-05-22 15:45:06.000000000 +0000 +++ fai-6.0.3+deb12u1/bin/fai 2023-06-24 10:57:09.000000000 +0000 @@ -5,7 +5,7 @@ # fai -- main installation script executed after booting # # This script is part of FAI (Fully Automatic Installation) -# (c) 1999-2021 by Thomas Lange, lange@informatik.uni-koeln.de +# (c) 1999-2022 by Thomas Lange, lange@cs.uni-koeln.de # Universitaet zu Koeln # (c) 2001-2005 by Henning Glawe, glaweh@physik.fu-berlin.de # Freie Universitaet Berlin @@ -87,8 +87,17 @@ if [ -z "$FAI_ROOT" ] ; then [ $do_init_tasks -eq 1 ] && FAI_ROOT=/target || FAI_ROOT=/ fi - # executed command in the environment of the new system - ROOTCMD="unshare --pid --fork --kill-child --mount-proc chroot $FAI_ROOT" + # ROOTCMD will execute a command in the environment of the new system + # if ROOTCMD was set from outside, do not touch it + if [ -z "$ROOTCMD" ]; then + # check if unshare can be used (e.g. not possible in some container environments) + unshare --fork --kill-child --mount-proc chroot / ls >/dev/null 2>&1 + if [ $? -eq 0 ]; then + ROOTCMD="unshare --pid --fork --kill-child --mount-proc chroot $FAI_ROOT" + else + ROOTCMD="chroot $FAI_ROOT" + fi + fi # no chroot needed [ "$FAI_ROOT" = '/' ] && ROOTCMD= target=$FAI_ROOT @@ -144,7 +153,7 @@ # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - usage() { cat <<-EOF - fai $FAI_VERSION. Copyright (C) 1999-2021 Thomas Lange + fai $FAI_VERSION. Copyright (C) 1999-2022 Thomas Lange Usage: $0 [options] [action] Options: @@ -171,9 +180,9 @@ # if the config space is a local directory, reset $FAI local method=$(expr match "$FAI_CONFIG_SRC" '\([^+]*\).*://') if [ $method = "file" ]; then - local localpath=$(expr match "$FAI_CONFIG_SRC" '.*://\(/.*\)') - export FAI=$localpath + export FAI=$(expr match "$FAI_CONFIG_SRC" '.*://\(/.*\)') fi + unset method task setup task defclass unset renewclass @@ -302,7 +311,7 @@ read hname < /proc/sys/kernel/hostname if [ -z "$HOSTNAME" -o $HOSTNAME = '(none)' -o -z "$hname" ]; then _nic=$(ip route | awk '/^default/ {print $5}'|head -1) - myip=$(ip -br ad sh $_nic | awk '{print $3}') + myip=$(ip -4 -br ad sh $_nic | awk '{print $3}') myip=${myip%/*} myip=${myip//./-} if [ -n "$myip" ]; then diff -Nru fai-5.10.3/bin/fai-cd fai-6.0.3+deb12u1/bin/fai-cd --- fai-5.10.3/bin/fai-cd 2021-05-01 20:23:53.000000000 +0000 +++ fai-6.0.3+deb12u1/bin/fai-cd 2023-06-23 20:43:21.000000000 +0000 @@ -5,7 +5,7 @@ # fai-cd -- make a fai CD, a bootable CD that performs the FAI # # This script is part of FAI (Fully Automatic Installation) -# (c) 2004-2020 by Thomas Lange, lange@informatik.uni-koeln.de +# (c) 2004-2022 by Thomas Lange, lange@cs.uni-koeln.de # Universitaet zu Koeln # Support for grub2 added by Sebastian Hetze, s.hetze@linux-ag.de # with major support from Michael Prokop, prokop@grml-solutions.com @@ -60,7 +60,7 @@ usage() { cat <<-EOF - fai-cd Copyright (C) 2004-2020 Thomas Lange + fai-cd Copyright (C) 2004-2022 Thomas Lange Usage: fai-cd [OPTIONS] -m MIRRORDIR ISONAME Usage: fai-cd [OPTIONS] -B ISONAME @@ -144,20 +144,22 @@ # - - - - - - - - - - - - - - - - - - - - - - - - - - create_autodiscover_iso() { + local compress + # boot-only CD does not need those dracut modules cat < $ONFSROOT/etc/dracut.conf.d/02-omit.conf omit_dracutmodules+=" fs-lib livenet rootfs-block " EOF - if [ -n "$sqopt" ]; then + if [ -n "$_OPTJ" ]; then compress="--xz" else - compress=--compress='gzip -1' + compress="--zstd" fi mv $ONFSROOT/boot/initrd.img* $ONFSROOT/tmp hide_dirs mountpoint -q $ONFSROOT/proc || mount --bind /proc $ONFSROOT/proc - chroot $ONFSROOT dracut --add 'fai-autodiscover' "$compress" /boot/initrd.img-$rel $rel 2>/dev/null + TMPDIR=/tmp chroot $ONFSROOT dracut --add 'fai-autodiscover' "$compress" /boot/initrd.img-$rel $rel 2>/dev/null umount $ONFSROOT/proc unhide_dirs rm -f $ONFSROOT/etc/dracut.conf.d/02-omit.conf @@ -196,7 +198,7 @@ perl -pi -e "s|FAI_CONFIG_SRC=(.*?)\S+|FAI_CONFIG_SRC=$config_space|" $NFSROOT/tmp/grub.cfg fi - chroot $NFSROOT grub-mkstandalone \ + TMPDIR=tmp chroot $NFSROOT grub-mkstandalone \ --format=x86_64-efi \ --output=/tmp/bootx64.efi \ --locales="" --fonts="" \ @@ -211,11 +213,11 @@ die 11 "No grub-efi-amd64-bin installation found in NFSROOT. Aborting." fi if [ -d $NFSROOT/usr/lib/grub/i386-pc ]; then - chroot $NFSROOT grub-mkstandalone \ + TMPDIR=/tmp chroot $NFSROOT grub-mkstandalone \ --format=i386-pc \ --output=/tmp/core.img \ --locales="" --fonts="" \ - --install-modules="linux normal iso9660 biosdisk memdisk search ls echo test chain msdospart part_msdos part_gpt minicmd ext2 keystatus all_video font sleep gfxterm" \ + --install-modules="linux normal iso9660 biosdisk memdisk search ls echo test chain msdospart part_msdos part_gpt minicmd ext2 keystatus all_video font sleep gfxterm regexp" \ --modules="linux normal iso9660 biosdisk search" \ "boot/grub/grub.cfg=/tmp/grub.cfg" cat $NFSROOT/usr/lib/grub/i386-pc/cdboot.img $NFSROOT/tmp/core.img > $scratch/bios.img @@ -250,8 +252,8 @@ return fi - if [ -f $NFSROOT/boot/memtest86+.bin ]; then - cp $NFSROOT/boot/memtest86+.bin $tmp/boot + if [ -f $NFSROOT/boot/memtest86+.bin ] || [ -f $NFSROOT/boot/memtest86+x64.bin ]; then + cp -p $NFSROOT/boot/memtest86+* $tmp/boot echo "Adding memtest86+ to grub menu" else return 0 @@ -383,6 +385,8 @@ # - - - - - - - - - - - - - - - - - - - - - - - - - - # main program +sqopt="-comp zstd -Xcompression-level 5" + # Parse commandline options while getopts "AekfhHg:Jbs:SBMn:m:V:c:C:d:" opt ; do case "$opt" in @@ -394,7 +398,7 @@ h) usage ;; H) hidedirs="" ;; g) grub_config="$OPTARG" ;; - J) sqopt="-comp xz" ; arguments+=" -J";; + J) _OPTJ=1; sqopt="-comp xz" ; arguments+=" -J";; M) nomirror=1 ;; m) mirrordir="$OPTARG" ;; n) setnfsroot="$OPTARG" ;; diff -Nru fai-5.10.3/bin/fai-chboot fai-6.0.3+deb12u1/bin/fai-chboot --- fai-5.10.3/bin/fai-chboot 2021-05-01 20:23:53.000000000 +0000 +++ fai-6.0.3+deb12u1/bin/fai-chboot 2022-05-26 19:48:28.000000000 +0000 @@ -5,7 +5,7 @@ # fai-chboot -- manage configuration for network boot # # This script is part of FAI (Fully Automatic Installation) -# Copyright (C) 2003-2020 Thomas Lange, lange@informatik.uni-koeln.de +# Copyright (C) 2003-2022 Thomas Lange, lange@cs.uni-koeln.de # Universitaet zu Koeln # #********************************************************************* @@ -34,7 +34,7 @@ use Getopt::Std; use File::Copy; -our ($opt_D,$opt_p,$opt_h,$opt_t,$opt_s,$opt_C,$opt_P,$opt_E,$opt_c,$opt_l,$opt_d,$opt_i,$opt_S,$opt_L,$opt_B,$opt_I,$opt_n,$opt_v,$opt_e,$opt_F,$opt_f,$opt_k,$opt_g,$opt_o,$opt_u,$opt_U,$opt_q); +our ($opt_D,$opt_p,$opt_h,$opt_t,$opt_s,$opt_C,$opt_P,$opt_E,$opt_c,$opt_l,$opt_d,$opt_i,$opt_S,$opt_L,$opt_B,$opt_I,$opt_n,$opt_v,$opt_e,$opt_F,$opt_f,$opt_k,$opt_g,$opt_o,$opt_u,$opt_U,$opt_q,$opt_a); our ($error,$pxedir,$nfsroot,$nfsroot_server,$tftproot,$verbose,$append,$action,$kernelsuffix); our ($mac,$ipadr,$cfdir,$flags,$debug,$match,$bootprot); our (%hname,%hexname,%type,@allfiles,@templates,@enabled,@other,@patterns,@disabled); @@ -337,6 +337,8 @@ open (SOURCE, "$srcfile"); open (DEST, ">$pxedir/$desthex") || die "Can't opendir $pxedir: $!"; while () { + s/\$IP/$ipadr/g; + s/\$HOST/$desthost/g; print DEST $_; } print DEST "\n# template generated by fai-chboot for host $desthost with IP $ipadr from source $srcfile\n"; @@ -390,7 +392,7 @@ } } # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -getopts('gBc:C:D:eEdhnvlLiIpf:Fk:Ss:tu:U:oPq') || usage; +getopts('gBc:C:D:eEdhnvlLiIpf:Fk:Ss:tu:U:oPqa:') || usage; $opt_h and usage; $opt_n and $opt_v = 1; @@ -402,6 +404,10 @@ ($opt_B and $opt_F) && die "ERROR: use only one option out of -B and -F\n"; ($opt_S and $opt_I) && die "ERROR: use only one option out of -I and -S\n"; +($opt_S and $opt_a) && die "ERROR: use only one option out of -S and -a\n"; +($opt_I and $opt_a) && die "ERROR: use only one option out of -I and -a\n"; + + #TODO: also -e, -r and -c can't be used together if ($opt_U && $opt_U !~ m#/$#) { @@ -464,6 +470,10 @@ $opt_i = 1; $action="FAI_ACTION=install"; } +if ($opt_a) { + $opt_i = 1; + $action="FAI_ACTION=$opt_a"; +} if ($opt_i || $opt_s) { $kernelsuffix = (glob "$nfsroot/boot/vmlinuz*$opt_s")[-1]; diff -Nru fai-5.10.3/bin/fai-class fai-6.0.3+deb12u1/bin/fai-class --- fai-5.10.3/bin/fai-class 2021-05-01 20:23:53.000000000 +0000 +++ fai-6.0.3+deb12u1/bin/fai-class 2022-10-28 18:48:42.000000000 +0000 @@ -5,7 +5,7 @@ # fai-class - determine all classes a host belongs to # # This script is part of FAI (Fully Automatic Installation) -# (c) 2002-2020 by Thomas Lange, lange@informatik.uni-koeln.de +# (c) 2002-2022 by Thomas Lange, lange@cs.uni-koeln.de # Universitaet zu Koeln # #********************************************************************* @@ -75,7 +75,7 @@ ex=$1 cat <<-EOF - fai-class Copyright (C) 2002-2016 Thomas Lange + fai-class Copyright (C) 2002-2022 Thomas Lange Usage: fai-class [OPTION] DIRECTORY CLASSFILE Define classes using files and scripts in DIRECTORY @@ -169,13 +169,7 @@ fc_check_status $f $? echo $newclasses | addclass ;; *.source) - echo "WARNING: The .source suffix is deprecated. Use .sh instead." - verbosemsg "Executing $classdir/$f." - # this script can define $newclasses - newclasses= - . $f - fc_check_status $f $? - echo $newclasses | addclass ;; + echo "ERROR: The .source suffix is deprecated. Use .sh instead." ;; *) verbosemsg "Executing $classdir/$f." classes=`./$f` diff -Nru fai-5.10.3/bin/fai-debconf fai-6.0.3+deb12u1/bin/fai-debconf --- fai-5.10.3/bin/fai-debconf 2021-05-01 20:23:53.000000000 +0000 +++ fai-6.0.3+deb12u1/bin/fai-debconf 2022-10-28 18:48:42.000000000 +0000 @@ -5,7 +5,7 @@ # fai-debconf - set debconf values using classes # # This script is part of FAI (Fully Automatic Installation) -# (c) 2005-2021 by Thomas Lange, lange@informatik.uni-koeln.de +# (c) 2005-2021 by Thomas Lange, lange@cs.uni-koeln.de # Universitaet zu Koeln # #********************************************************************* diff -Nru fai-5.10.3/bin/fai-diskimage fai-6.0.3+deb12u1/bin/fai-diskimage --- fai-5.10.3/bin/fai-diskimage 2021-05-01 20:23:53.000000000 +0000 +++ fai-6.0.3+deb12u1/bin/fai-diskimage 2022-10-07 20:00:01.000000000 +0000 @@ -4,12 +4,9 @@ # This script is part of FAI (Fully Automatic Installation) # -# Copyright (C) 2016-2018 Thomas Lange, lange@informatik.uni-koeln.de +# Copyright (C) 2016-2022 Thomas Lange, lange@cs.uni-koeln.de # Universitaet zu Koeln -# this script neither needs /etc/fai nor the nfsroot. Only the config space is needed -# should unshare be used ? - die() { local e=$1 # first parameter is the exit code @@ -24,12 +21,14 @@ local dir for dir in $(mount | awk '{print $3}'| grep $mnt | sort -r); do # try umount several times, because some postinst jobs may still run and use the filesystems - for i in {1..8}; do + for i in {1..15}; do umount $dir >&/dev/null [ $? -eq 0 ] && break [ $((i % 3)) -eq 0 ] && echo "Waiting for background jobs to finish." + [ $i -gt 12 ] && echo "Still cannot umount $dir. Will try again." sleep $i done + echo "ERROR: fai-diskimage cannot umount $dir" >&2 done # call zerofree for ext2/3/4 devices if available @@ -37,13 +36,13 @@ . /var/run/fai/zerofree.$$ 2>/dev/null rm /var/run/fai/zerofree.$$ fi - losetup -d $loop # if FAI created a volume group, we can remove it after the loop device is removed if [ -f /var/run/fai/vgremove.$$ ]; then . /var/run/fai/vgremove.$$ 2>/dev/null rm /var/run/fai/vgremove.$$ fi rm -rf $mnt + losetup -d $loop if [ -f /var/run/fai/FAI_INSTALLATION_IN_PROGRESS ]; then if pgrep -F /var/run/fai/FAI_INSTALLATION_IN_PROGRESS; then : @@ -51,6 +50,9 @@ rm /var/run/fai/FAI_INSTALLATION_IN_PROGRESS fi fi + if [ -d /sys/modules/loop ]; then + rmmod loop + fi } usage() { @@ -66,6 +68,7 @@ -v|--verbose be verbose -N|--new execute scripts class/[0-9]* for defining classes -c|--class define list of FAI classes + -C|--cfdir Use dir for reading the config files (default /etc/fai) -S|--size size of raw image (suffixes k M G T are supported) -s|--cspace location of the config space -u|--hostname set hostname to name @@ -92,7 +95,7 @@ # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - call="$0 $*" -TEMP=$(getopt -o NS:s:u:hvc: --long new,cspace:,hostname:,class:,size:,help,verbose -n "$0" -- "$@") +TEMP=$(getopt -o C:NS:s:u:hvc: --long new,cfdir:,cspace:,hostname:,class:,size:,help,verbose -n "$0" -- "$@") if [ $? != 0 ] ; then die 6 "Wrong option. Terminating." >&2 ; fi # Note the quotes around `$TEMP': they are essential! eval set -- "$TEMP" @@ -109,7 +112,10 @@ export verbose=1 shift ;; -c|--class) - export classes=$2 + export classes="-c $2" + shift 2 ;; + -C|--cfdir) + cfdir="-C $2 " shift 2 ;; -N|--new) renew="-N" @@ -179,8 +185,8 @@ *) die 8 "Unknown suffix .$ext in name of disk image. Please use raw, qcow2, vdi, vmdk or vhdx." esac -if [ -z "$classes" ]; then - die 7 "No classes are defined" +if [ -z "$classes" -a -z "$renew" ]; then + die 7 "No classes are defined. Use -c or -N." fi : ${cspace:=/srv/fai/config} @@ -206,14 +212,14 @@ # create empty disk image, loop setup, temp mount point rm -f $rawname qemu-img create $rawname $size -loop=$(losetup -f --show $rawname) +loop=$(losetup -P -f --show $rawname) loopdev=${loop/\/dev\//} export disklist=$loopdev mnt=$(mktemp -d -t fai-diskimage.XXXXXX) trap "cleanup" EXIT -LC_ALL=C fai $renew -u $hname -s $uri -c$classes install $mnt +LC_ALL=C fai ${cfdir}${renew} -u $hname -s $uri $classes install $mnt error=$? cleanup diff -Nru fai-5.10.3/bin/fai-do-scripts fai-6.0.3+deb12u1/bin/fai-do-scripts --- fai-5.10.3/bin/fai-do-scripts 2021-05-01 20:23:53.000000000 +0000 +++ fai-6.0.3+deb12u1/bin/fai-do-scripts 2022-10-28 18:48:42.000000000 +0000 @@ -5,7 +5,7 @@ # fai-do-scripts - call configuration scripts for every defined class # # This script is part of FAI (Fully Automatic Installation) -# (c) 2003-2016 by Thomas Lange, lange@informatik.uni-koeln.de +# (c) 2003-2022 by Thomas Lange, lange@cs.uni-koeln.de # Universitaet zu Koeln # #********************************************************************* @@ -26,7 +26,7 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA #********************************************************************* -# variables needed: $classes, $cfclasses, $LOGDIR +# variables needed: $classes, $cfclasses, $LOGDIR, $FAI_USE_OLD_SCRIPT_LOGS # # And many other variables like: @@ -85,6 +85,7 @@ # execute scripts and save their output in log files # cfengine, shell, perl and expect scripts are known types local shelldebug file filetype name + local -r slog=$LOGDIR/scripts.log file=$1 @@ -116,6 +117,33 @@ [ X$debug = X1 ] && shelldebug="zsh -x" ;; esac + + if [ X$FAI_USE_OLD_SCRIPT_LOGS = X1 ]; then + echo "WARNING. Old style log file names for custom scripts may be removed in the future." + echo "unset FAI_USE_OLD_SCRIPT_LOGS for writing output to scripts.log." + # use old code below + else + + # always write to scripts.log + case $filetype in + *"POSIX shell script"*|*"executable shell script"*|*"/bash script"*|*"Bourne shell script"*|*"Bourne-Again shell script"*|*"zsh script"*) + vecho "Executing $shelldebug shell: $file" + echo "===== shell: $file =====" >> $slog 2>&1 + $shelldebug ./$file >> $slog 2>&1 + savemaxstatus $? + fc_check_status $file $exitcode | tee -a $slog + ;; + *) + vecho "Executing: $file" + echo "===== $filetype $file =====" >> $slog 2>&1 + ./$file >> $slog 2>&1 + savemaxstatus $? + fc_check_status $file $exitcode | tee -a $slog + ;; + esac + return + fi + case $filetype in *"POSIX shell script"*|*"executable shell script"*|*"/bash script"*|*"Bourne shell script"*|*"Bourne-Again shell script"*|*"zsh script"*) @@ -134,22 +162,6 @@ fc_check_status $file $exitcode | tee -a $LOGDIR/cfagent.log ;; - *"cfagent"*) - vecho "Executing cfagent: $file" - echo "===== cfagent: $file =====" >> $LOGDIR/cfagent.log 2>&1 - ./$file $cfagentdebug -qKI -D${cfclasses} >> $LOGDIR/cfagent.log 2>&1 - savemaxstatus $? - fc_check_status $file $exitcode | tee -a $LOGDIR/cfagent.log - ;; - - *"cfengine script"*) - vecho "Executing cfengine: $file" - echo "===== cfengine: $file =====" >> $LOGDIR/cfengine.log 2>&1 - ./$file -K -v -f $file -D${cfclasses} >> $LOGDIR/cfengine.log 2>&1 - savemaxstatus $? - fc_check_status $file $exitcode | tee -a $LOGDIR/cfengine.log - ;; - *[Pp]erl*script*) vecho "Executing perl: $file" echo "===== perl: $file =====" >> $LOGDIR/perl.log 2>&1 diff -Nru fai-5.10.3/bin/fai-make-nfsroot fai-6.0.3+deb12u1/bin/fai-make-nfsroot --- fai-5.10.3/bin/fai-make-nfsroot 2021-05-22 15:46:28.000000000 +0000 +++ fai-6.0.3+deb12u1/bin/fai-make-nfsroot 2023-06-23 20:43:21.000000000 +0000 @@ -5,7 +5,7 @@ # fai-make-nfsroot -- create nfsroot directory and add additional packages # # This script is part of FAI (Fully Automatic Installation) -# (c) 2000-2021 by Thomas Lange, lange@informatik.uni-koeln.de +# (c) 2000-2022 by Thomas Lange, lange@cs.uni-koeln.de # Universitaet zu Koeln # (c) 2004 by Henning Glawe, glaweh@physik.fu-berlin.de # Freie Universitaet Berlin @@ -32,7 +32,7 @@ usage() { cat <<-EOF - Copyright (C) 1999-2021 Thomas Lange + Copyright (C) 1999-2022 Thomas Lange Usage: fai-make-nfsroot [OPTIONS] Create an NFSROOT for FAI. @@ -74,7 +74,7 @@ # check if all important packages are installed n=$($ROOTCMD dpkg-query -l fai-client fai-nfsroot fai-setup-storage dracut-network dracut 2>/dev/null|grep -c -E ^ii) if [ $n -ne 5 ]; then - echo "ERROR: Some essential pacakges are missing." + echo "ERROR: Some essential packages are missing." bad_exit fi @@ -105,7 +105,11 @@ c) classes=$OPTARG classes=${classes//,/ } ;; C) cfdir=$OPTARG ;; - B) basetgz=$OPTARG ;; + B) basetgz=$OPTARG + if [ ! -r "$basetgz" ] ; then + die 7 "Specified $basetgz can not be read." + fi + ;; v) verbose=1 ; v=-v ;; U) die 1 "Option -U is not supported any more." ;; r) die 1 "Option -r is not supported any more." ;; @@ -152,7 +156,17 @@ oldnfsroot=$NFSROOT deldir=$NFSROOT -ROOTCMD="unshare --pid --fork --kill-child --mount-proc chroot $NFSROOT" +set +e +if [ -z "$ROOTCMD" ]; then + # check if unshare can be used (e.g. not possible in some container environments) + unshare --fork --kill-child --mount-proc chroot / ls >/dev/null 2>&1 + if [ $? -eq 0 ]; then + ROOTCMD="unshare --fork --kill-child --mount-proc chroot $NFSROOT" + else + ROOTCMD="chroot $NFSROOT" + fi +fi +set -e export DEBIAN_FRONTEND=noninteractive # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -332,38 +346,37 @@ command -v debootstrap >&/dev/null || die 1 "Can't find debootstrap command. Aborting." call_debootstrap $FAI_DEBOOTSTRAP $ROOTCMD apt-get clean - rm -f $NFSROOT/etc/resolv.conf $NFSROOT/etc/hostname $NFSROOT/etc/udev/rules.d/70-persistent-net.rules + rm -f $NFSROOT/etc/resolv.conf $NFSROOT/etc/hostname $NFSROOT/etc/udev/rules.d/70-persistent-net.rules $NFSROOT/var/lib/dbus/machine-id + > $NFSROOT/etc/machine-id if [ $usexz -eq 0 ]; then - echo "Creating base.tar.gz" + echo "Creating base.tar.zst" else echo "Creating base.tar.xz" fi - tar --xattrs --acls --one-file-system -C $NFSROOT -cf $NFSROOT/var/tmp/base.tar --exclude etc/machine-id --exclude var/tmp/base.tar --exclude 'var/lib/apt/lists/*_*' . + tar --xattrs --acls --one-file-system -C $NFSROOT -cf $NFSROOT/var/tmp/base.tar --exclude var/tmp/base.tar --exclude 'var/lib/apt/lists/*_*' . if [ $usexz -eq 1 ]; then nice xz -q $NFSROOT/var/tmp/base.tar & else - nice gzip $NFSROOT/var/tmp/base.tar & + nice zstd --rm -q -7 -T4 $NFSROOT/var/tmp/base.tar & fi } # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - extract_base() { - if [ ! -r "$basetgz" ] ; then - die 7 "Specified $basetgz could not be used." - fi - if cd $NFSROOT ; then printf "Extracting $basetgz: " case $basetgz in - *tar.gz|*.tgz) - tar --xattrs --acls --xattrs-include=* -C $NFSROOT -zxpf "$basetgz" || die 1 "Error while extracting ${basetgz} in ${NFSROOT}." - cp -p "$basetgz" $NFSROOT/var/tmp/base.tar.gz + *tar.zst|*.tzst) + tar --xattrs --acls --xattrs-include=* -C $NFSROOT --zstd -xpf "$basetgz" || die 1 "Error while extracting ${basetgz} in ${NFSROOT}." + cp -p "$basetgz" $NFSROOT/var/tmp/base.tar.zst ;; *tar.xz|*.txz) tar --xattrs --acls --xattrs-include=* -C $NFSROOT -Jxpf "$basetgz" || die 1 "Error while extracting ${basetgz} in ${NFSROOT}." cp -p "$basetgz" $NFSROOT/var/tmp/base.tar.xz ;; + *) + die 14 "Unknow file name suffix" esac echo done fi @@ -382,7 +395,7 @@ create_base fi touch .THIS_IS_THE_FAI_NFSROOT - # save the list of all packages in the base.tar.gz + # save the list of all packages in the base.tar.zst $ROOTCMD dpkg --get-selections | awk '/install$/ {print $1}' > var/tmp/base-pkgs.lis if [ -n "$FAI_DEBMIRROR" ]; then @@ -409,7 +422,8 @@ # currently we do not want to use systemd, but CD booting, also we # do not need all those filesystems inside the initrd mkdir $NFSROOT/etc/dracut.conf.d - echo 'omit_dracutmodules+=" dracut-systemd systemd systemd-initrd systemd-networkd systemd-initrd "' > $NFSROOT/etc/dracut.conf.d/12-no-systemd.conf + echo 'omit_dracutmodules+=" dracut-systemd systemd systemd-initrd systemd-networkd "' > $NFSROOT/etc/dracut.conf.d/12-no-systemd.conf + echo 'add_dracutmodules+=" network-legacy "' >> $NFSROOT/etc/dracut.conf.d/12-no-systemd.conf if [ $full = 1 ];then echo 'add_dracutmodules+=" livenet "' > $NFSROOT/etc/dracut.conf.d/13-add-cd-support.conf fslist="nfs lockd ext4" @@ -419,7 +433,7 @@ fi echo 'hostonly="no"' > $NFSROOT/etc/dracut.conf.d/20-generic-image.conf cat < $NFSROOT/etc/dracut.conf.d/01-omit.conf -omit_dracutmodules+=" btrfs crypt dash lvm resume usrmount modsign mdraid shutdown dracut-systemd systemd systemd-initrd systemd-networkd systemd-initrd virtfs " +omit_dracutmodules+=" btrfs crypt dash lvm resume usrmount modsign mdraid shutdown dracut-systemd systemd systemd-initrd systemd-networkd virtfs " filesystems="$fslist" EOF @@ -442,6 +456,12 @@ LC_ALL=C call_verbose upgrade_nfsroot LC_ALL=C add_packages_nfsroot + # patch udev rules for lvm + if [ -f $NFSROOT/etc/udev/rules.d/69-lvm-metad.rules ] && + [ -f $NFSROOT/usr/share/fai/udev.patch ]; then + $ROOTCMD patch --verbose -p0 < /usr/share/fai/udev.patch + fi + # remove file diversion, then create initrd rm $NFSROOT/etc/kernel/postinst.d/dracut $ROOTCMD dpkg-divert --rename --remove /etc/kernel/postinst.d/dracut @@ -452,7 +472,7 @@ # set timezone in nfsroot cp -fH /etc/timezone etc/timezone cp -a /etc/localtime etc/localtime - ln -sf /proc/mounts etc/mtab + ln -sf ../proc/self/mounts etc/mtab ln -s /usr/sbin/fai etc/init.d/rcS @@ -490,34 +510,22 @@ # add any 3rd party repository keys that you may need installed into the NFSROOT if [ -d $cfdir/apt/keys ]; then local f - for f in $(find $cfdir/apt/keys -type f -name '*.asc' -o -name '*.gpg'); do + for f in $(find $cfdir/apt/keys -type f -name '*.gpg'); do cp $f $NFSROOT/etc/apt/trusted.gpg.d done fi - # if we have the keyring on the host, install the key of the fai-project.org package repository - if [ ! -f $NFSROOT/etc/apt/trusted.gpg.d/fai-project.gpg -a -n "$(apt-key list 2BF8D9FE074BCDE4 2>/dev/null)" ]; then - HOME=/root apt-key export 2BF8D9FE074BCDE4 > $NFSROOT/etc/apt/trusted.gpg.d/fai-project.asc - fi - if [ $full = 1 ];then pkgs=nfs-common fi $ROOTCMD apt-get update - # check if we need more dracut packages (dracut >=049) - set +e - $ROOTCMD apt show dracut-live dracut-squash >/dev/null 2>/dev/null - if [ $? -eq 0 ]; then - pkgs+=" dracut-live dracut-squash" - fi - set -e # disable generating the initrd fdivert /etc/kernel/postinst.d/dracut $ROOTCMD ln -s /bin/true /etc/kernel/postinst.d/dracut # fai-nfsroot must be sucessfully installed before anything else - $ROOTCMD apt-get -yf --no-install-recommends install fai-nfsroot dracut-network dracut-config-generic $pkgs + $ROOTCMD apt-get -yf --no-install-recommends install fai-nfsroot dracut-config-generic dracut-live dracut-network dracut-squash $ROOTCMD apt-get -y dist-upgrade # patch dracut. Do not fail if network is not available local fn=$(find $NFSROOT/usr/lib/dracut/modules.d/ -name net-genrules.sh) @@ -531,7 +539,7 @@ local err setclasses - $ROOTCMD apt-cache dumpavail > $NFSROOT/var/lib/dpkg/available + > $NFSROOT/var/lib/dpkg/available install_packages -l -p$cfdir > $NFSROOT/var/tmp/packages.nfsroot echo "Adding additional packages to $NFSROOT:" cat $NFSROOT/var/tmp/packages.nfsroot @@ -541,7 +549,6 @@ if [ $err -ne 0 ]; then die 12 "install_packages had exit code: $err" fi - rm $NFSROOT/var/lib/dpkg/available set -e } # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -629,9 +636,7 @@ # remove all kernels from nfsroot [ -n "$kremove" ] && { echo "Removing all kernels from NFSROOT." - LC_ALL=C $ROOTCMD apt-cache dumpavail > $NFSROOT/var/lib/dpkg/available LC_ALL=C $ROOTCMD apt-get -qq purge linux-image\* - rm $NFSROOT/var/lib/dpkg/available exit } diff -Nru fai-5.10.3/bin/fai-mirror fai-6.0.3+deb12u1/bin/fai-mirror --- fai-5.10.3/bin/fai-mirror 2021-05-01 20:23:53.000000000 +0000 +++ fai-6.0.3+deb12u1/bin/fai-mirror 2023-06-23 20:43:21.000000000 +0000 @@ -5,7 +5,7 @@ # fai-mirror -- create and manage a partial mirror for FAI # # This script is part of FAI (Fully Automatic Installation) -# (c) 2004-2019, Thomas Lange, lange@informatik.uni-koeln.de +# (c) 2004-2022, Thomas Lange, lange@cs.uni-koeln.de # #********************************************************************* # This program is free software; you can redistribute it and/or modify @@ -365,24 +365,24 @@ cat > $mirrordir/conf/distributions <> $mirrordir/conf/distributions <> $sshdir/authorized_keys } + [ -f $sshdir/id_ecdsa ] || { + ssh-keygen -t ecdsa -N '' -f $sshdir/id_ecdsa -C "$LOGUSER@$HOSTNAME" + cat $sshdir/id_ecdsa.pub >> $sshdir/authorized_keys + } + #Adding servers keys to known_hosts list of LOGUSER. #So that installed clients can ssh $LOGUSER@$HOSTNAME without password if [ ! -f $sshdir/known_hosts ]; then [ -f /etc/ssh/ssh_host_ed25519_key.pub ] && ED25519SERVER=$(sed -e "s/= .*$/=/" /etc/ssh/ssh_host_ed25519_key.pub) [ -f /etc/ssh/ssh_host_rsa_key.pub ] && RSASERVER=$(sed -e "s/= .*$/=/" /etc/ssh/ssh_host_rsa_key.pub ) + [ -f /etc/ssh/ssh_host_ecdsa_key.pub ] && ECDSASERVER=$(sed -e "s/= .*$/=/" /etc/ssh/ssh_host_ecdsa_key.pub ) # determine all IP addresses, and their host names ips=$(ip addr show up| grep -P -o '(?<=inet )[^/]+' | grep -v 127.0.0.1) for ip in $ips; do @@ -121,6 +127,7 @@ echo "Adding $hname to known_hosts." [ -z "$ED25519SERVER" ] || echo "$hname $ED25519SERVER" >> $sshdir/known_hosts [ -z "$RSASERVER" ] || echo "$hname $RSASERVER" >> $sshdir/known_hosts + [ -z "$ECDSASERVER" ] || echo "$hname $ECDSASERVER" >> $sshdir/known_hosts done echo "$sshdir/known_hosts created." else diff -Nru fai-5.10.3/bin/fcopy fai-6.0.3+deb12u1/bin/fcopy --- fai-5.10.3/bin/fcopy 2021-05-01 20:23:53.000000000 +0000 +++ fai-6.0.3+deb12u1/bin/fcopy 2022-06-24 09:37:50.000000000 +0000 @@ -5,7 +5,7 @@ # fcopy -- copy files using FAI classes and preserve directory structure # # This script is part of FAI (Fully Automatic Installation) -# Copyright (C) 2000-2020 Thomas Lange, lange@informatik.uni-koeln.de +# Copyright (C) 2000-2022 Thomas Lange, lange@cs.uni-koeln.de # Universitaet zu Koeln # Copyright (C) 2001-2005 Henning Glawe, glaweh@physik.fu-berlin.de # Freie Univeritaet Berlin @@ -137,6 +137,12 @@ } } + # handle broken symlink + unless (stat($sourcefile)) { + ewarn("$sourcefile is a broken symlink\n"); + return; + } + # do we need a tmpfile if ($substitute or -f "$ps/_substitute" or -x "$ps/preinst") { ($tmpfh,$tmpfile)=tempfile("fcopy.XXXXXX",DIR=>File::Spec->tmpdir()); @@ -472,7 +478,7 @@ print << "EOF"; fcopy, copy files using classes. - Copyright (C) 2001-2019 by Thomas Lange + Copyright (C) 2001-2022 by Thomas Lange Usage: fcopy [OPTION] ... SOURCE ... diff -Nru fai-5.10.3/bin/ftar fai-6.0.3+deb12u1/bin/ftar --- fai-5.10.3/bin/ftar 2021-05-01 20:23:53.000000000 +0000 +++ fai-6.0.3+deb12u1/bin/ftar 2022-10-28 18:48:42.000000000 +0000 @@ -5,7 +5,7 @@ # ftar -- extract tar files using FAI classes # # This script is part of FAI (Fully Automatic Installation) -# Copyright (C) 2001-2017 Thomas Lange, lange@informatik.uni-koeln.de +# Copyright (C) 2001-2021 Thomas Lange, lange@cs.uni-koeln.de # Universitaet zu Koeln # #********************************************************************* @@ -65,7 +65,7 @@ cat < @@ -41,6 +41,8 @@ my $listonly; # flag, that indicates that only a list of packages will be printed our %command; our $atype; # type of action (for apt-get, aptitude,..) that will be performed +our $pkgopt; # additional option for packages +our $pkgrel; # additional release info for packages my $dryrun=0; my $verbose; my $FAI_ROOT; @@ -56,10 +58,10 @@ my %types; # hash containing the types found in all loaded package_config files my %classisdef; my $maxpl; # maximum length of package list -my $cache; # instance of AptPkg::Cache my @known; # list of all known packages my $execerrors; # counts execution errors -my $aptopt='-y -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confnew'; +my $aptopt='-y -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confnew --allow-change-held-packages'; +my $pacmanopts=' --noconfirm '; my $downloaddir="/var/cache/apt/archives/partial/"; # where to download packages that gets only unpacked my $debsourcesdir='/var/lib/fai/packages'; my @ls; @@ -72,12 +74,14 @@ # @commands is the order of the commands that are executed -our @commands = qw/y2i y2r zypper zypper-pattern zypper-product zypper-rm yast rpmr urpmi urpme yumgroup yumi yumr dnfgroup dnfi dnfr smarti smartr hold taskrm taskinst clean-internal cupt cupt-r install install-norec aptitude aptitude-r unpack remove dselect-upgrade/; +our @commands = qw/y2i y2r zypper zypper-pattern zypper-product zypper-rm yast rpmr urpmi urpme yumgroup yumi yumr dnfgroup dnfi dnfr smarti smartr hold taskrm taskinst clean-internal cupt cupt-r install install-norec aptitude aptitude-r apt unpack remove dselect-upgrade pacman-Rns pacman-S apk-add apk-del/; %command = ( "install" => "apt-get $aptopt --fix-missing install", "install-norec" => "apt-get $aptopt --fix-missing install --no-install-recommends", "remove" => "apt-get $aptopt --purge remove", "dselect-upgrade" => "apt-get $aptopt dselect-upgrade", + "pacman-S" => "pacman $pacmanopts -S ", + "pacman-Rns" => "pacman $pacmanopts -Rns ", "taskinst" => "tasksel install", "taskrm" => "tasksel remove", "hold" => "dpkg --set-selections", @@ -110,6 +114,8 @@ "smarti" => "smart install -y", "smartr" => "smart remove -y", "smartc-internal" => "smart clean", + "apk-add" => "apk add", + "apk-del" => "apk del", ); getopts('dhHvlLm:p:nNs'); @@ -162,7 +168,7 @@ } } --f "$FAI_ROOT/var/lib/dpkg/available" && create_debian_pkg_list(); +-f "$FAI_ROOT/var/cache/apt/pkgcache.bin" && create_debian_pkg_list(); # - - - - - - - - - - - - - - - - - - - - - - - - - - - # begin of the big foreach loop @@ -177,58 +183,71 @@ # skip if empty list next unless defined $list{$atype}; + my $pkglist; - if ($atype eq "dselect-upgrade") { - dselectupgrade($atype); - next; - } - - my $packlist = join(' ',@{$list{$atype}}); - - if ($atype eq "hold") { - my $hold = join " hold\n", @{$list{hold}}, ""; - execute("echo \"$hold\" | $rootcmd $command{hold}"); - next; - } - - if ($atype eq "install" || $atype eq "install-norec" || $atype eq "smarti" || $atype eq "cupt"|| $atype eq "cupt-r"|| $atype eq "apt" || $atype eq "aptitude" || $atype eq "aptitude-r" || $atype eq "unpack" || $opt_l || $opt_L) { + foreach $pkgopt (sort keys %{$list{$atype}}) { + $pkglist = $list{$atype}{$pkgopt}; # create an alias + # skip if empty list + next unless defined $pkglist; + + # map release= option to -t + undef $pkgrel; + if ($pkgopt =~ /release=(\S+)/) { + $pkgrel=" -t $1"; + } - mkpackagelist(@{$list{$atype}}); # create lists of known and unknown packages - getsources(); # retrieve sources - if ($opt_l) { + if ($atype eq "dselect-upgrade") { + dselectupgrade($atype); next; } - if ($opt_L) { - # only print the package list, only works for install and instal-norec - execute("$rootcmd $command{$atype} -s @known | egrep ^Inst"); + + my $packlist = join(' ',@{$pkglist}); + + if ($atype eq "hold") { + my $hold = join " hold\n", @{$list{hold}{$pkgopt}}, ""; + execute("echo \"$hold\" | $rootcmd $command{hold}"); next; } - # pass only maxpl packages to apt-get - while (@known) { - my $shortlist = join(' ', splice @known,0,$maxpl); - - # we can skip a package it's already processed, - if ($maxpl == 1 && $shortlist) { - @ls=<$ENV{FAI_ARCHIVE_DIR}/${shortlist}_*deb>; - next if @ls; + if ($atype eq "install" || $atype eq "install-norec" || $atype eq "smarti" || $atype eq "cupt"|| $atype eq "cupt-r"|| $atype eq "apt" || $atype eq "aptitude" || $atype eq "aptitude-r" || $atype eq "unpack" || $opt_l || $opt_L) { + + mkpackagelist(@{$pkglist}); # create lists of known and unknown packages + getsources(); # retrieve sources + if ($opt_l) { + next; + } + if ($opt_L) { + # only print the package list, only works for install and instal-norec + execute("$rootcmd $command{$atype} -s @known | egrep ^Inst"); + next; + } + + # pass only maxpl packages to apt-get + while (@known) { + my $shortlist = join(' ', splice @known,0,$maxpl); + + # we can skip a package it's already processed, + if ($maxpl == 1 && $shortlist) { + @ls=<$ENV{FAI_ARCHIVE_DIR}/${shortlist}_*deb>; + next if @ls; + } + execute("$rootcmd $command{$atype} $pkgrel $shortlist") if $shortlist; + execute("$rootcmd $command{'clean-internal'}") if $hasdebian; + execute("$rootcmd $command{'unpack-internal'}") if ($atype eq "unpack"); # unpack and rm deb files } - execute("$rootcmd $command{$atype} $shortlist") if $shortlist; - execute("$rootcmd $command{'clean-internal'}") if $hasdebian; - execute("$rootcmd $command{'unpack-internal'}") if ($atype eq "unpack"); # unpack and rm deb files + next; } - next; - } - if ($atype eq "taskinst" || $atype eq "taskrm") { - foreach my $tsk (@{$list{$atype}}) { - execute("$rootcmd $command{$atype} $tsk"); + if ($atype eq "taskinst" || $atype eq "taskrm") { + foreach my $tsk (@{$list{$atype}}) { + execute("$rootcmd $command{$atype} $tsk"); + } + next; } - next; - } - # other types - execute("$rootcmd $command{$atype} $packlist") if $packlist; + # other types + execute("$rootcmd $command{$atype} $packlist") if $packlist; + } # foreach $pkgopt } # - - - - - - - - - - - - - - - - - - - - - - - - - - - # end of the big foreach loop @@ -271,6 +290,7 @@ my ($path,$file) = @_; my ($package,$type,$cllist,@oclasses,$doit); + my $pkgoption; open (FILE,"$path/$file") || warn "ERROR $0: Can't read config file: $path/$file\n"; warn "$0: read config file $file\n" if $verbose; @@ -283,8 +303,11 @@ /^PRELOAD\s+(\S+)\s+(\S+)/ and push(@preloadlist, [$1,$2]),next; /^PRELOADRM\s+(\S+)\s+(\S+)/ and push(@preloadrmlist, [$1,$2]),next; - if (/^PACKAGES\s+(\S+)\s*/) { - ($type,$cllist) = ($1,$'); + if (/^PACKAGES\s+(\S+)\s*(\S+=\S+)?\s*/) { + ($type,$pkgoption,$cllist) = ($1,$2,$'); + + warn "ERROR: PACKAGES option $pkgoption not allowed\n" unless ( ! defined $pkgoption or $pkgoption =~ /^release=/); + warn "WARNING: Unknown action $type after PACKAGES\n" unless defined $command{$type}; # by default no classes are listed after this command so doit $doit = 1; @@ -306,7 +329,7 @@ warn "ERROR: PACKAGES .. line missing in $file\n"; next; } - push @{$list{$type}}, split if $doit; + push @{$list{$type}{$pkgoption}}, split if $doit; $types{$type}=1 if $doit; # remember which types are used in package_config } } @@ -363,7 +386,7 @@ # @known contains the known packages # on Debian system, clean list of packages - if ( ! $opt_N && -f "$FAI_ROOT/var/lib/dpkg/available" ) { + if ( ! $opt_N && -f "$FAI_ROOT/var/cache/apt/pkgcache.bin" ) { @known = clean_pkg_list(@complete); } else { @known = @complete; @@ -429,7 +452,7 @@ undef %command; $maxpl=9999; -@commands = qw/taskinst cupt cupt-r aptitude aptitude-r install install-norec unpack/; +@commands = qw/taskinst cupt cupt-r aptitude aptitude-r install install-norec apt unpack/; %command = ( "install" => "apt-get $qopt -d $ENV{aptoptions} -y --fix-missing install", "install-norec" => "apt-get $qopt -d $ENV{aptoptions} -y --fix-missing install --no-install-recommends", @@ -467,10 +490,11 @@ # - - - - - - - - - - - - - - - - - - - - - - - - - - - sub create_debian_pkg_list { # build a hash of all known package names - open(IN,"egrep '^Package: ' $FAI_ROOT/var/lib/dpkg/available |") || die; + open(IN,"$rootcmd apt-cache dumpavail | egrep ^Package: |") || die; while () { - m/^Package: (\S+)/; - $pname{$1} = 1; + chomp; + s/^Package: //; + $pname{$_} = 1; } close(IN); } diff -Nru fai-5.10.3/bin/setup-storage fai-6.0.3+deb12u1/bin/setup-storage --- fai-5.10.3/bin/setup-storage 2021-05-22 15:45:06.000000000 +0000 +++ fai-6.0.3+deb12u1/bin/setup-storage 2022-10-28 21:00:13.000000000 +0000 @@ -43,16 +43,13 @@ # - } goes on a line on its own # - one blank line after sub ... # -# $Id$ -# -# @author Christian Kern, Michael Tautschnig -# @date Sun Jul 23 16:09:36 CEST 2006 +# @author Christian Kern, Michael Tautschnig, Thomas Lange # ################################################################################ package FAI; -my $version = "2.3"; +my $version = "3.0"; $|=1; # command line parameter handling @@ -210,7 +207,6 @@ $FAI::debug and print Dumper \%FAI::dev_children; # generate the command script -&FAI::get_parted_version; &FAI::build_disk_commands; $FAI::uses_raid and &FAI::build_raid_commands; &FAI::build_btrfs_commands; @@ -236,6 +232,12 @@ &FAI::execute_command($FAI::commands{$_}{cmd}); } +# clean crypt key files + foreach (@FAI::crypttab) { + my $fname = (split)[0]; + unlink "$FAI::DATADIR/$fname"; +} + # generate the proposed fstab contents # wait for udev to set up all devices `$FAI::udev_settle`; diff -Nru fai-5.10.3/conf/NFSROOT fai-6.0.3+deb12u1/conf/NFSROOT --- fai-5.10.3/conf/NFSROOT 2021-05-22 15:45:06.000000000 +0000 +++ fai-6.0.3+deb12u1/conf/NFSROOT 2023-06-23 20:43:21.000000000 +0000 @@ -6,7 +6,6 @@ lshw procinfo dump reiserfsprogs xfsprogs xfsdump btrfs-progs hwinfo hdparm smartmontools nvme-cli -rdate zile numactl udns-utils @@ -17,6 +16,7 @@ ssh netselect mdadm +cryptsetup #git # git consumes a lot of disk space on the FAI CD PACKAGES install-norec @@ -27,13 +27,14 @@ sysvinit-core systemd-sysv- curl lftp less -ntpdate +ntpsec-ntpdate rdate dosfstools lvm2 psmisc dialog console-common kbd -xz-utils pigz +xz-utils pigz zstd +gpg # some network cards needs firmware @@ -56,7 +57,7 @@ grub-efi-amd64-bin efibootmgr linux-image-amd64 -#linux-image-amd64/bullseye-backports # if you want to use a newer kernel +#linux-image-amd64/bookworm-backports # if you want to use a newer kernel PACKAGES install-norec ARM64 grub-efi-arm64 @@ -67,12 +68,3 @@ grub-efi-arm efibootmgr linux-image-armmp - -PACKAGES install-norec DEBIAN_9 -apt-transport-https - -PACKAGES install-norec DEBIAN_10 -fdisk gpg - -PACKAGES install-norec DEBIAN_11 DEBIAN_ -fdisk gpg diff -Nru fai-5.10.3/conf/fai.conf fai-6.0.3+deb12u1/conf/fai.conf --- fai-5.10.3/conf/fai.conf 2017-01-04 20:18:01.000000000 +0000 +++ fai-6.0.3+deb12u1/conf/fai.conf 2022-06-13 15:46:39.000000000 +0000 @@ -1,4 +1,7 @@ # See fai.conf(5) for detailed information. -# Account for saving log files and calling fai-chboot. -#LOGUSER=fai +# Account created for saving log files and calling fai-chboot. +# This setting will not be passed onto the fai client(s); for the fai +# clients check /srv/fai/config/class/FAIBASE.var on the FAI server to +# activate the transfer of logfiles to the server +LOGUSER=fai diff -Nru fai-5.10.3/conf/grub.cfg fai-6.0.3+deb12u1/conf/grub.cfg --- fai-5.10.3/conf/grub.cfg 2021-04-14 13:02:27.000000000 +0000 +++ fai-6.0.3+deb12u1/conf/grub.cfg 2022-11-12 23:32:00.000000000 +0000 @@ -7,6 +7,7 @@ insmod part_gpt insmod all_video insmod gfxterm +insmod regexp set gfxmode=auto set color_normal=white/black @@ -44,27 +45,44 @@ } menuentry "Boot OS from first partition on first disk" { - if [ "$grub_platform" = "efi" ]; then - if [ -f (hd0,gpt1)/efi/debian/grub.cfg ]; then - configfile (hd0,gpt1)/efi/debian/grub.cfg - elif [ -f (hd1,gpt1)/efi/debian/grub.cfg ]; then - configfile (hd1,gpt1)/efi/debian/grub.cfg - elif [ -f (hd0,gpt2)/boot/grub/grub.cfg ]; then - configfile (hd0,gpt2)/boot/grub/grub.cfg - elif [ -f (hd1,gpt2)/boot/grub/grub.cfg ]; then - configfile (hd1,gpt2)/boot/grub/grub.cfg - else - echo "cannot find grub.cfg" - sleep 7 + +if [ "$grub_platform" = "efi" ]; then + + for d in (hd*); do + for cfg in efi/debian/grub.cfg boot/grub/grub.cfg ; do + if [ -e "$d/$cfg" ]; then + found=true + echo "FOUND $d/$cfg" + sleep 1 + configfile "$d/$cfg" + fi + done + done + + if [ "$found" != true ]; then + echo "Cannot find grub.cfg" + sleep 7 + fi + +else + + # legacy BIOS booting + # detect which disk has a DOS partitions, and boot the MBR via chainloader + found=false + for d in (hd*,msdos*); do + if [ "$found" = "false" ]; then + regexp -s device '^\((.+),' $d + if [ "$device" != "" ]; then + found=true + set root=($device) + chainloader +1 fi - # legacy BIOS booting - elif [ -d (cd) ]; then - set root=(hd0) - chainloader +1 - else - set root=(hd1) - chainloader +1 - fi + fi + done + echo "Booting from $device" + sleep 1 + +fi } menuentry "Rescue system, no installation" { @@ -84,3 +102,9 @@ linux /boot/vmlinuz FAI_FLAGS="verbose,createvt" FAI_ACTION=install ip=192.168.33.250::192.168.33.1:255.255.255.0:faiserver:eth0:off FAI_CONFIG_SRC=file:///var/lib/fai/config rd.live.image root=live:CDLABEL=FAI_CD quiet initrd /boot/initrd.img } + +if [ ${grub_platform} == "efi" ]; then + menuentry 'UEFI Firmware Settings' --id 'uefi-firmware' { + fwsetup + } +fi diff -Nru fai-5.10.3/conf/nfsroot.conf fai-6.0.3+deb12u1/conf/nfsroot.conf --- fai-5.10.3/conf/nfsroot.conf 2021-05-22 15:45:06.000000000 +0000 +++ fai-6.0.3+deb12u1/conf/nfsroot.conf 2022-12-06 13:27:22.000000000 +0000 @@ -1,7 +1,7 @@ # For a detailed description see nfsroot.conf(5) # " " for debootstrap -FAI_DEBOOTSTRAP="bullseye http://deb.debian.org/debian" +FAI_DEBOOTSTRAP="bookworm http://deb.debian.org/debian" FAI_ROOTPW='$1$kBnWcO.E$djxB128U7dMkrltJHPf6d1' NFSROOT=/srv/fai/nfsroot diff -Nru fai-5.10.3/conf/sources.list fai-6.0.3+deb12u1/conf/sources.list --- fai-5.10.3/conf/sources.list 2021-05-22 15:45:06.000000000 +0000 +++ fai-6.0.3+deb12u1/conf/sources.list 2023-05-07 14:29:11.000000000 +0000 @@ -1,11 +1,8 @@ # These lines should work for many sites -deb http://deb.debian.org/debian bullseye main contrib non-free -deb http://deb.debian.org/debian-security bullseye-security main contrib non-free -#deb http://deb.debian.org/debian bullseye-backports main contrib non-free +deb http://deb.debian.org/debian bookworm main contrib non-free non-free-firmware +deb http://deb.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware +#deb http://deb.debian.org/debian bookworm-backports main contrib non-free non-free-firmware -# from bullseye on you need -#deb http://deb.debian.org/debian-security bullseye-security main contrib non-free - -# repository that may contain newer fai packages for bullseye -deb http://fai-project.org/download bullseye koeln +# repository that may contain newer fai packages for bookworm +deb http://fai-project.org/download bookworm koeln diff -Nru fai-5.10.3/debian/changelog fai-6.0.3+deb12u1/debian/changelog --- fai-5.10.3/debian/changelog 2021-05-22 16:34:45.000000000 +0000 +++ fai-6.0.3+deb12u1/debian/changelog 2023-06-24 11:02:26.000000000 +0000 @@ -1,10 +1,146 @@ +fai (6.0.3+deb12u1) bullseye; urgency=low + + * fai: set IP address lifetime to forever, Closes: #1037329 + + -- Thomas Lange Sat, 24 Jun 2023 13:02:26 +0200 + +fai (6.0.3) unstable; urgency=high + + * get-boot-info: write $SERVER only if string is non-epmty + fixes https://github.com/faiproject/fai/pull/118 + + -- Thomas Lange Wed, 24 May 2023 11:57:11 +0200 + +fai (6.0.2) unstable; urgency=high + + [ Thomas Lange ] + * add support for non-free-firmware, Closes: #1035555 + * mkdebmirror: bullseye -> bookworm, Closes: #1035608 + * doc/Makefile, debian/rules,fai-doc.doc-base.package: + do not create ps files + + -- Thomas Lange Sun, 07 May 2023 17:25:35 +0200 + +fai (6.0.1) unstable; urgency=low + + [ Joerg Behrmann ] + * install_packages: fix wrong type of perl variable, Closes: #1032267 + + [ Thomas Lange ] + * prtcopyleft: year++ + * disk_config/*: add comment about mkfs option that is needed when using + older Debian releases, Closes: #1031415 + + -- Thomas Lange Wed, 08 Mar 2023 19:38:00 +0100 + +fai (6.0) unstable; urgency=low + + [ Thomas Lange ] + * fai-do-scripts: write output of all scripts to scripts.log, + remove code for old cfengine versions (1 and 2) + * fai-make-nfsroot: drop support for .asc files, use only .gpg + * add autopkgtest + * install_packages: add release= + feature, Closes: #844377, add pacman support + add --allow-change-held-packages + parse apt-cache output, Closes: #990211 + * fetch-basefile: use curl instead of lftp for downloading + * Commands.pm: special handling of nvme devices, Closes: #999739, quote + variables, Closes: #977832, remove old code need by old version of + mkfs.btrfs and lvcreate, + * fai-mk-network: use iproute commands instead of brctl + * fai-make-nfsroot: add dracut modul network-legacy, Closes: #1010906 + do not kill dhclient, Closes: #987779, drop support for dracut < 049, + patch udev rule of lvm for bullseye, include empty machine-id into + base.tar + * Exec.pm: better error message, Closes: #1005745 + * fcopy: handle broken symlinks, Closes: #985303 + * fai-chboot: add variable substitution when coping a template, add + option -a + * fai-class: use of .source scripts now emits an error + * fai-kvm: add -M for creating NVMe devices + * fai-mirror: use only first line of bpo in sources.list, + Closes: #1006847, print number of packages inside the mirror + * fai-diskimage: call losetup with -P, Closes: #1010593, do not remove + VGs, deactivate them, Closes: #990633, add option -c, print error if + umount fails, increase number of tries + * fai-cd: set TMPDIR for chroot, Closes: #1000572, + add grub module regexp + * fai-setup: create ECDSA keys + * Fstab.pm: support tmpfs size -, this uses the system default size for + tmpfs, Closes: #951659 + * setup-storage: add support for fstabkey:partlabel and + fstabkey:partuuid, remove crypto keyfile after use + * enhance disk_config format for partition label support + * ftar: add support for zstd + * fai: check if unshare can be used, Closes: #989547 + use only IPv4 address as hostname + remove code for deprecated taskname prepareapt + * watch: update to version 4, use new url + * subroutines: umount tmpfs if config space was downloaded via http, + Closes: #1011642, check if systemd-resolved is used + * task_sysinfo: print machine readable partition information, do not + call commands that modify the system if no run in FAI environment, + print battery information + * subroutines: add help functions: + ctam (Chroot TArget Mount pseudo filesystems) + ctau (Chroot TArget Umount) + ctai (Chroot TArget Into) + rm_target (remount /target read-write) + * NFSROOT: cleanup package list, add cryptsetup, zstd + * update my email address + * mk-basefile: remove /var/lib/dbus/machine-id, use zstd instead of gzip + add Rocky 9, Debian Forky + * ROCKY/60-network-scripts: add support for + system-connections/${NIC1}.nmconnection + * simple/examples: use fai-link and fai-sed instead of ln and sed, + remove cryptsetup passphrase from format.log, + use class ROCKY instead of CENTOS, update Ubuntu support to 22.04, + add CLOUD_EFI, use ext4 for + /boot in LVM examples, install kernel packages without recommends, + use $kernelname in package_config set by class/DEBIAN.var + * 20-hwdetect.sh: do not load kernel modules by default + * get-boot-info: set NIC1 even if no network is used during installation + * grub.cfg: new code booting from local disk, support more than two + disks, add menu for UEFI settings + * 15-root-ssh-key: new script that adds ssh keys class based + * disk_config/*_EFI: use new format for gpt, p= instead of + primary + * GRUB_PC/10-setup: add test + * remove --pid from unshare call + + [ Mike Gabriel ] + * fai-abort:give job control to bash, Closes: #1020976 + + [ Juri Grabowski ] + * install_packages: add support for alpine Linux apk and + Archlinux pacman + + [ Guido Günther ] + * subroutines: allow one to pass a debootstrap script in FAI_DEBOOTSTRAP + + [ Christian Meyer ] + * fai-setup: add ECDSA-key to known_hosts + + [ Aki Tuomi ] + * check-cross-arch: fail on errors and unbound variables + + [ Hannes Eberhardt ] + * package_config/ROCKY: update EFI packages + + [ Christoph Pleger ] + * Commands.pm: sort btrfs subvolumes, Closes: #964761 + do not call mkfs mutliple times + + -- Thomas Lange Fri, 13 Jan 2023 22:45:03 +0100 + fai (5.10.3) unstable; urgency=low * GRUB_PC/10-setup: fallback if pdevice is empty, Closes: #988987 * 85-efi-classes: use loop and change order of classes * control: update standards version, no changes needed - -- Thomas Lange Sat, 22 May 2021 18:34:45 +0200 + -- Thomas Lange Tue, 20 Sep 2022 00:34:15 +0200 fai (5.10.2) unstable; urgency=medium @@ -74,7 +210,7 @@ * fai: use unshare when calling chroot * mount2dir: ignore nfs mounts * several shellcheck fixes - * fcopy: print file mode in octal + * fcopy: print file mode in octa l * get-boot-info: use ip --brief, remove variables NETMASK,BROADCAST * NEWS: add change of fai-sed * mkramdisk: set tmpfs size to 80% @@ -87,7 +223,8 @@ * package_config/DEBIAN: add non-free wireless packages * 30-interface: remove obsolete test, use CIDR * mk-basefile: add bookworm,trixie releases - * LAST/50-misc: add trixie release + * LAST/50-misc: add trixie release, print error if cryptsetup is missing + but needed * 20-hwdetect.sh: use ip --brief * rc.local/FAISERVER: check /etc/network/interfaces.d/$IFACE for nic devices, Closes: #965262 @@ -1061,7 +1198,7 @@ [ Moritz 'Morty' Strübe ] * fetch-basefile: create basefiles-folder if it does not exist * fai-make-nfsroot: fix check for /sbin/init - + -- Thomas Lange Mon, 23 Nov 2015 19:09:12 +0100 fai (4.3.3) unstable; urgency=high @@ -1190,7 +1327,7 @@ * setup-storage: fix preserve issue when attempting a combination of RAID and LVM ensures that the VG is active, before trying to wipe any LV - + -- Thomas Lange Fri, 25 Jul 2014 15:43:21 +0200 fai (4.2.1) unstable; urgency=low @@ -1209,7 +1346,7 @@ * setup-storage: fix for preservcing lv, deactivate vg before calling parted, Thanks to Kerim Gueney for the patch * add developers documentation for setup-storage - + -- Thomas Lange Wed, 09 Jul 2014 15:16:22 +0200 fai (4.2) unstable; urgency=low diff -Nru fai-5.10.3/debian/control fai-6.0.3+deb12u1/debian/control --- fai-5.10.3/debian/control 2021-05-22 16:27:33.000000000 +0000 +++ fai-6.0.3+deb12u1/debian/control 2022-10-24 07:20:29.000000000 +0000 @@ -2,18 +2,18 @@ Section: admin Priority: optional Maintainer: Thomas Lange -Standards-Version: 4.5.1 +Standards-Version: 4.6.1 Build-Depends-Indep: asciidoc-dblatex, w3m, dblatex, docbook-xsl, libparse-recdescent-perl -Build-Depends: debhelper-compat (= 12), debhelper (>= 11), libgraph-perl +Build-Depends: debhelper-compat (= 12), debhelper (>= 11), libgraph-perl, devscripts Vcs-Git: https://github.com/faiproject/fai.git Vcs-Browser: https://github.com/faiproject/fai Homepage: https://fai-project.org Package: fai-client Architecture: all -Depends: perl, file, libapt-pkg-perl, libfile-lchown-perl, iproute2, debconf-utils, procps, ${misc:Depends} -Recommends: libgraph-perl, fdisk | util-linux (<< 2.29.2-3~) -Suggests: logtail +Depends: perl, file, libfile-lchown-perl, iproute2, debconf-utils, procps, zstd, ${misc:Depends} +Recommends: fdisk | util-linux (<< 2.29.2-3~) +Suggests: logtail, libgraph-perl Breaks: fai-nfsroot (<< 5.2) Replaces: fai-nfsroot (<< 5.2) Description: Fully Automatic Installation client package @@ -74,7 +74,7 @@ Package: fai-nfsroot Architecture: all -Depends: fai-client (>=5.2), fai-setup-storage, pxelinux| syslinux-common, syslinux-efi, ${misc:Depends} +Depends: fai-client (>=5.2), fai-setup-storage, pxelinux| syslinux-common, syslinux-efi, patch, ${misc:Depends} Description: Fully Automatic Installation nfsroot package FAI is a non-interactive system to install, customize and manage Linux systems and software configurations on computers as well as diff -Nru fai-5.10.3/debian/copyright fai-6.0.3+deb12u1/debian/copyright --- fai-5.10.3/debian/copyright 2021-05-01 20:23:53.000000000 +0000 +++ fai-6.0.3+deb12u1/debian/copyright 2022-09-19 23:04:55.000000000 +0000 @@ -1,4 +1,4 @@ -Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Files: * Copyright: 1999-2021 Thomas Lange diff -Nru fai-5.10.3/debian/fai-doc.doc-base.package fai-6.0.3+deb12u1/debian/fai-doc.doc-base.package --- fai-5.10.3/debian/fai-doc.doc-base.package 2012-05-02 21:05:48.000000000 +0000 +++ fai-6.0.3+deb12u1/debian/fai-doc.doc-base.package 2023-05-25 16:22:26.000000000 +0000 @@ -5,9 +5,6 @@ Debian GNU/Linux. Section: Debian -Format: postscript -Files: /usr/share/doc/fai-doc/fai-guide.ps.gz - Format: text Files: /usr/share/doc/fai-doc/fai-guide.text.gz diff -Nru fai-5.10.3/debian/fai-nfsroot.install fai-6.0.3+deb12u1/debian/fai-nfsroot.install --- fai-5.10.3/debian/fai-nfsroot.install 2018-01-19 13:00:17.000000000 +0000 +++ fai-6.0.3+deb12u1/debian/fai-nfsroot.install 2023-06-23 20:43:21.000000000 +0000 @@ -7,6 +7,7 @@ usr/lib/fai/task_sysinfo usr/share/fai/dhclient-fai-script usr/share/fai/dhclient-fai.conf +usr/share/fai/udev.patch etc/apt/apt.conf.d/90fai etc/init.d/fai-abort usr/lib/dracut/modules.d diff -Nru fai-5.10.3/debian/rules fai-6.0.3+deb12u1/debian/rules --- fai-5.10.3/debian/rules 2021-05-01 20:23:53.000000000 +0000 +++ fai-6.0.3+deb12u1/debian/rules 2023-05-25 16:22:26.000000000 +0000 @@ -15,9 +15,6 @@ override_dh_installdocs: dh_installdocs -Nfai-server -Nfai-quickstart sed -i 's/FAIVERSIONSTRING/$(VERSIONSTRING)/' debian/fai-client/usr/share/doc/fai-client/README - # Remove embedded temporary directory for reproducible builds - sed -i -e 's,/tmp/tmp.*/fai-guide.ps,fai-guide.ps,g' debian/fai-doc/usr/share/doc/fai-doc/fai-guide.ps - sed -i -e 's,/tmp/tmp.*/fai-guide.dvi,fai-guide.dvi,g' debian/fai-doc/usr/share/doc/fai-doc/fai-guide.ps override_dh_installchangelogs: dh_installchangelogs -Nfai-server -Nfai-quickstart diff -Nru fai-5.10.3/debian/tests/common.sh fai-6.0.3+deb12u1/debian/tests/common.sh --- fai-5.10.3/debian/tests/common.sh 1970-01-01 00:00:00.000000000 +0000 +++ fai-6.0.3+deb12u1/debian/tests/common.sh 2022-11-02 20:46:28.000000000 +0000 @@ -0,0 +1,64 @@ + +# Configuration space + +. /etc/fai/nfsroot.conf + +N=$NFSROOT +CS=$FAI_CONFIGDIR +TFTP=$TFTPROOT + +# - - - - - - - - - - - - - - - - - +error() { + echo "$@" >/dev/stderr +} +# - - - - - - - - - - - - - - - - - +chk-file() { + + local file=$1 + if [ ! -f $file ]; then + error "$file is missing" + fi +} +# - - - - - - - - - - - - - - - - - +chk-no-file() { + + # check that files does not exist + local file=$1 + if [ -f $file ]; then + error "$file exists, but it should not." + fi +} +# - - - - - - - - - - - - - - - - - +chk-size() { + + # check if the disk space of a path is greater than minsize + # path can be a directory or a file + + local path=$1 + local minsize=$2 + local size + + if [ ! -e $path ]; then + error "$path does not exist." + fi + + size=$(du -Dsm $path | awk '{print $1}') + + if [ $size -lt $minsize ]; then + error "$path is too small: $size MB. Should be greater $minsize MB" + else + echo "OK: $path size is $size MB" + fi +} +# - - - - - - - - - - - - - - - - - +chk-loop-device() { + + # check if we can use loop devices + trap 'exit 77' ERR ABRT EXIT QUIT + qemu-img create test.raw 10M + loop=$(losetup -P -f --show test.raw) + echo "LOOP: $loop" + losetup -d $loop + rm test.raw + trap - ERR ABRT EXIT QUIT +} diff -Nru fai-5.10.3/debian/tests/config-space fai-6.0.3+deb12u1/debian/tests/config-space --- fai-5.10.3/debian/tests/config-space 1970-01-01 00:00:00.000000000 +0000 +++ fai-6.0.3+deb12u1/debian/tests/config-space 2022-11-05 23:26:09.000000000 +0000 @@ -0,0 +1,19 @@ +#! /bin/bash + +set -e + +. ./debian/tests/common.sh + +fai-mk-configspace + +# test the results of the commands called +chk-file $CS/class/50-host-classes +chk-file $CS/class/DEBIAN.var +chk-file $CS/class/40-parse-profiles.sh +chk-file $CS/scripts/GRUB_EFI/10-setup +chk-file $CS/disk_config/CLOUD +chk-file $CS/disk_config/FAIBASE +chk-file $CS/package_config/DEBIAN.gpg +chk-file $CS/package_config/DEMO +chk-file $CS/files/etc/rc.local/FAISERVER +chk-file $CS/debconf/DEBIAN diff -Nru fai-5.10.3/debian/tests/control fai-6.0.3+deb12u1/debian/tests/control --- fai-5.10.3/debian/tests/control 1970-01-01 00:00:00.000000000 +0000 +++ fai-6.0.3+deb12u1/debian/tests/control 2022-11-06 18:24:43.000000000 +0000 @@ -0,0 +1,24 @@ +Tests: utils +Depends: fai-server, fai-doc +Architecture: amd64 + +Tests: config-space fcopy nfsroot dirinstall +Restrictions: isolation-container needs-root needs-internet +Depends: fai-server, fai-doc +Architecture: amd64 + +Tests: fai-mirror +Restrictions: isolation-container needs-internet +Depends: fai-server, fai-doc, reprepro, binutils +Architecture: amd64 + +Tests: fai-cd fai-cd-tests +Restrictions: isolation-machine needs-root +Depends: fai-server, fai-doc, xorriso, squashfs-tools, binutils, dosfstools, mtools +Architecture: amd64 + +Tests: diskimage +Restrictions: isolation-container needs-root needs-internet skippable +Depends: fai-server, fai-doc, reprepro, binutils, fai-setup-storage, qemu-utils +Architecture: amd64 + diff -Nru fai-5.10.3/debian/tests/dirinstall fai-6.0.3+deb12u1/debian/tests/dirinstall --- fai-5.10.3/debian/tests/dirinstall 1970-01-01 00:00:00.000000000 +0000 +++ fai-6.0.3+deb12u1/debian/tests/dirinstall 2022-11-07 06:33:36.000000000 +0000 @@ -0,0 +1,45 @@ +#! /bin/bash + +# test fai dirinstall + +set -e + +. ./debian/tests/common.sh +trap "cp -avL dirinstall.log $AUTOPKGTEST_ARTIFACTS" INT QUIT EXIT +cd "$AUTOPKGTEST_TMP" + +ch=/srv/chroot +cl="DEBIAN,AMD64,FAIBASE,DHCPC,DEMO,LAST" +export NIC1=dummy +LC_ALL=C fai -v dirinstall -c $cl -s file://$CS $ch >& dirinstall.log + + + +# test the results of the commands called +chk-size $ch 780 +chk-size $ch/boot 30 + +# chroot into and execute some commands +chroot $ch ls -l /boot/ || error "error calling ls in chroot" +chroot $ch /usr/bin/ldd --version +chroot $ch /usr/bin/apt --version || error "error calling apt in chroot" +chroot $ch /usr/bin/systemd --version +chk-no-file $ch/etc/dpkg/dpkg.cfg.d/unsafe-io + +grep tmpfs $ch/etc/fstab +if [ ! -f $ch/etc/network/interfaces.d/dummy ]; then + error "dirinstall failed. interfaces.d/dummy is missing" +fi +if [ ! -d $ch/home/demo/ ]; then + error "dirinstall failed. No home dir for user demo" +fi +if grep -q FAILED $ch/var/log/fai/localhost/last/status.log; then + error "dirinstall failed. See status.log" +fi +if grep -q FAILED dirinstall.log; then + error "dirinstall failed. See dirinstall.log" +fi + +if [ X$NO_CLEANUP != X1 ]; then + rm -rf $ch +fi diff -Nru fai-5.10.3/debian/tests/diskimage fai-6.0.3+deb12u1/debian/tests/diskimage --- fai-5.10.3/debian/tests/diskimage 1970-01-01 00:00:00.000000000 +0000 +++ fai-6.0.3+deb12u1/debian/tests/diskimage 2022-11-06 21:11:24.000000000 +0000 @@ -0,0 +1,91 @@ +#! /bin/bash + +# fai-diskimage +# Depends fai-setup-storage +# apt -o APT::Install-Suggests=0 -o APT::Install-Recommends=0 install fai-setup-storage + +set -e + +. ./debian/tests/common.sh +cd "$AUTOPKGTEST_TMP" + +chk-loop-device + +vlf=/var/log/fai + +main-check() { + + chk-size /mnt/boot 38 + chk-size /mnt/lib 430 + chk-size /mnt/bin 45 + chk-size /mnt/usr/lib/modules 300 + chk-file /mnt/boot/grub/grub.cfg + chk-file /mnt/etc/network/interfaces.d/eth0 + chk-file /mnt/etc/rc.local + + echo 'd41d8cd98f00b204e9800998ecf8427e /mnt/etc/machine-id' | md5sum -c + + chk-no-file /mnt/var/lib/dbus/machine-id + chk-no-file /mnt/etc/udev/rules.d/70-persistent-net.rules + chk-no-file /mnt/etc/resolv.conf + chk-no-file /mnt/etc/ssh/ssh_host_ed25519_key + chk-no-file /mnt/etc/ssh/ssh_host_ecdsa_key + chk-no-file /mnt/etc/dpkg/dpkg.cfg.d/unsafe-io +} + +trap "cp -ap /var/log/fai/cloud? diskimage*.log $AUTOPKGTEST_ARTIFACTS" INT QUIT EXIT + +echo "=== creating and testing legacy bios diskimage ===" + +cl="DEBIAN,AMD64,FAIBASE,GRUB_PC,DHCPC,DEMO,CLOUD,LAST" +LC_ALL=C fai-diskimage -vu cloud3 -S2G -c$cl cloud.raw >& diskimage.log + +# test the results of the commands called +chk-size cloud.raw 860 + +mount -oloop,ro,offset=1048576 cloud.raw /mnt +main-check +umount /mnt + +if grep -q FAILED $vlf/cloud3/last/status.log; then + error "fai-diskimage failed. See status.log" +fi +if [ -f $vlf/cloud3/last/error.log ]; then + cat $vlf/cloud3/last/error.log >/dev/stderr +fi + +if [ X$NO_CLEANUP != X1 ]; then + rm cloud.raw +fi + + +echo "=== creating and testing EFI diskimage ===" + +# now create a diskimage using EFI +cl="DEBIAN,AMD64,FAIBASE,GRUB_EFI,DHCPC,DEMO,CLOUD,CLOUD_EFI,LAST" +LC_ALL=C fai-diskimage -vu cloud4 -S2G -c$cl cloud-efi.raw >& diskimage-efi.log + +chk-size cloud-efi.raw 890 +mount -oloop,offset=1048576 cloud-efi.raw /mnt +chk-file /mnt/EFI/debian/grub.cfg +chk-file /mnt/EFI/BOOT/grubx64.efi +chk-size /mnt 3 +umount /mnt + +dev=$(losetup --show -f cloud-efi.raw) +partprobe -s $dev +mount ${dev}p2 /mnt +main-check +umount /mnt +losetup -D $dev + +if grep -q FAILED $vlf/cloud4/last/status.log; then + error "fai-diskimage failed. See status.log" +fi +if [ -f $vlf/cloud4/last/error.log ]; then + cat $vlf/cloud4/last/error.log >/dev/stderr +fi + +if [ X$NO_CLEANUP != X1 ]; then + rm cloud-efi.raw +fi diff -Nru fai-5.10.3/debian/tests/fai-cd fai-6.0.3+deb12u1/debian/tests/fai-cd --- fai-5.10.3/debian/tests/fai-cd 1970-01-01 00:00:00.000000000 +0000 +++ fai-6.0.3+deb12u1/debian/tests/fai-cd 2022-11-06 21:10:49.000000000 +0000 @@ -0,0 +1,22 @@ +#! /bin/bash + +# test fai-cd + +set -e + +. ./debian/tests/common.sh +trap "cp -vp fai-cd.log $AUTOPKGTEST_ARTIFACTS" INT QUIT EXIT +cd "$AUTOPKGTEST_TMP" + + +# - - - - - - - - - - - - - - - - - +fai-cd -Jm /tmp/mirror faicd64-small.iso >& fai-cd.log +echo fai-cd exit code: $? + + +# test the results of the commands called +chk-size faicd64-small.iso 730 + +if [ X$NO_CLEANUP != X1 ]; then + rm -rf /tmp/mirror +fi diff -Nru fai-5.10.3/debian/tests/fai-cd-tests fai-6.0.3+deb12u1/debian/tests/fai-cd-tests --- fai-5.10.3/debian/tests/fai-cd-tests 1970-01-01 00:00:00.000000000 +0000 +++ fai-6.0.3+deb12u1/debian/tests/fai-cd-tests 2022-11-06 21:10:57.000000000 +0000 @@ -0,0 +1,22 @@ +#! /bin/bash + +# more tests for fai-cd + +set -e + +. ./debian/tests/common.sh +trap "cp -vp fai-cd.log $AUTOPKGTEST_ARTIFACTS" INT QUIT EXIT +cd "$AUTOPKGTEST_TMP" + +chk-loop-device + +# more test after mounting the ISO +mount -oloop,ro faicd64-small.iso /mnt +chk-size /mnt/boot/initrd.img 35 +chk-file /mnt/FAI-CD + +umount /mnt + +if [ X$NO_CLEANUP != X1 ]; then + rm faicd64-small.iso +fi diff -Nru fai-5.10.3/debian/tests/fai-mirror fai-6.0.3+deb12u1/debian/tests/fai-mirror --- fai-5.10.3/debian/tests/fai-mirror 1970-01-01 00:00:00.000000000 +0000 +++ fai-6.0.3+deb12u1/debian/tests/fai-mirror 2022-11-05 23:43:40.000000000 +0000 @@ -0,0 +1,34 @@ +#! /bin/bash + +. ./debian/tests/common.sh +error=0; trap 'error=$(($?>$error?$?:$error))' ERR # save maximum error code +trap "cp -vp mirror.log $AUTOPKGTEST_ARTIFACTS" INT QUIT EXIT +cd "$AUTOPKGTEST_TMP" + +mdir=/tmp/mirror +fai-mirror -s$CS -m1 -xARM64,I386,ROCKY,UBUNTU,FOCAL,CLOUD,CHROOT,STANDARD,NONFREE,GNOME $mdir >& mirror.log + +# test the results of the commands called +s=$(du -sm --exclude aptcache --exclude db $mdir | awk '{print $1}') +if [ $s -lt 420 ]; then + error "$mdir is too small: $s MB" +else + echo "OK: $mdir size is $s MB" +fi + +find $mdir -name \*.deb > pkg.list +n=$(wc -l pkg.list | awk '{ print $1}') +if [ $n -lt 800 ]; then + error "fai-mirror includes too few packages. Only $n found." +else + echo "OK. Number of packages found in mirror: $n" +fi + +# check some package names in the mirror +pkgs="linux-image- dracut-network_ xfce4-taskmanager_ xfdesktop4_ syslinux-common_ lvm2_" +for p in $pkgs ; do + echo Search for $p + grep /$p pkg.list || error "$p not in mirror." +done + +exit $error diff -Nru fai-5.10.3/debian/tests/fcopy fai-6.0.3+deb12u1/debian/tests/fcopy --- fai-5.10.3/debian/tests/fcopy 1970-01-01 00:00:00.000000000 +0000 +++ fai-6.0.3+deb12u1/debian/tests/fcopy 2022-11-07 10:33:02.000000000 +0000 @@ -0,0 +1,12 @@ +#! /bin/bash + +set -e + +. ./debian/tests/common.sh +export PATH=$PATH:/sbin +cd "$AUTOPKGTEST_TMP" + +fcopy -vs $CS/files/ -t /tmp -c DEBIAN,DEMO /etc/rc.local 2>&1 && error "wrong fcopy fail" +fcopy -vs $CS/files/ -t /tmp -c FAISERVER,CLOUD /etc/rc.local +chk-file /tmp/etc/rc.local +diff $CS/files/etc/rc.local/CLOUD /tmp/etc/rc.local || error "Files are not the same." diff -Nru fai-5.10.3/debian/tests/nfsroot fai-6.0.3+deb12u1/debian/tests/nfsroot --- fai-5.10.3/debian/tests/nfsroot 1970-01-01 00:00:00.000000000 +0000 +++ fai-6.0.3+deb12u1/debian/tests/nfsroot 2022-11-06 19:42:20.000000000 +0000 @@ -0,0 +1,42 @@ +#! /bin/bash + +set -e + +. ./debian/tests/common.sh +cd "$AUTOPKGTEST_TMP" +trap "cp -vp /var/log/fai/fai-make-nfsroot.log nfsroot.log $AUTOPKGTEST_ARTIFACTS" INT QUIT EXIT + +fai-make-nfsroot -zgv > nfsroot.log +err=$? +echo "exit code fai-make-nfsroot: $err" +if [ $err -ne 0 ]; then + error "ERROR: fai-make-nfsroot exit code $err" +fi + +# test the results of the commands called +chk-size $N 700 + +grep 'fai-make-nfsroot finished properly.' nfsroot.log || error "fai-make-nfsroot error." +egrep '^Calling debootstrap ' nfsroot.log +egrep ^fai-nfsroot nfsroot.log +egrep ^dracut-network nfsroot.log || error "package dracut-network is missing." + +chk-file $TFTP/pxelinux.0 +chk-file $TFTP/syslinux.efi +chk-file $TFTP/ldlinux.e64 +chk-size $N/boot/initrd.img* 40 +chk-no-file $N/etc/udev/rules.d/70-persistent-net.rules + +chroot $N /usr/bin/lsinitrd -m /initrd.img | grep livenet || error "livenet fehlt" +chroot $N /usr/bin/lsinitrd /initrd.img | grep mount.nfs || error "mount.nfs fehlt" + +# - - - - - - - - - - - - - - - - - +# fai-chboot +# currently fai-chboot writes to stderr +fai-chboot -o default 2>/dev/null +fai-chboot -Iv -f verbose,sshd,createvt,menu -u nfs://faiserver/$CS test.tmpl 2>/dev/null +fai-chboot -Iv -f verbose,sshd,createvt,menu -u nfs://faiserver/$CS localhost 2>/dev/null + +chk-file $TFTP/pxelinux.cfg/default +chk-file $TFTP/pxelinux.cfg/test.tmpl +chk-file $TFTP/pxelinux.cfg/7F000001 diff -Nru fai-5.10.3/debian/tests/utils fai-6.0.3+deb12u1/debian/tests/utils --- fai-5.10.3/debian/tests/utils 1970-01-01 00:00:00.000000000 +0000 +++ fai-6.0.3+deb12u1/debian/tests/utils 2022-11-06 18:32:24.000000000 +0000 @@ -0,0 +1,30 @@ +#! /bin/bash + +# test some FAI utilities + +set -e + +. ./debian/tests/common.sh +cd "$AUTOPKGTEST_TMP" + +echo "7565a01bd35f31ba82ab55c978c1b755 testfile" > testfile.md5sum +ainsl -a testfile "first line" +ainsl testfile "first line" +ainsl testfile "second line" +ainsl testfile "first line" +md5sum -c testfile.md5sum + +fai-link linka testfile +fai-link linka testfile +fai-sed 's/testfile/newfile/' testfile.md5sum +fai-sed 's/testfile/AAA/' testfile.md5sum +fai-sed -E 's/testfile/newfile/' testfile.md5sum +mv testfile newfile +md5sum -c testfile.md5sum + +# test if symlink was created +fai-sed 's/newfile/linkb/' testfile.md5sum +fai-link linkb newfile +md5sum -c testfile.md5sum + +rm -rf testfile.md5sum linka linkb newfile diff -Nru fai-5.10.3/debian/watch fai-6.0.3+deb12u1/debian/watch --- fai-5.10.3/debian/watch 2013-11-29 23:02:23.000000000 +0000 +++ fai-6.0.3+deb12u1/debian/watch 2022-10-05 09:41:53.000000000 +0000 @@ -1,4 +1,4 @@ -version=3 +version=4 opts=uversionmangle=s/_/./g;s/^(\S*\.deb\d+u\d+)$/0.0.$1/ \ -https://github.com/faiproject/fai/releases \ +https://github.com/faiproject/fai/tags \ .*[^n]/(?:|v|version-|r|REL_|rel-|fai(?:_|-))(\d[^\s/]*)\.(?:tar\.xz|txz|tar\.bz2|tbz2|tar\.gz|tgz) diff -Nru fai-5.10.3/dev-utils/fai-kvm fai-6.0.3+deb12u1/dev-utils/fai-kvm --- fai-5.10.3/dev-utils/fai-kvm 2021-05-01 20:23:53.000000000 +0000 +++ fai-6.0.3+deb12u1/dev-utils/fai-kvm 2022-10-31 22:18:49.000000000 +0000 @@ -2,7 +2,7 @@ # fai-kvm, start kvm host for testing FAI software # -# Author: Thomas Lange, Uni Koeln, 2011-2021 +# Author: Thomas Lange, Uni Koeln, 2011-2022 # License: GPL v2 or any later version fix="-k en-us -smp 2 -cpu host -global isa-fdc.driveA= " # if loading cirrusfb (via pcimodules and modprobe cirrusfb) causes errors in kvm @@ -20,6 +20,7 @@ daemonize=0 efi=0 order=cd +usenvme=0 # not all mac addresses work in kvm (or the bridge), be carefull when changing the first two bytes # If you are generating your own MAC addresses you should use a value that contains 2,6,A or E as the second number as this defines a locally administered MAC address. @@ -33,13 +34,22 @@ boot_disk() { # boot from disk + local ldisk + local f + [ -n "$1" ] && disk=$1 shift case "$disk" in *.raw) f=",format=raw" ;; esac + + if [ $usenvme -eq 1 ]; then + ldisk="-drive file=$disk,if=none$f,id=nvme1 -device nvme,serial=SN123450001,drive=nvme1" + else + ldisk="-drive file=$disk,if=virtio$f " + fi set -x - kvm $gopt -boot order=c $net -drive file=$disk,if=virtio$f $* + kvm $gopt -boot order=c $net $ldisk $* } # - - - - - - - - - - - - - - - - - - - - - - - - - boot_pxe() { @@ -81,6 +91,7 @@ -s size of the local disk in GB (default is ${size}GB) -d number of local disks (default is 1) -D directory, where the disk image files are created (default: $diskdir) + -M Create NVMe drives instead of SATA disks. You may want to add -E. -m RAM size in MB (defaults is ${ram}MB) -u user number. This will become part of the MAC address of the interface of the VM and is the number of the tap device number. It is also used @@ -98,13 +109,14 @@ } # - - - - - - - - - - - - - - - - - - - - - - - - - -while getopts "EbUhnNu:s:m:d:VD:t:O" opt ; do +while getopts "EbUhnNu:s:Mm:d:VD:t:O" opt ; do case "$opt" in O) order=dc ;; b) daemonize=1 ;; E) efi=1 ;; n) newdisk=1 ;; N) newdisk=2 ;; + M) usenvme=1 ;; U) usernet=1 ;; u) user=$OPTARG ;; m) ram=$OPTARG ;; @@ -148,8 +160,12 @@ disk="" for i in $(seq 1 $disks) ; do - disk="$disk -drive file=$diskfile-$i.qcow2,if=virtio,index=$i" - if [ $i -eq 1 ] ; then + if [ $usenvme -eq 1 ]; then + disk="$disk -drive file=$diskfile-$i.qcow2,if=none,id=nvme$i -device nvme,serial=SN12345000$i,drive=nvme$i" + else + disk="$disk -drive file=$diskfile-$i.qcow2,if=virtio,index=$i" + fi + if [ $i -eq 1 ] ; then disk="$disk" fi done diff -Nru fai-5.10.3/dev-utils/fai-mk-network fai-6.0.3+deb12u1/dev-utils/fai-mk-network --- fai-5.10.3/dev-utils/fai-mk-network 2021-05-01 20:23:53.000000000 +0000 +++ fai-6.0.3+deb12u1/dev-utils/fai-mk-network 2022-12-08 12:25:15.000000000 +0000 @@ -5,7 +5,7 @@ # fai-mk-network -- setup a test network for FAI # # This script is part of FAI (Fully Automatic Installation) -# (c) 2015 by Thomas Lange, lange@informatik.uni-koeln.de +# (c) 2015-2022 by Thomas Lange, lange@cs.uni-koeln.de # Universitaet zu Koeln # #********************************************************************* @@ -13,7 +13,7 @@ PATH=/sbin:/bin:/usr/sbin:/usr/bin tapnum=9 # how many tap devies will be created -brip=192.168.33.1 # IP of bridge device +brip=192.168.33.250 # IP of bridge device brname=br0 # default network device used for routing to the outside internet @@ -24,7 +24,7 @@ cat <&/dev/null; then - echo "brctl not found. Please install bridge-utils." - exit 3 -fi - if [ $remove -eq 1 ]; then rm_bridge fi if [ -z "$1" ]; then - echo "Please add a user name which will own the tap devices." + echo "ERROR: Please add a user name which will own the tap devices." echo "" usage fi diff -Nru fai-5.10.3/doc/Makefile fai-6.0.3+deb12u1/doc/Makefile --- fai-5.10.3/doc/Makefile 2019-10-17 01:08:18.000000000 +0000 +++ fai-6.0.3+deb12u1/doc/Makefile 2023-05-07 14:29:11.000000000 +0000 @@ -6,12 +6,12 @@ OPT = --dblatex-opts "-P latex.output.revhistory=0" -free: text html ps pdf +free: text html pdf # echo "`grep -c FIXME $(DOC).txt` FIXMEs left to fix:" # grep FIXME $(DOC).txt images: - ln -s /usr/share/asciidoc/images images + ln -s /usr/share/asciidoc/images images html: $(DOC).txt images asciidoc -a toc2 -a toclevels=3 --theme=flask $(DOC).txt @@ -21,11 +21,6 @@ a2x $(OPT) -L --icons -a toc -a toclevels=3 -f pdf $(DOC).txt rm -f $(DOC).xml $(DOC).fo -.NOTPARALLEL: ps -ps: $(DOC).txt images - a2x $(OPT) -L --icons -a toc -a toclevels=3 -f ps $(DOC).txt - rm -f $(DOC).xml $(DOC).fo - # a2x uses lynx, maybe use w3m instead # which texwidth for text output? # asciidoc --doctype=article -a "toc" -a "toclevels=3" -f /etc/asciidoc/text.conf -b html4 -o - "f-guide.txt" | lynx -dump -stdin >"./f-guide.text" diff -Nru fai-5.10.3/doc/fai-guide.txt fai-6.0.3+deb12u1/doc/fai-guide.txt --- fai-5.10.3/doc/fai-guide.txt 2021-05-01 20:23:53.000000000 +0000 +++ fai-6.0.3+deb12u1/doc/fai-guide.txt 2023-06-23 20:43:21.000000000 +0000 @@ -10,7 +10,6 @@ :Revision: 5.8 :nfsrootsize: 780 -:mirrorsize: 56 //// => _ @@ -20,7 +19,7 @@ => _ //// -French version of this guide is available at http://fai-project.org/fai-guide-fr. +An older French version of this guide is available at https://fai-project.org/fai-guide-fr. Abstract -------- @@ -34,7 +33,7 @@ configuration and how to deal with errors. -(c) 2000-2020 Thomas Lange +(c) 2000-2022 Thomas Lange .Copyright @@ -52,10 +51,7 @@ '/usr/share/common-licenses/GPL' in the Debian GNU/Linux distribution or on the World Wide Web at https://www.gnu.org/copyleft/gpl.html[the GNU website] You can also obtain it by writing to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, -USA - - +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. <<< @@ -189,7 +185,7 @@ * ReiserFS, ext3/ext4, btrfs and XFS file system support. * Software RAID and LVM support. * Automatic hardware detection. -* You can deploy Debian, Ubuntu, CentOS, SuSE, Scientific Linux. +* You can deploy Debian, Ubuntu, Rocky Linux, CentOS, SuSE, Scientific Linux. * Remote login via ssh during installation process possible. * All similar configurations are shared among all install clients. * Log files for all installations are saved to the installation server. @@ -257,7 +253,7 @@ network using the command `fai-mk-network`. First install some packages ---- -# apt-get install qemu-system-gui qemu-kvm qemu-utils bridge-utils +# apt-get install qemu-system-gui qemu-kvm qemu-utils ---- The next command sets up a private network with a software bridge with several tap devices @@ -645,7 +641,8 @@ ---- The only FAI specific information inside this configuration file is to -set +filename+ to +fai/pxelinux.0+ and to set +next-server+ and +set +filename+ (DHCP option 67) to +fai/pxelinux.0+ and to set ++next-server+ (DHCP option 66, also called TFTP server name) and +server-name+ to the name of your install server. All other information is only network related data, which is used in almost all DHCP configurations. Adjust these network parameters to your local @@ -992,13 +989,13 @@ === [[packageconfig]]Software package configuration Before installing packages, FAI will add the content of all files -named _package_config/class.asc_ to the list of apt keys. If your local +named _package_config/class.gpg_ to the list of apt keys. If your local repository is signed by your keyid AB12CD34 you can easily add this key, so FAI will use it during installation. Use this command for creating -the 'CLASS.asc' file: +the 'CLASS.gpg' file: ---- -faiserver$ gpg -a --export AB12CD34 > /srv/fai/config/package_config/MYCLASS.asc +faiserver$ gpg --export AB12CD34 > /srv/fai/config/package_config/MYCLASS.gpg ---- @@ -1019,19 +1016,18 @@ PACKAGES remove gpm xdm -PACKAGES aptitude GRUB +PACKAGES install GRUB lilo- grub - ---- Comments are starting with a hash (#) and are ending at the end of the line. Every package command begins with the word _PACKAGES_ followed by a command name, which maps to a different package tool like apt-get, -aptitude or yum for e.g. The command defines which command will be used to +aptitude or dnf for e.g. The command defines which command will be used to install the packages named after this command. The list of all available commands can be listed using _install_packages -H_. -Supported package tools are: _aptitude, apt-get, smart, yast, -yum, rpm, zypper_ +Supported package tools are: _apt, apt-get, aptitude, smart, yast, +dnf, rpm, zypper_ hold:: Put a package on hold. This package will not be handled by dpkg, e.g @@ -1088,6 +1084,22 @@ version like _apt=0.3.1_. More information on these features are described in `aptitude(8)`. +You can specify additional parameters for the package manager adding +_key=value_ after _PACKAGES _. Currently we support +_release=_ which will add _-t _ when installing packages. + +Example: +---- +PACKAGES install-norec release=testing +nvidia-smi +---- + +This will install the nvidia-smi package from the testing release, +including the dependencies. Don't forget to add an entry into +'sources.list'. You may also want to adjust the apt pinning (see +'apt_references(5)'). + + A line which contains the _PRELOADRM_ commands, downloads a file using `wget(1)` into a directory before installing the packages. Using the _file:_ URL, this file is copied from +$FAI_ROOT+ to the download @@ -1144,11 +1156,8 @@ possible to use scripts of different languages (shell, cfengine, Perl, Python, Ruby, expect,..) for one class. -Thoses scripts write their output to different log files, depending on -the type of script. For e.g. all shell scripts write their log to -`shell.log`. - - +Thoses scripts write their output to sripts.log. The file status.log +contains the names of all scripts executed and their exit status. ==== [[shell]]Shell scripts @@ -1440,7 +1449,7 @@ types (shell, cfengine, ...) to be executed for one class. The default set of scripts in '$FAI/scripts' include examples for -installing Debian and CentOS machines. They set the root password, add +installing Debian and Rocky Linux machines. They set the root password, add a user account (set by '$username, default to demo), set the timezone, configure the network for DHCP or using a fixed IP address, setup grub and more. They should do a reasonable job for your installation. You can edit @@ -1455,12 +1464,12 @@ _/var/log/fai/$HOSTNAME/install/_ footnote:['/var/log/fai/localhost/install/' is a link to this directory.] on the new system and to the account on the install server -if +$LOGUSER+ is defined. It is also possible to specify +if +$LOGUSER+ is defined (you have to enable this in +'/srv/fai/config/class/FAIBASE.var'). It is also possible to specify another host as log saving destination through the variable +$LOGSERVER+. If +$LOGSERVER+ is not defined, FAI uses the variable +$SERVER+ which is only defined during an initial installation (by -get-boot-info). Make sure to set +$LOGSERVER+ in a _class/*.var_ script -if you are using the action _softupdate_. +get-boot-info). Additionally, two symlinks will be created to indicated the last directory written to. The symlink 'last' points to the log directory @@ -1622,7 +1631,7 @@ FAI_DEBOOTSTRAP:: Building the nfsroot uses the command `debootstrap(8)`. It needs the location of a Debian mirror and the -name of the distribution (wheezy, jessie, stretch, sid) for which the basic Debian +name of the distribution (like bullsseye, bookworm, sid) for which the basic Debian system should be built. Do not use different distributions here and in '/etc/fai/apt/sources.list'. This will create a broken nfsroot. @@ -1728,7 +1737,7 @@ with hostname set to foobar. ---- # export FAI_BASEFILEURL=https://fai-project.org/download/basefiles/ -# cl=DHCPC,UBUNTU,XENIAL,XENIAL64,AMD64,XORG,LAST +# cl=DHCPC,UBUNTU,JAMMY,JAMMY64,AMD64,XORG,LAST # fai-diskimage -Nvu foobar -S5G -c$cl ubuntu.qcow2 ---- @@ -1853,14 +1862,14 @@ You can install all sorts of Linux distributions from a single Debian nfsroot. Therefore you have to create a base.tar.xz of the distribution you like to install and place it into the `basefiles` directory. Then -name it UBUNTU1404.tar.xz for example. An install client which belongs -to the class UBUNTU1404 then extracts this base file into its empty +name it UBUNTU2204.tar.xz for example. An install client which belongs +to the class UBUNTU2204 then extracts this base file into its empty file system. Additionally you have to adjust the 'sources.list' or similar configuration files which are needed for specifying the location of the package repository. The tool `rinse(8)` is used for creating base files for distribution -like CentOS, openSUSE, Scientific Linux Cern or Fedora. +like Rocky Linux, CentOS, openSUSE or Fedora. Some basefiles can be downloaded from https://fai-project.org/download/basefiles/. @@ -2292,8 +2301,9 @@ The utility `mkdebmirror` footnote:[You can find the script in '/usr/share/doc/fai-doc/examples/utils/'] can be used for creating your own local Debian mirror. This script uses `debmirror(1)`. A partial Debian mirror for i386 and amd64 architecture for -Debian 8.0 (aka jessie) without the source packages needs about -{mirrorsize}GB of disk space. Accessing the mirror via HTTP will be the +Debian 11.0 (aka bullseye) without the source packages needs about +100GB of disk space. An amd64 only mirror needs about 80GB. +Accessing the mirror via HTTP will be the default way in most cases. To see more output from the script call +mkdebmirror -v+. A root account is not necessary to create and maintain the Debian mirror. @@ -2406,11 +2416,11 @@ + If you want to serve multiple nfsroot directories, you need to create specific config directories in '/etc' for FAI, like -'/etc/fai-jessie' and '/etc/fai-stretch'. Then you need to set the +'/etc/fai-buster' and '/etc/fai-bookworm'. Then you need to set the +$NFSROOT+ variables to different directories and run ---- -faiserver#fai-make-nfsroot -C /etc/fai-jessie +faiserver#fai-make-nfsroot -C /etc/fai-buster ---- @@ -2421,11 +2431,6 @@ for network as well as bootmedium installations. -=== CentOS reboot -After the installation CentOS usually requires one additional reboot, -because of the SELinux security fixes that are applied post-installation. - - === [[logfiles]]Log files FAI is creating several log files. During installation they are stored diff -Nru fai-5.10.3/doc/includes/fai-1st-part.txt fai-6.0.3+deb12u1/doc/includes/fai-1st-part.txt --- fai-5.10.3/doc/includes/fai-1st-part.txt 2018-03-10 20:42:17.000000000 +0000 +++ fai-6.0.3+deb12u1/doc/includes/fai-1st-part.txt 2022-10-03 18:57:01.000000000 +0000 @@ -29,9 +29,9 @@ 01-short-hostname.sh OK. Executing /var/lib/fai/config/class/10-base-classes. 10-base-classes OK. -Executing /var/lib/fai/config/class/20-hwdetect.source. +Executing /var/lib/fai/config/class/20-hwdetect.sh. Loading kernel module md-mod -20-hwdetect.source OK. +20-hwdetect.sh OK. Executing /var/lib/fai/config/class/50-host-classes. 50-host-classes OK. List of all classes: DEFAULT LINUX AMD64 FAIBASE DHCPC DEMO GRUB client01 LAST diff -Nru fai-5.10.3/doc/setup-storage-overview.txt fai-6.0.3+deb12u1/doc/setup-storage-overview.txt --- fai-5.10.3/doc/setup-storage-overview.txt 2021-04-14 13:02:27.000000000 +0000 +++ fai-6.0.3+deb12u1/doc/setup-storage-overview.txt 2022-10-06 17:07:28.000000000 +0000 @@ -14,7 +14,7 @@ | in_path | | └---------------| - | + | ┌---------------| | | Volumes.pm get_current_disks @@ -23,14 +23,14 @@ | propagate_and_check_preserve | | └---------------| - | + | ┌---------------| | | Sizes.pm compute_partition_sizes | compute_lv_sizes | | └---------------| - | + | ┌---------------| | | Commands.pm build_disk_commands @@ -39,13 +39,13 @@ | order_commands | | └---------------| - | + | ┌---------------| | | Exec.pm execute_command | | └---------------| - | + | ┌---------------| | | Fstab.pm generate_fstab @@ -64,9 +64,4 @@ the correct order of commands and resolve the dependencies. Commands are added to the structure by using the - FAI::push_command(COMMAND, PRE, POST) subroutine. - - - - - + FAI::push_command(COMMAND, PRE, POST) subroutine. diff -Nru fai-5.10.3/examples/etc/netgroup fai-6.0.3+deb12u1/examples/etc/netgroup --- fai-5.10.3/examples/etc/netgroup 2011-11-10 18:17:36.000000000 +0000 +++ fai-6.0.3+deb12u1/examples/etc/netgroup 1970-01-01 00:00:00.000000000 +0000 @@ -1,43 +0,0 @@ -# permission for a list of hosts - -# the beowulf cluster -nucleus (nucleus,,) -atom00 (atom00,,) -atom01 (atom01,,) -atom02 (atom02,,) -atom03 (atom03,,) -atom04 (atom04,,) -atom05 (atom05,,) -atom06 (atom06,,) -atom07 (atom07,,) -atom08 (atom08,,) -atom09 (atom09,,) -atom10 (atom10,,) -atom11 (atom11,,) -atom12 (atom12,,) -atom13 (atom13,,) -atom14 (atom14,,) -atom15 (atom15,,) -atom16 (atom16,,) -atom17 (atom17,,) -atom18 (atom18,,) -atom19 (atom19,,) -atom20 (atom20,,) -atom21 (atom21,,) -atom22 (atom22,,) -atom23 (atom23,,) -atom24 (atom24,,) -atom25 (atom25,,) - -atoms atom01 atom02 atom03 atom04 atom05 atom06 atom07 atom08 atom09 atom10 atom11 atom12 atom13 atom14 atom15 atom16 atom17 atom18 atom19 atom20 atom21 atom22 atom23 atom24 atom25 - -# used for script all_hosts -allhosts atom00 atoms - -beowulf atoms atom00 nucleus -homeclients beowulf - -faiclients workstations beowulf - -# this definition grants permission for every host -# faiclients (,,) diff -Nru fai-5.10.3/examples/simple/basefiles/mk-basefile fai-6.0.3+deb12u1/examples/simple/basefiles/mk-basefile --- fai-5.10.3/examples/simple/basefiles/mk-basefile 2021-03-02 21:05:13.000000000 +0000 +++ fai-6.0.3+deb12u1/examples/simple/basefiles/mk-basefile 2023-05-25 16:11:50.000000000 +0000 @@ -2,7 +2,7 @@ # mk-basefile, create basefiles for some distributions # -# Thomas Lange, Uni Koeln, 2011-2021 +# Thomas Lange, Uni Koeln, 2011-2022 # based on the Makefile implementation of Michael Goetze # # Usage example: mk-basefile -J STRETCH64 @@ -10,7 +10,8 @@ # Supported distributions (each i386/amd64): # Debian GNU/Linux -# Ubuntu 14.04/16.04 +# Ubuntu 14.04/16.04/20.04/22.04 +# Rocky Linux 8/9 # CentOS 5/6/7/8 # Scientific Linux Cern 5/6 # @@ -32,12 +33,14 @@ 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= @@ -111,7 +114,8 @@ 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/etc/udev/rules.d/70-persistent-net.rules \ + $xtmp/var/lib/dbus/machine-id > $xtmp/etc/machine-id } @@ -138,6 +142,21 @@ } +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 @@ -205,6 +224,8 @@ echo "Available: + ROCKY8_64 + ROCKY9_64 CENTOS5_32 CENTOS5_64 CENTOS6_32 CENTOS6_64 CENTOS7_32 CENTOS7_64 @@ -216,6 +237,7 @@ XENIAL32 XENIAL64 BIONIC64 FOCAL64 + JAMMY64 SQUEEZE32 SQUEEZE64 WHEEZY32 WHEEZY64 JESSIE32 JESSIE64 @@ -224,6 +246,7 @@ BULLSEYE32 BULLSEYE64 BOOKWORM32 BOOKWORM64 TRIXIE32 TRIXIE64 + FORKY32 FORKY64 SID32 SID64 " } @@ -233,14 +256,14 @@ cat < /proc/sys/kernel/printk -#kernelmodules= -# here, you can load modules depending on the kernel version -case $(uname -r) in - 2.6*) kernelmodules="$kernelmodules mptspi dm-mod md-mod aes dm-crypt" ;; - [3456]*) kernelmodules="$kernelmodules mptspi dm-mod md-mod aes dm-crypt" ;; -esac +# 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 diff -Nru fai-5.10.3/examples/simple/class/40-parse-profiles.sh fai-6.0.3+deb12u1/examples/simple/class/40-parse-profiles.sh --- fai-5.10.3/examples/simple/class/40-parse-profiles.sh 2020-06-26 09:44:21.000000000 +0000 +++ fai-6.0.3+deb12u1/examples/simple/class/40-parse-profiles.sh 2022-10-28 18:49:28.000000000 +0000 @@ -2,7 +2,7 @@ # parse *.profile and build a curses menu, so the user can select a profile # -# (c) 2015 by Thomas Lange, lange@informatik.uni-koeln.de +# (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 @@ -81,7 +81,7 @@ arclasses[$name]="$classes" continue fi - + if [[ $line =~ "Long: " ]]; then lflag=1 long=${line##Long: } @@ -115,7 +115,7 @@ } -# read all files with name matching *.profile +# read all files with name matching *.profile _parsed=0 shopt -s nullglob for _f in *.profile; do diff -Nru fai-5.10.3/examples/simple/class/50-host-classes fai-6.0.3+deb12u1/examples/simple/class/50-host-classes --- fai-5.10.3/examples/simple/class/50-host-classes 2020-06-26 09:43:42.000000000 +0000 +++ fai-6.0.3+deb12u1/examples/simple/class/50-host-classes 2022-05-29 08:47:00.000000000 +0000 @@ -16,16 +16,10 @@ gnomehost) echo "FAIBASE DEBIAN DEMO XORG GNOME";; ubuntuhost) - echo "FAIBASE DEBIAN DEMO UBUNTU FOCAL FOCAL64 XORG";; - centos) - echo "FAIBASE CENTOS" # you may want to add class XORG here - ifclass AMD64 && echo CENTOS8_64 - ;; - slchost) - # Scientific Linux Cern, is very similar to CentOS. SLC should alsways use the class CENTOS - echo "FAIBASE CENTOS SLC" # you may want to add class XORG here - ifclass I386 && echo SLC7_32 - ifclass AMD64 && echo SLC7_64 + 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" ;; diff -Nru fai-5.10.3/examples/simple/class/60-misc fai-6.0.3+deb12u1/examples/simple/class/60-misc --- fai-5.10.3/examples/simple/class/60-misc 2019-11-08 10:05:15.000000000 +0000 +++ fai-6.0.3+deb12u1/examples/simple/class/60-misc 2023-05-25 16:11:51.000000000 +0000 @@ -1,7 +1,5 @@ #! /bin/bash -ifclass -o CENTOS SLC && exit 0 - ifclass -o GRUB_PC GRUB_EFI && exit 0 if [ -d /sys/firmware/efi ]; then diff -Nru fai-5.10.3/examples/simple/class/85-efi-classes fai-6.0.3+deb12u1/examples/simple/class/85-efi-classes --- fai-5.10.3/examples/simple/class/85-efi-classes 2021-05-22 15:47:19.000000000 +0000 +++ fai-6.0.3+deb12u1/examples/simple/class/85-efi-classes 2022-10-31 17:55:31.000000000 +0000 @@ -2,11 +2,11 @@ # define classes for disk_config in an EFI enironment -if [ ! -d /sys/firmware/efi ]; then +if [ ! -d /sys/firmware/efi ] || ifclass GRUB_PC; then exit 0 fi -for c in LVM FAISERVER FAIBASE; do +for c in CLOUD LVM FAISERVER FAIBASE; do if ifclass $c; then echo ${c}_EFI break diff -Nru fai-5.10.3/examples/simple/class/CENTOS.var fai-6.0.3+deb12u1/examples/simple/class/CENTOS.var --- fai-5.10.3/examples/simple/class/CENTOS.var 2018-03-10 20:02:12.000000000 +0000 +++ fai-6.0.3+deb12u1/examples/simple/class/CENTOS.var 1970-01-01 00:00:00.000000000 +0000 @@ -1,9 +0,0 @@ -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" diff -Nru fai-5.10.3/examples/simple/class/DEBIAN.var fai-6.0.3+deb12u1/examples/simple/class/DEBIAN.var --- fai-5.10.3/examples/simple/class/DEBIAN.var 2021-04-14 15:39:59.000000000 +0000 +++ fai-6.0.3+deb12u1/examples/simple/class/DEBIAN.var 2023-05-25 16:11:51.000000000 +0000 @@ -1,4 +1,4 @@ -release=bullseye +release=bookworm apt_cdn=http://deb.debian.org security_cdn=http://security.debian.org @@ -24,3 +24,24 @@ # if you want to use the faiserver as APT proxy #APTPROXY=http://faiserver:3142 + + +# The linux-image package has different names for Debian and Ubuntu +if ifclass UBUNTU; then + kernelname=linux-image-generic +elif ifclass I386; then + kernelname=linux-image-686-pae +elif ifclass AMD64; then + kernelname=linux-image-amd64 +fi + +if [ -z "kernelname" ]; then + _arch=$(dpkg --print-architecture 2>/dev/null) + case $_arch in + i386) + kernelname=linux-image-686-pae ;; + *) + kernelname=linux-image-$_arch + esac + unset _arch +fi diff -Nru fai-5.10.3/examples/simple/class/FAIBASE.var fai-6.0.3+deb12u1/examples/simple/class/FAIBASE.var --- fai-5.10.3/examples/simple/class/FAIBASE.var 2019-11-08 10:05:15.000000000 +0000 +++ fai-6.0.3+deb12u1/examples/simple/class/FAIBASE.var 2023-05-25 16:11:51.000000000 +0000 @@ -17,6 +17,13 @@ # 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="bookworm http://deb.debian.org/debian" diff -Nru fai-5.10.3/examples/simple/class/ROCKY.var fai-6.0.3+deb12u1/examples/simple/class/ROCKY.var --- fai-5.10.3/examples/simple/class/ROCKY.var 1970-01-01 00:00:00.000000000 +0000 +++ fai-6.0.3+deb12u1/examples/simple/class/ROCKY.var 2018-03-10 20:02:12.000000000 +0000 @@ -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" diff -Nru fai-5.10.3/examples/simple/class/UBUNTU.var fai-6.0.3+deb12u1/examples/simple/class/UBUNTU.var --- fai-5.10.3/examples/simple/class/UBUNTU.var 2020-06-26 09:43:42.000000000 +0000 +++ fai-6.0.3+deb12u1/examples/simple/class/UBUNTU.var 2022-05-28 15:25:43.000000000 +0000 @@ -1,2 +1,2 @@ ubuntumirror=http://archive.ubuntu.com -ubuntudist=focal +ubuntudist=jammy diff -Nru fai-5.10.3/examples/simple/class/example.profile fai-6.0.3+deb12u1/examples/simple/class/example.profile --- fai-5.10.3/examples/simple/class/example.profile 2021-03-12 19:28:29.000000000 +0000 +++ fai-6.0.3+deb12u1/examples/simple/class/example.profile 2023-05-25 16:11:51.000000000 +0000 @@ -25,21 +25,21 @@ 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. +Name: Rocky Linux +Description: Rocky Linux 9 with Xfce desktop +Short: A normal Xfce desktop, running Rocky Linux 9 +Long: We use the Debian nfsroot for installing the Rocky Linux 9 OS. You should have a fast network connection, because most packages are downloaded from the internet. -Classes: INSTALL FAIBASE CENTOS CENTOS8_64 XORG +Classes: INSTALL FAIBASE ROCKY ROCKY9_64 XORG Name: Ubuntu -Description: Ubuntu 20.04 LTS desktop installation +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 FOCAL FOCAL64 XORG +Classes: INSTALL FAIBASE DEMO DEBIAN UBUNTU JAMMY JAMMY64 XORG Name: Inventory Description: Show hardware info diff -Nru fai-5.10.3/examples/simple/disk_config/CENTOS fai-6.0.3+deb12u1/examples/simple/disk_config/CENTOS --- fai-5.10.3/examples/simple/disk_config/CENTOS 2020-06-26 09:43:42.000000000 +0000 +++ fai-6.0.3+deb12u1/examples/simple/disk_config/CENTOS 1970-01-01 00:00:00.000000000 +0000 @@ -1,16 +0,0 @@ -# example of new config file for setup-storage -# -# - -disk_config disk1 disklabel:msdos bootable:1 fstabkey:label - -# Note that the CentOS 5 version of GRUB cannot read from ext3 filesystems with inode_size > 128 -# CentOS 5.6 needs /boot as ext3, so we use ext3 for / - -#primary / 350 ext3 rw,noatime,errors=remount-ro createopts="-L ROOT -I 128" - -# use following line for CentOS 7 -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" diff -Nru fai-5.10.3/examples/simple/disk_config/CLOUD_EFI fai-6.0.3+deb12u1/examples/simple/disk_config/CLOUD_EFI --- fai-5.10.3/examples/simple/disk_config/CLOUD_EFI 1970-01-01 00:00:00.000000000 +0000 +++ fai-6.0.3+deb12u1/examples/simple/disk_config/CLOUD_EFI 2023-05-25 16:11:51.000000000 +0000 @@ -0,0 +1,8 @@ +# config for a disk image for a VM +# +# p= + +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" diff -Nru fai-5.10.3/examples/simple/disk_config/FAIBASE fai-6.0.3+deb12u1/examples/simple/disk_config/FAIBASE --- fai-5.10.3/examples/simple/disk_config/FAIBASE 2019-03-26 15:32:51.000000000 +0000 +++ fai-6.0.3+deb12u1/examples/simple/disk_config/FAIBASE 2023-05-25 16:11:51.000000000 +0000 @@ -2,6 +2,9 @@ # # +# you may want to add "-O ^metadata_csum_seed" to createopts if the target +# system is older than bullseye. See #866603, #1031415, #1031416 for more info. + disk_config disk1 disklabel:msdos bootable:1 fstabkey:uuid primary / 2G-50G ext4 rw,noatime,errors=remount-ro diff -Nru fai-5.10.3/examples/simple/disk_config/FAIBASE_EFI fai-6.0.3+deb12u1/examples/simple/disk_config/FAIBASE_EFI --- fai-5.10.3/examples/simple/disk_config/FAIBASE_EFI 2020-06-26 09:43:42.000000000 +0000 +++ fai-6.0.3+deb12u1/examples/simple/disk_config/FAIBASE_EFI 2023-05-25 16:11:51.000000000 +0000 @@ -1,10 +1,13 @@ # example of new config file for setup-storage # -# +# p= + +# you may want to add "-O ^metadata_csum_seed" to createopts if the target +# system is older than bullseye. See #866603, #1031415, #1031416 for more info. disk_config disk1 disklabel:gpt bootable:1 fstabkey:uuid -primary /boot/efi 512M vfat rw -primary / 2G-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" +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" diff -Nru fai-5.10.3/examples/simple/disk_config/FAISERVER_EFI fai-6.0.3+deb12u1/examples/simple/disk_config/FAISERVER_EFI --- fai-5.10.3/examples/simple/disk_config/FAISERVER_EFI 2020-06-26 09:43:42.000000000 +0000 +++ fai-6.0.3+deb12u1/examples/simple/disk_config/FAISERVER_EFI 2023-05-25 16:11:51.000000000 +0000 @@ -1,12 +1,12 @@ # config file for an FAI install server # -# +# p= disk_config disk1 disklabel:gpt fstabkey:uuid -primary /boot/efi 512M vfat rw -primary / 2G-15G ext4 rw,noatime,errors=remount-ro -primary swap 200-1000 swap sw -primary /tmp 100-1000 ext4 rw,noatime,nosuid,nodev createopts="-m 0" tuneopts="-c 0 -i 0" -primary /home 100-40% ext4 rw,noatime,nosuid,nodev createopts="-m 1" tuneopts="-c 0 -i 0" -primary /srv 1G-50% ext4 rw,noatime createopts="-m 1" tuneopts="-c 0 -i 0" +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" diff -Nru fai-5.10.3/examples/simple/disk_config/LVM fai-6.0.3+deb12u1/examples/simple/disk_config/LVM --- fai-5.10.3/examples/simple/disk_config/LVM 2019-03-26 15:32:51.000000000 +0000 +++ fai-6.0.3+deb12u1/examples/simple/disk_config/LVM 2023-05-25 16:11:51.000000000 +0000 @@ -4,8 +4,8 @@ disk_config disk1 fstabkey:uuid align-at:1M -primary /boot 200 ext2 rw,noatime -primary - 4G- - - +primary /boot 200 ext4 rw,noatime +primary - 4G- - - disk_config lvm diff -Nru fai-5.10.3/examples/simple/disk_config/LVM_EFI fai-6.0.3+deb12u1/examples/simple/disk_config/LVM_EFI --- fai-5.10.3/examples/simple/disk_config/LVM_EFI 2020-06-26 09:43:42.000000000 +0000 +++ fai-6.0.3+deb12u1/examples/simple/disk_config/LVM_EFI 2023-05-25 16:11:51.000000000 +0000 @@ -1,12 +1,12 @@ -# +# p= # entire disk with LVM, separate /home disk_config disk1 disklabel:gpt fstabkey:uuid align-at:1M -primary /boot/efi 512M vfat rw -primary /boot 200 ext2 rw,noatime -primary - 4G- - - +p=efi /boot/efi 512M vfat rw +p=boot /boot 200 ext4 rw,noatime +p=system - 4G- - - disk_config lvm diff -Nru fai-5.10.3/examples/simple/disk_config/ROCKY fai-6.0.3+deb12u1/examples/simple/disk_config/ROCKY --- fai-5.10.3/examples/simple/disk_config/ROCKY 1970-01-01 00:00:00.000000000 +0000 +++ fai-6.0.3+deb12u1/examples/simple/disk_config/ROCKY 2023-05-25 16:11:51.000000000 +0000 @@ -0,0 +1,13 @@ +# example of new config file for setup-storage +# +# + +# you may want to add "-O ^metadata_csum_seed" to createopts if the target +# system is older than bullseye. See #866603, #1031415, #1031416 for more info. + +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" diff -Nru fai-5.10.3/examples/simple/files/etc/fai/nfsroot.conf/FAISERVER fai-6.0.3+deb12u1/examples/simple/files/etc/fai/nfsroot.conf/FAISERVER --- fai-5.10.3/examples/simple/files/etc/fai/nfsroot.conf/FAISERVER 2021-04-14 15:39:59.000000000 +0000 +++ fai-6.0.3+deb12u1/examples/simple/files/etc/fai/nfsroot.conf/FAISERVER 2023-05-25 16:11:51.000000000 +0000 @@ -1,7 +1,7 @@ # For a detailed description see nfsroot.conf(5) # " " for debootstrap -FAI_DEBOOTSTRAP="bullseye http://deb.debian.org/debian" +FAI_DEBOOTSTRAP="bookworm http://deb.debian.org/debian" FAI_ROOTPW='$1$kBnWcO.E$djxB128U7dMkrltJHPf6d1' NFSROOT=/srv/fai/nfsroot diff -Nru fai-5.10.3/examples/simple/files/etc/rc.local/FAISERVER fai-6.0.3+deb12u1/examples/simple/files/etc/rc.local/FAISERVER --- fai-5.10.3/examples/simple/files/etc/rc.local/FAISERVER 2021-04-14 15:39:59.000000000 +0000 +++ fai-6.0.3+deb12u1/examples/simple/files/etc/rc.local/FAISERVER 2023-05-25 16:11:51.000000000 +0000 @@ -25,7 +25,7 @@ echo "=================================" echo "Setting up the FAI install server" echo "This will take a few minutes" -echo "=================================" +echo "=================================" . /etc/fai/fai.conf . /etc/fai/nfsroot.conf @@ -57,9 +57,9 @@ if [ $? -eq 0 ]; then rm /var/tmp/base.tar.xz echo "" - echo "================================================" + echo "================================================" echo -e "Setting up the FAI server was ${GREEN}successful${NORMAL}" - echo "================================================" + echo "================================================" echo "" sleep 10 else @@ -83,7 +83,7 @@ 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 +fai-chboot -Iv -f verbose,sshd,createvt,menu -u nfs://faiserver/srv/fai/config bookworm.tmpl # Since we do not know the MAC address, our DHCP cannot provide the hostname. # Therefore we do explicitly set the hostname diff -Nru fai-5.10.3/examples/simple/files/etc/selinux/config/CENTOS fai-6.0.3+deb12u1/examples/simple/files/etc/selinux/config/CENTOS --- fai-5.10.3/examples/simple/files/etc/selinux/config/CENTOS 2018-03-10 20:02:12.000000000 +0000 +++ fai-6.0.3+deb12u1/examples/simple/files/etc/selinux/config/CENTOS 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ -# 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 diff -Nru fai-5.10.3/examples/simple/files/etc/selinux/config/ROCKY fai-6.0.3+deb12u1/examples/simple/files/etc/selinux/config/ROCKY --- fai-5.10.3/examples/simple/files/etc/selinux/config/ROCKY 1970-01-01 00:00:00.000000000 +0000 +++ fai-6.0.3+deb12u1/examples/simple/files/etc/selinux/config/ROCKY 2018-03-10 20:02:12.000000000 +0000 @@ -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 diff -Nru fai-5.10.3/examples/simple/hooks/debconf.CENTOS fai-6.0.3+deb12u1/examples/simple/hooks/debconf.CENTOS --- fai-5.10.3/examples/simple/hooks/debconf.CENTOS 2018-03-10 20:02:12.000000000 +0000 +++ fai-6.0.3+deb12u1/examples/simple/hooks/debconf.CENTOS 1970-01-01 00:00:00.000000000 +0000 @@ -1,3 +0,0 @@ -#! /bin/bash - -skiptask debconf diff -Nru fai-5.10.3/examples/simple/hooks/debconf.IMAGE fai-6.0.3+deb12u1/examples/simple/hooks/debconf.IMAGE --- fai-5.10.3/examples/simple/hooks/debconf.IMAGE 2019-03-26 15:32:51.000000000 +0000 +++ fai-6.0.3+deb12u1/examples/simple/hooks/debconf.IMAGE 2022-10-28 18:49:28.000000000 +0000 @@ -3,7 +3,7 @@ # hook for installing a file system image (tar file) # this works for Ubuntu 14.04 # -# Copyright (C) 2015 Thomas Lange, lange@informatik.uni-koeln.de +# 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 @@ -31,8 +31,8 @@ fi if [ -f $target/etc/centos-release ]; then rm $target/etc/grub2/device.map - $FAI/scripts/CENTOS/40-install-grub - $FAI/scripts/CENTOS/30-mkinitrd + $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 diff -Nru fai-5.10.3/examples/simple/hooks/debconf.ROCKY fai-6.0.3+deb12u1/examples/simple/hooks/debconf.ROCKY --- fai-5.10.3/examples/simple/hooks/debconf.ROCKY 1970-01-01 00:00:00.000000000 +0000 +++ fai-6.0.3+deb12u1/examples/simple/hooks/debconf.ROCKY 2018-03-10 20:02:12.000000000 +0000 @@ -0,0 +1,3 @@ +#! /bin/bash + +skiptask debconf diff -Nru fai-5.10.3/examples/simple/hooks/repository.CENTOS fai-6.0.3+deb12u1/examples/simple/hooks/repository.CENTOS --- fai-5.10.3/examples/simple/hooks/repository.CENTOS 2018-03-10 20:02:12.000000000 +0000 +++ fai-6.0.3+deb12u1/examples/simple/hooks/repository.CENTOS 1970-01-01 00:00:00.000000000 +0000 @@ -1,31 +0,0 @@ -#! /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 -#sed -i -e 's/enabled=1/enabled=0/' $target/etc/yum/pluginconf.d/fastestmirror.conf - -skiptask repository - -exit $error diff -Nru fai-5.10.3/examples/simple/hooks/repository.ROCKY fai-6.0.3+deb12u1/examples/simple/hooks/repository.ROCKY --- fai-5.10.3/examples/simple/hooks/repository.ROCKY 1970-01-01 00:00:00.000000000 +0000 +++ fai-6.0.3+deb12u1/examples/simple/hooks/repository.ROCKY 2022-10-06 17:20:03.000000000 +0000 @@ -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 diff -Nru fai-5.10.3/examples/simple/hooks/savelog.LAST.sh fai-6.0.3+deb12u1/examples/simple/hooks/savelog.LAST.sh --- fai-5.10.3/examples/simple/hooks/savelog.LAST.sh 2021-03-13 19:23:50.000000000 +0000 +++ fai-6.0.3+deb12u1/examples/simple/hooks/savelog.LAST.sh 2023-05-25 16:11:51.000000000 +0000 @@ -182,6 +182,7 @@ data block query control method not found subprocess.py.\+RuntimeWarning: line buffering Resource conflict.\+ found +os-prober will not be executed update-rc.d: warning: start and stop actions are no longer supported" # add pattern on some conditions @@ -219,4 +220,5 @@ 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 diff -Nru fai-5.10.3/examples/simple/hooks/updatebase.CENTOS fai-6.0.3+deb12u1/examples/simple/hooks/updatebase.CENTOS --- fai-5.10.3/examples/simple/hooks/updatebase.CENTOS 2020-06-26 09:43:42.000000000 +0000 +++ fai-6.0.3+deb12u1/examples/simple/hooks/updatebase.CENTOS 1970-01-01 00:00:00.000000000 +0000 @@ -1,25 +0,0 @@ -#! /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 < $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 diff -Nru fai-5.10.3/examples/simple/hooks/updatebase.ROCKY fai-6.0.3+deb12u1/examples/simple/hooks/updatebase.ROCKY --- fai-5.10.3/examples/simple/hooks/updatebase.ROCKY 1970-01-01 00:00:00.000000000 +0000 +++ fai-6.0.3+deb12u1/examples/simple/hooks/updatebase.ROCKY 2020-06-26 09:43:42.000000000 +0000 @@ -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 <$error?$?:$error))' ERR # save maximum error code - -$ROOTCMD usermod -p $ROOTPW root - -fcopy -v /etc/selinux/config -$ROOTCMD fixfiles onboot # this fixes the SELinux security contexts during the first boot -chmod a+rx $target - -exit $error diff -Nru fai-5.10.3/examples/simple/scripts/CENTOS/30-mkinitrd fai-6.0.3+deb12u1/examples/simple/scripts/CENTOS/30-mkinitrd --- fai-5.10.3/examples/simple/scripts/CENTOS/30-mkinitrd 2020-06-26 09:44:21.000000000 +0000 +++ fai-6.0.3+deb12u1/examples/simple/scripts/CENTOS/30-mkinitrd 1970-01-01 00:00:00.000000000 +0000 @@ -1,25 +0,0 @@ -#! /bin/bash - -# (c) Michael Goetze, 2010-2011, mgoetze@mgoetze.net -# (c) Thomas Lange, 2011, Uni Koeln - -error=0; trap 'error=$(($?>$error?$?:$error))' ERR # save maximum error code - -ainsl -v /etc/fstab "proc /proc proc defaults 0 0" -ainsl -v /etc/fstab "sysfs /sys sysfs auto 0 0" - -version=$($ROOTCMD rpm -qv kernel | cut -d- -f2-) - - -if [ -f $target/etc/lvm/lvm.conf ]; then - sed -i -e 's/use_lvmetad = 1/use_lvmetad = 0/' $target/etc/lvm/lvm.conf - ainsl -av /etc/dracut.conf.d/fai.conf 'add_dracutmodules+=" lvm "' -fi - - -# add filesystem driver into initrd -ainsl -av /etc/dracut.conf.d/fai.conf 'filesystems+="ext4"' -$ROOTCMD dracut -v --kver $version --force - - -exit $error diff -Nru fai-5.10.3/examples/simple/scripts/CENTOS/40-install-grub fai-6.0.3+deb12u1/examples/simple/scripts/CENTOS/40-install-grub --- fai-5.10.3/examples/simple/scripts/CENTOS/40-install-grub 2020-06-26 09:44:21.000000000 +0000 +++ fai-6.0.3+deb12u1/examples/simple/scripts/CENTOS/40-install-grub 1970-01-01 00:00:00.000000000 +0000 @@ -1,96 +0,0 @@ -#! /bin/bash - -# (c) Michael Goetze, 2011, mgoetze@mgoetze.net -# (c) Thomas Lange 2014 - -error=0; trap 'error=$(($?>$error?$?:$error))' ERR # save maximum error code - -if [ -r $LOGDIR/disk_var.sh ] ; then - . $LOGDIR/disk_var.sh -else - echo "disk_var.sh not found!" - exit 1 -fi - - -# CentOS 7 does not have a device.map file, so generate one -if [ -d $target/boot/grub2 -a ! -f $target/boot/grub2/device.map ]; then - echo "# Generated by FAI" >> $target/boot/grub2/device.map - centosdisks=$(awk '/[sv]d.$/ {print $4}' /proc/partitions | sort) - dcount=0 - for d in $centosdisks; do - echo "(hd$dcount) /dev/$d" >> $target/boot/grub2/device.map - dcount=$((dcount + 1)) - done -fi - -bootdev=$(device2grub $BOOT_DEVICE) -bootpart=$(device2grub $BOOT_PARTITION) -version=$($ROOTCMD rpm -qv kernel | cut -d- -f2-) - -if grep '[[:space:]]/boot[[:space:]]' $LOGDIR/fstab; then - bootdir='' -else - bootdir='/boot' -fi - -mount -o bind /dev $target/dev - - - -if [ -f $target/usr/sbin/grub2-install ]; then - - # CentOS 7 - $ROOTCMD grub2-install --no-floppy "$BOOT_DEVICE" - $ROOTCMD grub2-mkconfig --output=/boot/grub2/grub.cfg -else - -$ROOTCMD grub-install --just-copy - -$ROOTCMD grub --device-map=/dev/null --no-floppy --batch <<-EOF - device $bootdev $BOOT_DEVICE - root $bootpart - setup $bootdev - quit - EOF - -ln -s ./menu.lst $target/boot/grub/grub.conf - -if [ -f $target/boot/grub/splash.xpm.gz ]; then - pretty="splashimage=$bootpart$bootdir/grub/splash.xpm.gz" -else - pretty="color cyan/blue white/blue" -fi - -if [ -f $target/sbin/dracut -o -f $target/usr/sbin/dracut ]; then - # CentOS 6 - iname=initramfs -else - # CentOS 5 - iname=initrd -fi -title=$(head -1 $target/etc/redhat-release) - -cat > $target/boot/grub/grub.conf <<-EOF - timeout 5 - default 0 - $pretty - hiddenmenu - - title $title - root $bootpart - kernel $bootdir/vmlinuz-$version root=$ROOT_PARTITION ro - initrd $bootdir/$iname-$version.img - EOF - -fi - -umount $target/dev - -echo "" -echo "Grub installed on $BOOT_DEVICE = $bootdev" -echo "Grub boot partition is $BOOT_PARTITION = $bootpart" -echo "Root partition is $ROOT_PARTITION" -echo "Boot kernel: $version" - -exit $error diff -Nru fai-5.10.3/examples/simple/scripts/CENTOS/50-sysconfig fai-6.0.3+deb12u1/examples/simple/scripts/CENTOS/50-sysconfig --- fai-5.10.3/examples/simple/scripts/CENTOS/50-sysconfig 2018-03-10 20:02:12.000000000 +0000 +++ fai-6.0.3+deb12u1/examples/simple/scripts/CENTOS/50-sysconfig 1970-01-01 00:00:00.000000000 +0000 @@ -1,29 +0,0 @@ -#! /bin/bash - -# (c) Michael Goetze, 2011, mgoetze@mgoetze.net - -error=0 ; trap "error=$((error|1))" ERR - -cat > $target/etc/sysconfig/clock <<-EOF - UTC=$UTC - ZONE=$TIMEZONE - EOF -cat > $target/etc/sysconfig/i18n <<-EOF - LANG="$DEFAULTLOCALE" - SUPPORTED="$SUPPORTEDLOCALE" - SYSFONT="$CONSOLEFONT" - EOF -cat > $target/etc/sysconfig/keyboard <<-EOF - KEYBOARDTYPE="pc" - KEYTABLE="$KEYMAP" - EOF - -if [ -f $target/usr/lib/locale/locale-archive.tmpl \ - -a ! -s $target/usr/lib/locale/locale-archive ]; then - mv $target/usr/lib/locale/locale-archive.tmpl $target/usr/lib/locale/locale-archive -fi - -fcopy -iv /etc/sysconfig/i18n /etc/sysconfig/keyboard - -exit $error - diff -Nru fai-5.10.3/examples/simple/scripts/CENTOS/60-network-scripts fai-6.0.3+deb12u1/examples/simple/scripts/CENTOS/60-network-scripts --- fai-5.10.3/examples/simple/scripts/CENTOS/60-network-scripts 2020-06-26 09:43:42.000000000 +0000 +++ fai-6.0.3+deb12u1/examples/simple/scripts/CENTOS/60-network-scripts 1970-01-01 00:00:00.000000000 +0000 @@ -1,40 +0,0 @@ -#! /bin/bash - -error=0 ; trap "error=$((error|1))" ERR - - -# determine predictable network names -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 [ $FAI_ACTION != "softupdate" ] && ifclass DHCPC; then - cat > $target/etc/sysconfig/network-scripts/ifcfg-$NIC1 <<-EOF - # generated by FAI - TYPE=Ethernet - PROXY_METHOD=none - BOOTPROTO=dhcp - DEFROUTE=yes - BROWSER_ONLY=no - IP4_FAILURE_FATAL=no - IPV6INIT=no - IPV6_AUTOCONF=no - NAME=$NIC1 - DEVICE=$NIC1 - ONBOOT=yes - EOF -fi - -fcopy -iv /etc/sysconfig/network /etc/resolv.conf /etc/networks -fcopy -ivr /etc/sysconfig/network-scripts - -exit $error diff -Nru fai-5.10.3/examples/simple/scripts/CENTOS/80-misc fai-6.0.3+deb12u1/examples/simple/scripts/CENTOS/80-misc --- fai-5.10.3/examples/simple/scripts/CENTOS/80-misc 2019-03-26 15:32:51.000000000 +0000 +++ fai-6.0.3+deb12u1/examples/simple/scripts/CENTOS/80-misc 1970-01-01 00:00:00.000000000 +0000 @@ -1,21 +0,0 @@ -#! /bin/bash - -error=0 ; trap "error=$((error|1))" ERR - -# add a $username user account -if [ -n "$username" ]; then - if ! $ROOTCMD getent passwd $username ; then - $ROOTCMD adduser -c "$username user" $username - $ROOTCMD usermod -p "$USERPW" $username - fi -fi - -# enable graphical login screen, make run level 5 as default -if [ -f $target/usr/sbin/gdm ]; then - sed -i -e 's/id:3:initdefault:/id:5:initdefault:/' $target/etc/inittab - # do not run this tool - echo "RUN_FIRSTBOOT=NO" > $target/etc/sysconfig/firstboot -fi - -exit $error - diff -Nru fai-5.10.3/examples/simple/scripts/CENTOS/90-cleanup fai-6.0.3+deb12u1/examples/simple/scripts/CENTOS/90-cleanup --- fai-5.10.3/examples/simple/scripts/CENTOS/90-cleanup 2018-03-10 20:02:12.000000000 +0000 +++ fai-6.0.3+deb12u1/examples/simple/scripts/CENTOS/90-cleanup 1970-01-01 00:00:00.000000000 +0000 @@ -1,3 +0,0 @@ -#! /bin/bash - -$ROOTCMD yum clean all diff -Nru fai-5.10.3/examples/simple/scripts/CLOUD/99-cleanup fai-6.0.3+deb12u1/examples/simple/scripts/CLOUD/99-cleanup --- fai-5.10.3/examples/simple/scripts/CLOUD/99-cleanup 2018-03-10 20:02:12.000000000 +0000 +++ fai-6.0.3+deb12u1/examples/simple/scripts/CLOUD/99-cleanup 2023-06-24 11:02:26.000000000 +0000 @@ -1,11 +1,6 @@ #! /bin/bash -fcopy /etc/init.d/expand-root -if [ -f $target/files/etc/init.d/expand-root ]; then - $ROOTCMD insserv --default expand-root -fi - -sed -i "s/PermitRootLogin yes/PermitRootLogin without-password/" $target/etc/ssh/sshd_config +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' @@ -23,5 +18,5 @@ # FIXME: DHCP RFC3442 is used incorrect in Azure if [ -f $target/etc/dhcp/dhclient.conf ]; then - sed -ie 's,rfc3442-classless-static-routes,disabled-\0,' $target/etc/dhcp/dhclient.conf + fai-sed 's,rfc3442-classless-static-routes,disabled-\0,' /etc/dhcp/dhclient.conf fi diff -Nru fai-5.10.3/examples/simple/scripts/DEBIAN/30-interface fai-6.0.3+deb12u1/examples/simple/scripts/DEBIAN/30-interface --- fai-5.10.3/examples/simple/scripts/DEBIAN/30-interface 2021-03-03 01:05:17.000000000 +0000 +++ fai-6.0.3+deb12u1/examples/simple/scripts/DEBIAN/30-interface 2022-10-28 18:14:14.000000000 +0000 @@ -46,7 +46,6 @@ newnicnames() { - # determine predictable network names only for stretch and above local name [ $do_init_tasks -eq 0 ] && return diff -Nru fai-5.10.3/examples/simple/scripts/DEBIAN/40-misc fai-6.0.3+deb12u1/examples/simple/scripts/DEBIAN/40-misc --- fai-5.10.3/examples/simple/scripts/DEBIAN/40-misc 2020-06-26 09:43:42.000000000 +0000 +++ fai-6.0.3+deb12u1/examples/simple/scripts/DEBIAN/40-misc 2023-05-25 16:11:51.000000000 +0000 @@ -16,16 +16,16 @@ 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 + fai-sed 's:^LOCAL$:UTC:' /etc/adjtime else - sed -i -e 's:^UTC$:LOCAL:' $target/etc/adjtime + fai-sed 's:^UTC$:LOCAL:' /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 + fai-sed 's#/sbin/getty 38400#/sbin/getty -f /etc/issue.linuxlogo 38400#' /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 + 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 @@ -37,9 +37,9 @@ $ROOTCMD systemd-machine-id-setup fi -ln -fs /proc/mounts $target/etc/mtab +fai-link /etc/mtab ../proc/self/mounts -rm -f $target/etc/dpkg/dpkg.cfg.d/fai $target/etc/dpkg/dpkg.cfg.d/unsafe-io +rm -f $target/etc/dpkg/dpkg.cfg.d/unsafe-io if [ -d /etc/fai ]; then if ! fcopy -Mv /etc/fai/fai.conf; then diff -Nru fai-5.10.3/examples/simple/scripts/DEMO/10-misc fai-6.0.3+deb12u1/examples/simple/scripts/DEMO/10-misc --- fai-5.10.3/examples/simple/scripts/DEMO/10-misc 2019-11-08 10:05:15.000000000 +0000 +++ fai-6.0.3+deb12u1/examples/simple/scripts/DEMO/10-misc 2023-05-25 16:11:51.000000000 +0000 @@ -17,7 +17,7 @@ # add additional user account if [ -n "$username" ]; then if ! $ROOTCMD getent passwd $username ; then - $ROOTCMD adduser --disabled-login --gecos "$username user" $username + $ROOTCMD adduser --disabled-password --gecos "$username user" $username $ROOTCMD usermod -p "$USERPW" $username userdir=$($ROOTCMD getent passwd "$username" | cut -d: -f6 ) @@ -28,7 +28,7 @@ $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 + $ROOTCMD chown -R $username:$username $userdir/.config fi fi diff -Nru fai-5.10.3/examples/simple/scripts/FAIBASE/10-misc fai-6.0.3+deb12u1/examples/simple/scripts/FAIBASE/10-misc --- fai-5.10.3/examples/simple/scripts/FAIBASE/10-misc 2020-06-26 09:43:42.000000000 +0000 +++ fai-6.0.3+deb12u1/examples/simple/scripts/FAIBASE/10-misc 2022-10-06 17:28:59.000000000 +0000 @@ -6,7 +6,7 @@ echo $TIMEZONE > $target/etc/timezone if [ -L $target/etc/localtime ]; then - ln -sf /usr/share/zoneinfo/${TIMEZONE} $target/etc/localtime + fai-link /etc/localtime /usr/share/zoneinfo/${TIMEZONE} else cp -f /usr/share/zoneinfo/${TIMEZONE} $target/etc/localtime fi diff -Nru fai-5.10.3/examples/simple/scripts/FAIBASE/15-root-ssh-key fai-6.0.3+deb12u1/examples/simple/scripts/FAIBASE/15-root-ssh-key --- fai-5.10.3/examples/simple/scripts/FAIBASE/15-root-ssh-key 1970-01-01 00:00:00.000000000 +0000 +++ fai-6.0.3+deb12u1/examples/simple/scripts/FAIBASE/15-root-ssh-key 2023-05-25 16:11:51.000000000 +0000 @@ -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 diff -Nru fai-5.10.3/examples/simple/scripts/FAISERVER/10-conffiles fai-6.0.3+deb12u1/examples/simple/scripts/FAISERVER/10-conffiles --- fai-5.10.3/examples/simple/scripts/FAISERVER/10-conffiles 2021-03-12 16:58:02.000000000 +0000 +++ fai-6.0.3+deb12u1/examples/simple/scripts/FAISERVER/10-conffiles 2023-05-25 16:11:51.000000000 +0000 @@ -27,7 +27,7 @@ # 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 - sed -i -e '/# ReuseConnections: 1/d' $target/etc/apt-cacher-ng/acng.conf + 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 @@ -38,7 +38,7 @@ 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 + $ROOTCMD chown -R apt-cacher-ng:apt-cacher-ng /var/cache/apt-cacher-ng/_import fi # copy basefiles from CD to config space diff -Nru fai-5.10.3/examples/simple/scripts/GRUB_EFI/10-setup fai-6.0.3+deb12u1/examples/simple/scripts/GRUB_EFI/10-setup --- fai-5.10.3/examples/simple/scripts/GRUB_EFI/10-setup 2021-02-26 09:27:25.000000000 +0000 +++ fai-6.0.3+deb12u1/examples/simple/scripts/GRUB_EFI/10-setup 2023-05-25 16:11:51.000000000 +0000 @@ -11,6 +11,11 @@ # installation into the removable media paths as well as the standard # debian path. +# do only execute for Debian and similar distros +if ! ifclass DEBIAN ; then + exit 0 +fi + set -a # do not set up grub during dirinstall @@ -64,5 +69,10 @@ fi fi $ROOTCMD update-grub +if [[ $BOOT_DEVICE =~ '/dev/loop' ]]; then + : +else + efibootmgr -v +fi exit $error diff -Nru fai-5.10.3/examples/simple/scripts/GRUB_PC/10-setup fai-6.0.3+deb12u1/examples/simple/scripts/GRUB_PC/10-setup --- fai-5.10.3/examples/simple/scripts/GRUB_PC/10-setup 2021-05-22 15:49:43.000000000 +0000 +++ fai-6.0.3+deb12u1/examples/simple/scripts/GRUB_PC/10-setup 2023-05-25 16:11:51.000000000 +0000 @@ -3,6 +3,11 @@ error=0; trap 'error=$(($?>$error?$?:$error))' ERR # save maximum error code +# do only execute for Debian and similar distros +if ! ifclass DEBIAN ; then + exit 0 +fi + set -a # do not set up grub during dirinstall @@ -19,6 +24,11 @@ # disable os-prober because of #802717 ainsl /etc/default/grub 'GRUB_DISABLE_OS_PROBER=true' +# efivars may still be mounted from the host system during fai-diskimage +if [ -d $target/sys/firmware/efi/efivars ]; then + umount $target/sys/firmware/efi/efivars +fi + # skip the rest, if not an initial installation if [ $FAI_ACTION != "install" ]; then $ROOTCMD update-grub diff -Nru fai-5.10.3/examples/simple/scripts/LAST/50-misc fai-6.0.3+deb12u1/examples/simple/scripts/LAST/50-misc --- fai-5.10.3/examples/simple/scripts/LAST/50-misc 2021-02-04 13:53:54.000000000 +0000 +++ fai-6.0.3+deb12u1/examples/simple/scripts/LAST/50-misc 2023-06-24 11:02:26.000000000 +0000 @@ -4,6 +4,11 @@ error=0; trap 'error=$(($?>$error?$?:$error))' ERR # save maximum error code +# remove crypt password from format.log +if [ -f $LOGDIR/format.log ]; then + perl -i -pane "s/Executing: yes '.+?' \| cryptsetup/Executing: yes 'XXXXXXXXXXXXX' | cryptsetup/" $LOGDIR/format.log +fi + if [ "$FAI_ACTION" = "dirinstall" -o $do_init_tasks -eq 0 ] ; then : else @@ -15,6 +20,11 @@ fi fi + if [ -f $target/etc/crypttab ] && [ ! -f $target/sbin/cryptsetup ]; then + echo ERROR: Encrypted devices used, but the crypsetup package was not installed. + echo ERROR: You want to add cryptsetup-initramfs or dracut to some package_config file. + 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 @@ -72,7 +82,7 @@ return fi - dists="jessie stretch buster bullseye bookworm trixie focal bionic xenial trusty" + dists="jessie stretch buster bullseye bookworm trixie forky jammy focal bionic xenial trusty" for d in $dists; do if grep -iq $d $target/etc/os-release; then release=$d @@ -85,13 +95,17 @@ 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 < $target/etc/apt/sources.list -deb $apt_cdn/debian $release main contrib non-free -deb $security_cdn/debian-security ${secsuite} main contrib non-free +deb $apt_cdn/debian $release main contrib non-free non-free-firmware +deb $security_cdn/debian-security ${secsuite} main contrib non-free non-free-firmware #deb [trusted=yes] http://fai-project.org/download $release koeln EOF + # older releases do not have the non-free-firmware section + if [[ "buster bullseye" =~ "$release" ]]; then + sed -i -e 's/non-free-firmware//g' $target/etc/apt/sources.list + fi # 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 + if dpkg-query --admindir=$target/var/lib/dpkg -W fai-server >/dev/null 2>&1; then + fai-sed '/fai-project.org/s/^#//' /etc/apt/sources.list fi fi diff -Nru fai-5.10.3/examples/simple/scripts/ROCKY/10-security fai-6.0.3+deb12u1/examples/simple/scripts/ROCKY/10-security --- fai-5.10.3/examples/simple/scripts/ROCKY/10-security 1970-01-01 00:00:00.000000000 +0000 +++ fai-6.0.3+deb12u1/examples/simple/scripts/ROCKY/10-security 2020-06-26 09:43:42.000000000 +0000 @@ -0,0 +1,14 @@ +#! /bin/bash + +# (c) Michael Goetze, 2010-11, mgoetze@mgoetze.net +# Thomas Lange, 2015-2020 + +error=0; trap 'error=$(($?>$error?$?:$error))' ERR # save maximum error code + +$ROOTCMD usermod -p $ROOTPW root + +fcopy -v /etc/selinux/config +$ROOTCMD fixfiles onboot # this fixes the SELinux security contexts during the first boot +chmod a+rx $target + +exit $error diff -Nru fai-5.10.3/examples/simple/scripts/ROCKY/30-mkinitrd fai-6.0.3+deb12u1/examples/simple/scripts/ROCKY/30-mkinitrd --- fai-5.10.3/examples/simple/scripts/ROCKY/30-mkinitrd 1970-01-01 00:00:00.000000000 +0000 +++ fai-6.0.3+deb12u1/examples/simple/scripts/ROCKY/30-mkinitrd 2023-05-25 16:11:51.000000000 +0000 @@ -0,0 +1,25 @@ +#! /bin/bash + +# (c) Michael Goetze, 2010-2011, mgoetze@mgoetze.net +# (c) Thomas Lange, 2011, Uni Koeln + +error=0; trap 'error=$(($?>$error?$?:$error))' ERR # save maximum error code + +ainsl -v /etc/fstab "proc /proc proc defaults 0 0" +ainsl -v /etc/fstab "sysfs /sys sysfs auto 0 0" + +version=$($ROOTCMD rpm -qv kernel | cut -d- -f2-) + + +if [ -f $target/etc/lvm/lvm.conf ]; then + fai-sed 's/use_lvmetad = 1/use_lvmetad = 0/' /etc/lvm/lvm.conf + ainsl -av /etc/dracut.conf.d/fai.conf 'add_dracutmodules+=" lvm "' +fi + + +# add filesystem driver into initrd +ainsl -av /etc/dracut.conf.d/fai.conf 'filesystems+=" ext4 "' +$ROOTCMD dracut -v --kver $version --force + + +exit $error diff -Nru fai-5.10.3/examples/simple/scripts/ROCKY/40-install-grub fai-6.0.3+deb12u1/examples/simple/scripts/ROCKY/40-install-grub --- fai-5.10.3/examples/simple/scripts/ROCKY/40-install-grub 1970-01-01 00:00:00.000000000 +0000 +++ fai-6.0.3+deb12u1/examples/simple/scripts/ROCKY/40-install-grub 2022-05-29 08:05:03.000000000 +0000 @@ -0,0 +1,87 @@ +#! /bin/bash + +# (c) Michael Goetze, 2011, mgoetze@mgoetze.net +# (c) Thomas Lange 2014 + +error=0; trap 'error=$(($?>$error?$?:$error))' ERR # save maximum error code + +if [ -r $LOGDIR/disk_var.sh ] ; then + . $LOGDIR/disk_var.sh +else + echo "disk_var.sh not found!" + exit 1 +fi + + +# CentOS 7 does not have a device.map file, so generate one +if [ -d $target/boot/grub2 -a ! -f $target/boot/grub2/device.map ]; then + echo "# Generated by FAI" >> $target/boot/grub2/device.map + centosdisks=$(awk '/[sv]d.$/ {print $4}' /proc/partitions | sort) + dcount=0 + for d in $centosdisks; do + echo "(hd$dcount) /dev/$d" >> $target/boot/grub2/device.map + dcount=$((dcount + 1)) + done +fi + +bootdev=$(device2grub $BOOT_DEVICE) +bootpart=$(device2grub $BOOT_PARTITION) +version=$($ROOTCMD rpm -qv kernel | cut -d- -f2-) + +if grep '[[:space:]]/boot[[:space:]]' $LOGDIR/fstab; then + bootdir='' +else + bootdir='/boot' +fi + +mount -o bind /dev $target/dev + +if [ -f $target/usr/sbin/grub2-install ]; then + + # CentOS 7 + $ROOTCMD grub2-install --no-floppy "$BOOT_DEVICE" + $ROOTCMD grub2-mkconfig --output=/boot/grub2/grub.cfg +else + +$ROOTCMD grub-install --just-copy + +$ROOTCMD grub --device-map=/dev/null --no-floppy --batch <<-EOF + device $bootdev $BOOT_DEVICE + root $bootpart + setup $bootdev + quit + EOF + +ln -s ./menu.lst $target/boot/grub/grub.conf + +if [ -f $target/boot/grub/splash.xpm.gz ]; then + pretty="splashimage=$bootpart$bootdir/grub/splash.xpm.gz" +else + pretty="color cyan/blue white/blue" +fi + +title=$(head -1 $target/etc/redhat-release) + +cat > $target/boot/grub/grub.conf <<-EOF + timeout 5 + default 0 + $pretty + hiddenmenu + + title $title + root $bootpart + kernel $bootdir/vmlinuz-$version root=$ROOT_PARTITION ro + initrd $bootdir/initramfs-$version.img + EOF + +fi + +umount $target/dev + +echo "" +echo "Grub installed on $BOOT_DEVICE = $bootdev" +echo "Grub boot partition is $BOOT_PARTITION = $bootpart" +echo "Root partition is $ROOT_PARTITION" +echo "Boot kernel: $version" + +exit $error diff -Nru fai-5.10.3/examples/simple/scripts/ROCKY/50-sysconfig fai-6.0.3+deb12u1/examples/simple/scripts/ROCKY/50-sysconfig --- fai-5.10.3/examples/simple/scripts/ROCKY/50-sysconfig 1970-01-01 00:00:00.000000000 +0000 +++ fai-6.0.3+deb12u1/examples/simple/scripts/ROCKY/50-sysconfig 2022-05-29 07:56:04.000000000 +0000 @@ -0,0 +1,35 @@ +#! /bin/bash + +# (c) Michael Goetze, 2011, mgoetze@mgoetze.net + +error=0 ; trap "error=$((error|1))" ERR + +cat > $target/etc/sysconfig/clock <<-EOF + UTC=$UTC + ZONE=$TIMEZONE + EOF +cat > $target/etc/sysconfig/i18n <<-EOF + LANG="$DEFAULTLOCALE" + SUPPORTED="$SUPPORTEDLOCALE" + SYSFONT="$CONSOLEFONT" + EOF +cat > $target/etc/sysconfig/keyboard <<-EOF + KEYBOARDTYPE="pc" + KEYTABLE="$KEYMAP" + EOF + +# can not be used, because we still not use systemd in FAI +# $ROOTCMD localectl set-locale LANG=$DEFAULTLOCALE + +cat > $target/etc/locale.conf <<-EOF + LANG="$DEFAULTLOCALE" + EOF +if [ -f $target/usr/lib/locale/locale-archive.tmpl \ + -a ! -s $target/usr/lib/locale/locale-archive ]; then + mv $target/usr/lib/locale/locale-archive.tmpl $target/usr/lib/locale/locale-archive +fi + +fcopy -iv /etc/sysconfig/i18n /etc/sysconfig/keyboard + +exit $error + diff -Nru fai-5.10.3/examples/simple/scripts/ROCKY/60-network-scripts fai-6.0.3+deb12u1/examples/simple/scripts/ROCKY/60-network-scripts --- fai-5.10.3/examples/simple/scripts/ROCKY/60-network-scripts 1970-01-01 00:00:00.000000000 +0000 +++ fai-6.0.3+deb12u1/examples/simple/scripts/ROCKY/60-network-scripts 2023-05-25 16:11:51.000000000 +0000 @@ -0,0 +1,81 @@ +#! /bin/bash + +error=0 ; trap "error=$((error|1))" ERR + +ifcfg_config() { + + cat > $target/etc/sysconfig/network-scripts/ifcfg-$NIC1 <<-EOF + # generated by FAI + TYPE=Ethernet + PROXY_METHOD=none + BOOTPROTO=dhcp + DEFROUTE=yes + BROWSER_ONLY=no + IP4_FAILURE_FATAL=no + IPV6INIT=no + IPV6_AUTOCONF=no + NAME=$NIC1 + DEVICE=$NIC1 + ONBOOT=yes + EOF +} + +nm_config() { + + uuid=$(uuidgen) + + cat > $target/etc/NetworkManager/system-connections/${NIC1}.nmconnection << EOF + +# generated by FAI +[connection] +id=$NIC1 +uuid=$uuid +type=ethernet +autoconnect-priority=-999 +interface-name=$NIC1 + +[ethernet] + +[ipv4] +method=auto + +[ipv6] +addr-gen-mode=eui64 +method=auto + +[proxy] +EOF + + chmod 600 $target/etc/NetworkManager/system-connections/${NIC1}.nmconnection +} + + + +# determine predictable network names +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 [ $FAI_ACTION != "softupdate" ] && ifclass DHCPC; then + . $target/etc/os-release + major=$(echo ${VERSION_ID} | awk -F '.' '{ print $1 }') + + if [ $major -lt 9 ]; then + ifcfg_config + else + nm_config + fi +fi + +fcopy -iv /etc/sysconfig/network /etc/resolv.conf /etc/networks +fcopy -ivr /etc/sysconfig/network-scripts + +exit $error diff -Nru fai-5.10.3/examples/simple/scripts/ROCKY/80-misc fai-6.0.3+deb12u1/examples/simple/scripts/ROCKY/80-misc --- fai-5.10.3/examples/simple/scripts/ROCKY/80-misc 1970-01-01 00:00:00.000000000 +0000 +++ fai-6.0.3+deb12u1/examples/simple/scripts/ROCKY/80-misc 2022-10-06 17:18:42.000000000 +0000 @@ -0,0 +1,21 @@ +#! /bin/bash + +error=0 ; trap "error=$((error|1))" ERR + +# add a $username user account +if [ -n "$username" ]; then + if ! $ROOTCMD getent passwd $username ; then + $ROOTCMD adduser -c "$username user" $username + $ROOTCMD usermod -p "$USERPW" $username + fi +fi + +# enable graphical login screen, make run level 5 as default +if [ -f $target/usr/sbin/gdm ]; then + fai-sed 's/id:3:initdefault:/id:5:initdefault:/' /etc/inittab + # do not run this tool + echo "RUN_FIRSTBOOT=NO" > $target/etc/sysconfig/firstboot +fi + +exit $error + diff -Nru fai-5.10.3/examples/simple/scripts/ROCKY/90-cleanup fai-6.0.3+deb12u1/examples/simple/scripts/ROCKY/90-cleanup --- fai-5.10.3/examples/simple/scripts/ROCKY/90-cleanup 1970-01-01 00:00:00.000000000 +0000 +++ fai-6.0.3+deb12u1/examples/simple/scripts/ROCKY/90-cleanup 2018-03-10 20:02:12.000000000 +0000 @@ -0,0 +1,3 @@ +#! /bin/bash + +$ROOTCMD yum clean all diff -Nru fai-5.10.3/examples/simple/tests/Faitest.pm fai-6.0.3+deb12u1/examples/simple/tests/Faitest.pm --- fai-5.10.3/examples/simple/tests/Faitest.pm 2018-03-10 20:02:12.000000000 +0000 +++ fai-6.0.3+deb12u1/examples/simple/tests/Faitest.pm 2022-10-28 18:49:28.000000000 +0000 @@ -2,7 +2,7 @@ # Subroutines for automatic tests # -# Copyright (C) 2009 Thomas Lange, lange@informatik.uni-koeln.de +# Copyright (C) 2009 Thomas Lange, lange@cs.uni-koeln.de # Based on the first version by Sebastian Hetze, 08/2008 package FAITEST; diff -Nru fai-5.10.3/lib/check-cross-arch fai-6.0.3+deb12u1/lib/check-cross-arch --- fai-5.10.3/lib/check-cross-arch 2021-04-14 13:02:27.000000000 +0000 +++ fai-6.0.3+deb12u1/lib/check-cross-arch 2022-10-28 18:47:58.000000000 +0000 @@ -3,9 +3,11 @@ # check-cross-arch - check if qemu is needed for the target directory # # This script is part of FAI (Fully Automatic Installation) -# Copyright (C) 2017-2020 Thomas Lange, lange@informatik.uni-koeln.de +# Copyright (C) 2017-2020 Thomas Lange, lange@cs.uni-koeln.de +set -euE +verbose=${verbose:-0} target=$1 # is there already a qemu-*static binary? @@ -17,8 +19,9 @@ info=$(file /bin/more) myarch=$(expr "$info" : '.*ld-linux-\([^[:space:]]*\).so.*') +i386_re="ELF 32-bit LSB (shared object|pie executable), Intel 80386" if [ -z "$myarch" ]; then - if [[ "$info" =~ "ELF 32-bit LSB shared object, Intel 80386" ]]; then + if [[ "$info" =~ $i386_re ]]; then myarch=i386 fi fi @@ -36,9 +39,9 @@ _more=$(realpath -m $_more) # handle symlink _more=$target/${_more#$target} info=$(file $_more) -targetarch=$(expr "$info" : '.*ld-linux-\([^[:space:]]*\).so.*') +targetarch=$(expr "$info" : '.*ld-linux-\([^[:space:]]*\).so.*') || true if [ -z "$targetarch" ]; then - if [[ "$info" =~ "ELF 32-bit LSB shared object, Intel 80386" ]]; then + if [[ "$info" =~ $i386_re ]]; then targetarch=i386 fi fi diff -Nru fai-5.10.3/lib/dracut/80fai-autodiscover/module-setup.sh fai-6.0.3+deb12u1/lib/dracut/80fai-autodiscover/module-setup.sh --- fai-5.10.3/lib/dracut/80fai-autodiscover/module-setup.sh 2017-01-04 20:18:01.000000000 +0000 +++ fai-6.0.3+deb12u1/lib/dracut/80fai-autodiscover/module-setup.sh 2022-10-06 17:06:35.000000000 +0000 @@ -13,7 +13,7 @@ install() { inst_multiple nmap grep cut sort uniq head nc dialog getent - + inst_hook cmdline 40 "$moddir/parse-fai.sh" inst_hook initqueue/online 95 "$moddir/fai-scan.sh" } diff -Nru fai-5.10.3/lib/fai-abort fai-6.0.3+deb12u1/lib/fai-abort --- fai-5.10.3/lib/fai-abort 2014-02-01 13:13:07.000000000 +0000 +++ fai-6.0.3+deb12u1/lib/fai-abort 2022-09-30 08:39:18.000000000 +0000 @@ -17,9 +17,10 @@ esac echo FAI: installation aborted. +echo "Hit to obtain a shell" echo reboot with: faireboot echo or after a logout -bash +openvt -c1 -f -w -- /bin/bash cd / umount -ar reboot -dfi diff -Nru fai-5.10.3/lib/fai-divert fai-6.0.3+deb12u1/lib/fai-divert --- fai-5.10.3/lib/fai-divert 2020-06-26 09:43:23.000000000 +0000 +++ fai-6.0.3+deb12u1/lib/fai-divert 2022-10-28 18:47:58.000000000 +0000 @@ -5,7 +5,7 @@ # fai-divert -- add or remove a diversion for fai # # This script is part of FAI (Fully Automatic Installation) -# (c) 2002-2007 by Thomas Lange, lange@informatik.uni-koeln.de +# (c) 2002-2007 by Thomas Lange, lange@cs.uni-koeln.de # Universitaet zu Koeln # #********************************************************************* @@ -82,7 +82,7 @@ -r FILE Remove a diversion. -v Be verbose. -Report bugs to . +Report bugs to . EOF exit 0 } diff -Nru fai-5.10.3/lib/fai-savelog fai-6.0.3+deb12u1/lib/fai-savelog --- fai-5.10.3/lib/fai-savelog 2017-01-04 20:18:01.000000000 +0000 +++ fai-6.0.3+deb12u1/lib/fai-savelog 2022-10-28 18:47:58.000000000 +0000 @@ -5,7 +5,7 @@ # fai-save-log -- save log files from fai to a local or remote location # # This script is part of FAI (Fully Automatic Installation) -# (c) 2002-2015 by Thomas Lange, lange@informatik.uni-koeln.de +# (c) 2002-2015 by Thomas Lange, lange@cs.uni-koeln.de # Universitaet zu Koeln # #********************************************************************* diff -Nru fai-5.10.3/lib/fetch-basefile fai-6.0.3+deb12u1/lib/fetch-basefile --- fai-5.10.3/lib/fetch-basefile 2021-05-01 20:23:53.000000000 +0000 +++ fai-6.0.3+deb12u1/lib/fetch-basefile 2022-11-02 13:19:19.000000000 +0000 @@ -2,7 +2,7 @@ # fetch-basefile, fetch a basefile via ftp or http using classes # -# (c) Thomas Lange, 2011-2017 +# (c) Thomas Lange, 2011-2022 # # Try to download a file CLASSNAME.tar.gz (or tgz, or tar.xz,...) from an URL # CLASSNAME must match a FAI class @@ -39,7 +39,8 @@ #shift $((OPTIND - 1)) # get list of *.tar* files at URL -flist=$(lftp -e 'cls *.tar*;exit' "$url" 2>/dev/null) +flist=$(lftp -e "connect $url ;cls -1 *.tar*;exit" 2>/dev/null) + # create an array of all lines baselist=($flist) @@ -65,7 +66,7 @@ fi echo "Downloading $url/$f" - lftp -e "get $url/$f;exit" # fails if file already exists. this is nice. + curl -s $url/$f > $f error=$? break 2 fi diff -Nru fai-5.10.3/lib/get-boot-info fai-6.0.3+deb12u1/lib/get-boot-info --- fai-5.10.3/lib/get-boot-info 2021-05-01 20:23:53.000000000 +0000 +++ fai-6.0.3+deb12u1/lib/get-boot-info 2023-06-23 20:43:21.000000000 +0000 @@ -5,7 +5,7 @@ # bootinfo -- get boot information via DHCP protocol # # This script is part of FAI (Fully Automatic Installation) -# (c) 2003-2021 by Thomas Lange, lange@informatik.uni-koeln.de +# (c) 2003-2022 by Thomas Lange, lange@cs.uni-koeln.de # Universitaet zu Koeln # #********************************************************************* @@ -86,9 +86,11 @@ IPADDR=$IPADDR CIDR=$CIDR GATEWAYS=$GATEWAYS - SERVER=$SERVER EOF fi + if [ -n "$SERVER" ]; then + echo "SERVER=$SERVER" >> $bootlog + fi if [ -n "$DOMAIN" ]; then # DOMAIN was specified on the kernel command line @@ -158,6 +160,13 @@ get_dhcp_info +# use first Ethernet interface, even if it's not used during installation +if [ -z "$NIC1" ]; then + # ignore some names + NIC1=$(ls /sys/class/net/ | egrep '^en' | head -1) + echo "NIC1=$NIC1" >> $bootlog +fi + # DHCP should not overwrite the hostname if it's already set # then remove this line from boot.log read hname < /proc/sys/kernel/hostname diff -Nru fai-5.10.3/lib/get-config-dir-http fai-6.0.3+deb12u1/lib/get-config-dir-http --- fai-5.10.3/lib/get-config-dir-http 2018-01-19 13:00:17.000000000 +0000 +++ fai-6.0.3+deb12u1/lib/get-config-dir-http 2022-10-28 18:47:58.000000000 +0000 @@ -5,7 +5,7 @@ # get-config-dir-http -- get a tarball of the config dir # # This script is part of FAI (Fully Automatic Installation) -# Copyright (C) 2000-2015 Thomas Lange, lange@informatik.uni-koeln.de +# Copyright (C) 2000-2015 Thomas Lange, lange@cs.uni-koeln.de # Universitaet zu Koeln # #********************************************************************* diff -Nru fai-5.10.3/lib/get-config-dir-https fai-6.0.3+deb12u1/lib/get-config-dir-https --- fai-5.10.3/lib/get-config-dir-https 2018-01-19 13:00:17.000000000 +0000 +++ fai-6.0.3+deb12u1/lib/get-config-dir-https 2022-10-28 18:47:58.000000000 +0000 @@ -5,7 +5,7 @@ # get-config-dir-http -- get a tarball of the config dir # # This script is part of FAI (Fully Automatic Installation) -# Copyright (C) 2000-2015 Thomas Lange, lange@informatik.uni-koeln.de +# Copyright (C) 2000-2015 Thomas Lange, lange@cs.uni-koeln.de # Universitaet zu Koeln # #********************************************************************* diff -Nru fai-5.10.3/lib/get-config-dir-scp fai-6.0.3+deb12u1/lib/get-config-dir-scp --- fai-5.10.3/lib/get-config-dir-scp 2018-01-19 13:00:17.000000000 +0000 +++ fai-6.0.3+deb12u1/lib/get-config-dir-scp 2022-10-28 18:47:58.000000000 +0000 @@ -5,7 +5,7 @@ # get-config-dir-http -- get a tarball of the config dir # # This script is part of FAI (Fully Automatic Installation) -# Copyright (C) 2000-2015 Thomas Lange, lange@informatik.uni-koeln.de +# Copyright (C) 2000-2015 Thomas Lange, lange@cs.uni-koeln.de # Universitaet zu Koeln # #********************************************************************* diff -Nru fai-5.10.3/lib/get-config-dir-sftp fai-6.0.3+deb12u1/lib/get-config-dir-sftp --- fai-5.10.3/lib/get-config-dir-sftp 2018-01-19 13:00:17.000000000 +0000 +++ fai-6.0.3+deb12u1/lib/get-config-dir-sftp 2022-10-28 18:47:58.000000000 +0000 @@ -5,7 +5,7 @@ # get-config-dir-http -- get a tarball of the config dir # # This script is part of FAI (Fully Automatic Installation) -# Copyright (C) 2000-2015 Thomas Lange, lange@informatik.uni-koeln.de +# Copyright (C) 2000-2015 Thomas Lange, lange@cs.uni-koeln.de # Universitaet zu Koeln # #********************************************************************* diff -Nru fai-5.10.3/lib/mkramdisk fai-6.0.3+deb12u1/lib/mkramdisk --- fai-5.10.3/lib/mkramdisk 2021-05-01 20:23:53.000000000 +0000 +++ fai-6.0.3+deb12u1/lib/mkramdisk 2022-10-28 18:47:58.000000000 +0000 @@ -5,7 +5,7 @@ # mkramdisk -- mount a ramdisk on top of a directory # # This script is part of FAI (Fully Automatic Installation) -# (c) 2003-2014 by Thomas Lange, lange@informatik.uni-koeln.de +# (c) 2003-2022 by Thomas Lange, lange@cs.uni-koeln.de # Universitaet zu Koeln # #********************************************************************* @@ -81,11 +81,6 @@ done shift $((OPTIND - 1)) -if [ -n "$FAI_NORAMDISK" ]; then - echo "The use of \$FAI_NORAMDISK is now deprecated. Please use \$FAI_RAMDISKS instead." >&2 - exit 99 -fi - # set default dirs if FAI_RAMDISKS not already set : ${FAI_RAMDISKS:="$target/var/lib/dpkg"} diff -Nru fai-5.10.3/lib/mount2dir fai-6.0.3+deb12u1/lib/mount2dir --- fai-5.10.3/lib/mount2dir 2021-05-22 15:45:06.000000000 +0000 +++ fai-6.0.3+deb12u1/lib/mount2dir 2023-06-23 20:43:21.000000000 +0000 @@ -5,7 +5,7 @@ # mount2dir -- mount partitions to a directory using a fstab file # # This script is part of FAI (Fully Automatic Installation) -# (c) 2001-2020 by Thomas Lange, lange@informatik.uni-koeln.de +# (c) 2001-2020 by Thomas Lange, lange@cs.uni-koeln.de # Universitaet zu Koeln # #********************************************************************* @@ -73,7 +73,7 @@ case $device in ""|\#*) continue ;; - /dev/*|LABEL=*|UUID=*|*:*) + /dev/*|LABEL=*|UUID=*|PARTLABEL=*|PARTUUID=*|*:*) # overwrite mount options mopt="-o $mopt -o noatime" diff -Nru fai-5.10.3/lib/prcopyleft fai-6.0.3+deb12u1/lib/prcopyleft --- fai-5.10.3/lib/prcopyleft 2021-05-01 20:23:53.000000000 +0000 +++ fai-6.0.3+deb12u1/lib/prcopyleft 2023-01-14 13:03:09.000000000 +0000 @@ -3,7 +3,7 @@ #********************************************************************* # # This script is part of FAI (Fully Automatic Installation) -# (c) 2003-2021 by Thomas Lange, lange@cs.uni-koeln.de +# (c) 2003-2023 by Thomas Lange, lange@cs.uni-koeln.de # Universitaet zu Koeln # #********************************************************************* @@ -17,7 +17,7 @@ ------------------------------------------------- Fully Automatic Installation - FAI - $FAI_VERSION (c) 1999-2021 + $FAI_VERSION (c) 1999-2023 Thomas Lange ------------------------------------------------- EOF diff -Nru fai-5.10.3/lib/setup-storage/Commands.pm fai-6.0.3+deb12u1/lib/setup-storage/Commands.pm --- fai-5.10.3/lib/setup-storage/Commands.pm 2021-05-22 15:45:06.000000000 +0000 +++ fai-6.0.3+deb12u1/lib/setup-storage/Commands.pm 2022-12-23 22:28:32.000000000 +0000 @@ -27,8 +27,7 @@ # @brief Build the required commands in @FAI::commands using the config stored # in %FAI::configs # -# @author Christian Kern, Michael Tautschnig, Sebastian Hetze, Andreas Schuldei -# @date Sun Jul 23 16:09:36 CEST 2006 +# @author Christian Kern, Michael Tautschnig, Sebastian Hetze, Andreas Schuldei, Thomas Lange # ################################################################################ @@ -46,12 +45,6 @@ ################################################################################ my @preserved_raid = (); -my $parted_version = 0; - -sub get_parted_version { - my ($major, $minor) = (`parted -v | head -1` =~ m/\s+(\d).(\d)/); - $parted_version = 1 if ($major >= 3 or ($major == 2 and $minor >= 4)); -} sub build_mkfs_commands { @@ -303,7 +296,6 @@ # ################################################################################ sub build_btrfs_commands { - my $forcebtrfs = &btrfs_options; # following monstrosity takes care of single device/partition btrfs disk configs foreach my $c (keys %FAI::configs) { @@ -344,7 +336,7 @@ next unless ($config eq "BTRFS"); #create BTRFS RAIDs - foreach my $id (keys %{ $FAI::configs{$config}{volumes} }) { + foreach my $id (numsort(keys %{ $FAI::configs{$config}{volumes} })) { #reference to current btrfs volume my $vol = (\%FAI::configs)->{$config}->{volumes}->{$id}; @@ -356,13 +348,16 @@ ($mountoptions =~ m/subvol=([^,\s]+)/ and my $initial_subvolume= $1) or die "You must define an initial subvolume for your BTRFS RAID"; my $btrfscreateopts = $vol->{btrfscreateopts} // "" ; my $createopts = $vol->{createopts} // ""; - $createopts .= " $forcebtrfs"; + $createopts .= " -f"; my $pre_req = ""; my $btrfs_tool = ""; # creates the proper prerequisites for later command ordering foreach (@devs) { my $tmp = $_; - $tmp =~ s/\d//; + # special handling for nvme devices + unless ($tmp =~ s/(nvme.+)p\d+/$1/) { + $tmp =~ s/\d//; + } $pre_req = "${pre_req}pt_complete_${tmp}," unless ($pre_req =~ m/pt_complete_$tmp/); } if (scalar @devs == 1) { @@ -379,7 +374,12 @@ $mkfs_done{join(" ", @devs)} = '1'; } } else { - $btrfs_tool = "mkfs.btrfs -d raid$raidlevel $createopts ".join(" ",@devs); + if (exists $mkfs_done{join(" ", sort @devs)}) { + $btrfs_tool = "true"; + } else { + $btrfs_tool = "mkfs.btrfs -d raid$raidlevel $createopts ".join(" ", sort @devs); + $mkfs_done{join(" ", sort @devs)} = '1'; + } } # nothing more to do if we need to proserve this volume. No mkfs, no subvolume @@ -399,7 +399,7 @@ "btrfs_created_$initial_subvolume"); # unmounting the device itself - &FAI::push_command("umount $devs[0]", + &FAI::push_command("umount /mnt", "btrfs_created_$initial_subvolume", ""); } @@ -513,16 +513,16 @@ $pre_req = "exist_/dev/md" . ( $id - 1 ) . $pre_req if (0 != $id); $pre_req =~ s/^,//; &FAI::push_command( - "yes | mdadm --create $create_options /dev/md$id --level=$level --force --run --raid-devices=" + "yes | mdadm --create /dev/md$id --level=$level --force --run $create_options --raid-devices=" . scalar(@eff_devs) . (scalar(@spares) !=0 ? " --spare-devices=" . scalar(@spares) : "") . " " . join(" ", @eff_devs) . " " . join(" ", @spares), "$pre_req", "exist_/dev/md$id" ); # do not sync soft raid during installation # do not remove ; from echo line. Otherwise it will not work - if ($FAI::do_init_tasks) { # no sync when initial installation + if ($FAI::do_init_tasks && $level ne 'raid0') { # no sync when initial installation &FAI::push_command( - "echo frozen > /sys/block/md$id/md/sync_action", + "echo frozen | tee /sys/block/md$id/md/sync_action", "exist_/dev/md$id", "nosync_md$id" ); } @@ -659,7 +659,6 @@ my ($config) = @_; ($config =~ /^VG_(.+)$/) and ($1 ne "--ANY--") or &FAI::internal_error("Invalid config $config"); my $vg = $1; # the actual volume group - my $optyes = &lvm_options; # now create or resize the configured logical volumes foreach my $lv (@{ $FAI::configs{$config}{ordered_lv_list} }) { # reference to the size of the current logical volume @@ -695,13 +694,8 @@ &FAI::push_command( "resize2fs /dev/$vg/$lv ${block_count}s", "e2fsck_f_resize_$vg/$lv", "lv_shrink_$vg/$lv" ); } else { - if ($parted_version) { - &FAI::push_command( "parted -s /dev/$vg/$lv resizepart 1 " . $lv_size->{eff_size} . "B", - "vg_enabled_$vg", "lv_shrink_$vg/$lv" ); - } else { - &FAI::push_command( "parted -s /dev/$vg/$lv resize 1 0 " . $lv_size->{eff_size} . "B", - "vg_enabled_$vg", "lv_shrink_$vg/$lv" ); - } + &FAI::push_command( "parted -s /dev/$vg/$lv resizepart 1 " . $lv_size->{eff_size} . "B", + "vg_enabled_$vg", "lv_shrink_$vg/$lv" ); } &FAI::push_command( "lvresize -L $lvsize_mib $vg/$lv", "vg_enabled_$vg,lv_shrink_$vg/$lv", "lv_created_$vg/$lv" ); @@ -716,13 +710,8 @@ &FAI::push_command( "resize2fs /dev/$vg/$lv ${block_count}s", "e2fsck_f_resize_$vg/$lv", "exist_/dev/$vg/$lv" ); } else { - if ($parted_version) { - &FAI::push_command( "parted -s /dev/$vg/$lv resizepart 1 " . $lv_size->{eff_size} . "B", - "vg_enabled_$vg,lv_grow_$vg/$lv", "exist_/dev/$vg/$lv" ); - } else { - &FAI::push_command( "parted -s /dev/$vg/$lv resize 1 0 " . $lv_size->{eff_size} . "B", - "vg_enabled_$vg,lv_grow_$vg/$lv", "exist_/dev/$vg/$lv" ); - } + &FAI::push_command( "parted -s /dev/$vg/$lv resizepart 1 " . $lv_size->{eff_size} . "B", + "vg_enabled_$vg,lv_grow_$vg/$lv", "exist_/dev/$vg/$lv" ); } } @@ -736,7 +725,7 @@ my ($create_options) = $FAI::configs{$config}{volumes}{$lv}{lvcreateopts}; # prevent warnings of uninitialized variables $create_options = '' unless $create_options; - $create_options .= " $optyes"; + $create_options .= " --yes"; print "/dev/$vg/$lv LV create_options: $create_options\n" if ($FAI::debug && $create_options); # create a new volume &FAI::push_command( "lvcreate $create_options -n $lv -L " . @@ -1098,6 +1087,12 @@ } } + # set partition label if it exists + if ($FAI::configs{$config}{disklabel} =~ /gpt(-bios)?/) { + $part_type = (defined($FAI::configs{$config}{partitions}{$mapped_id}{ptlabel}) ) ? + $FAI::configs{$config}{partitions}{$mapped_id}{ptlabel} : "'\" \"'"; # or empty ptlabel + } + # restore the partition type, if any my $fs = $FAI::current_config{$disk}{partitions}{$mapped_id}{filesystem}; @@ -1285,15 +1280,9 @@ ## " ${block_count}s", "e2fsck_f_resize_" . &FAI::make_device_name($disk, $p), ## "resized_" . &FAI::make_device_name($disk, $p) ); } else { - if ($parted_version) { - &FAI::push_command( "parted -s $disk resizepart $p ${end}B", - "rebuilt_" . &FAI::make_device_name($disk, $p) . $deps, "resized_" . - &FAI::make_device_name($disk, $p) ); - } else { - &FAI::push_command( "parted -s $disk resize $p ${start}B ${end}B", - "rebuilt_" . &FAI::make_device_name($disk, $p) . $deps, "resized_" . - &FAI::make_device_name($disk, $p) ); - } + &FAI::push_command( "parted -s $disk resizepart $p ${end}B", + "rebuilt_" . &FAI::make_device_name($disk, $p) . $deps, "resized_" . + &FAI::make_device_name($disk, $p) ); } } @@ -1336,6 +1325,12 @@ } } + # set partition label if it exists + if ($FAI::configs{$config}{disklabel} =~ /gpt(-bios)?/) { + $part_type = (defined($part->{ptlabel}) ) ? + $part->{ptlabel} : "'\" \"'"; # or empty ptlabel + } + my $fs = (defined($part->{filesystem}) && $part->{filesystem} =~ /\S+/) ? $part->{filesystem} : "-"; ($fs) = split(/:/, $fs); @@ -1352,6 +1347,7 @@ $pre .= ",exist_" . &FAI::make_device_name($disk, $prev_id) if ($prev_id > -1); # build a parted command to create the partition my $dn = &FAI::make_device_name($disk, $part_id); + &FAI::push_command( "parted -s $disk mkpart $part_type \"$fs\" ${start}B ${end}B", $pre, "prep2_$dn"); my $cmd = "true"; @@ -1476,6 +1472,12 @@ } } + # set partition label if it exists + if ($FAI::current_config{$disk}{disklabel} =~ /gpt(-bios)?/) { + $part_type = (defined($curr_part->{ptlabel}) ) ? + $curr_part->{ptlabel} : "'\" \"'"; # or empty ptlabel + } + # restore the partition type, if any my $fs = $curr_part->{filesystem}; @@ -1494,31 +1496,6 @@ ################################################################################ # -# @brief test whether --force option is available for btrfs, wheezy/jessie -# -################################################################################ -sub btrfs_options { - # check if --force is available for mkfs.btrfs - my $opt = `mkfs.btrfs 2>&1`; - return "" unless $opt; - my $btrfsopt = $opt =~ '--force' ? '-f' : ''; - return $btrfsopt; -} - -################################################################################ -# -# @brief test whether --yes option is available for lvcreate, wheezy/jessie -# -################################################################################ -# Closes: #750212 -sub lvm_options { - my $opt = `lvcreate --yes 2>&1`; - my $lvmopt = $opt =~ 'unrecognized option' ? '' : '--yes'; - return $lvmopt; -} - -################################################################################ -# # @brief Try to order the queued commands to satisfy all dependencies # ################################################################################ @@ -1541,7 +1518,7 @@ if (defined($FAI::commands{$i}{pre})) { foreach (split(/,/, $FAI::commands{$i}{pre})) { my $cur = $_; - next if scalar(grep(m{^$cur$}, @pre_deps)); + next if scalar(grep(m{^\Q$cur\E$}, @pre_deps)); $all_matched = 0; last; } diff -Nru fai-5.10.3/lib/setup-storage/Exec.pm fai-6.0.3+deb12u1/lib/setup-storage/Exec.pm --- fai-5.10.3/lib/setup-storage/Exec.pm 2021-05-22 15:45:06.000000000 +0000 +++ fai-6.0.3+deb12u1/lib/setup-storage/Exec.pm 2022-05-26 13:35:33.000000000 +0000 @@ -27,7 +27,6 @@ # @brief functions to execute system commands # # @author Christian Kern, Michael Tautschnig -# @date Sun Jul 23 16:09:36 CEST 2006 # ################################################################################ @@ -67,41 +66,14 @@ exit_codes => [0..255], }, { - error => "parted_2", - message => "Parted could not read a disk label (new disk?)\n", - stderr_regex => "Error: Unable to open .* - unrecognised disk label", - stdout_regex => "", - program => "parted -s \\S+ unit TiB print", - response => "warn", - exit_codes => [1], - }, - { - error => "parted_2_new", - message => "Parted could not read a disk label (new disk?)\n", - stderr_regex => "", - stdout_regex => "Error: .* unrecognised disk label", - program => "parted -s \\S+ unit TiB print", - response => "warn", - exit_codes => [1], - }, - { error => "parted_3_2", message => "Parted could not read a disk label (new disk?)\n", stderr_regex => "Error: .* unrecognised disk label", stdout_regex => "", - program => "parted -s \\S+ unit TiB print", + program => "parted -sm \\S+ unit B print", response => "warn", exit_codes => [1], }, - ## { - ## error => "parted_3", - ## message => "Parted was unable to create the partition\n", - ## stderr_regex => "Warning: You requested a partition from .* to .*\\.\$", - ## stdout_regex => "", - ## program => "parted", - ## response => \&FAI::restore_partition_table, - ## exit_codes => [0..255], - ## }, { error => "parted_4", message => "Parted was unable to read the partition table\n", @@ -122,7 +94,7 @@ }, { error => "parted_5", - message => "Parted failed to resize due to a setup-storage internal error\n", + message => "Parted failed to resize due to overlapping partitions\n", stderr_regex => "Error: Can't have overlapping partitions", stdout_regex => "", program => "parted", @@ -131,7 +103,7 @@ }, { error => "parted_5_new", - message => "Parted failed to resize due to a setup-storage internal error\n", + message => "Parted failed to resize due to overlapping partitions\n", stderr_regex => "", stdout_regex => "Error: Can't have overlapping partitions", program => "parted", diff -Nru fai-5.10.3/lib/setup-storage/Fstab.pm fai-6.0.3+deb12u1/lib/setup-storage/Fstab.pm --- fai-5.10.3/lib/setup-storage/Fstab.pm 2021-05-22 15:45:06.000000000 +0000 +++ fai-6.0.3+deb12u1/lib/setup-storage/Fstab.pm 2021-06-27 22:26:19.000000000 +0000 @@ -26,8 +26,7 @@ # # @brief Generate an fstab file as appropriate for the configuration # -# @author Christian Kern, Michael Tautschnig -# @date Sun Jul 23 16:09:36 CEST 2006 +# @author Christian Kern, Michael Tautschnig, Thomas Lange # ################################################################################ @@ -52,7 +51,7 @@ # add a comment denoting the actual device name in case of UUID or LABEL $comment_line="# device during installation: $dev_name\n" - if ($name =~ /^(UUID|LABEL)=/); + if ($name =~ /^(UUID|LABEL|PARTUUID|PARTLABEL)=/); # start with the device key push @fstab_line, $name; @@ -100,12 +99,14 @@ my ($device_name, $key_type) = @_; ("uuid" eq $key_type) or ("label" eq $key_type) or ("device" eq $key_type) or + ("partuuid" eq $key_type) or ("partlabel" eq $key_type) or &FAI::internal_error("Invalid key type $key_type"); + `$FAI::udev_settle`; + # write the device name as the first entry; if the user prefers uuids # or labels, use these if available my @uuid = (); - `$FAI::udev_settle`; &FAI::execute_ro_command( "/sbin/blkid -c /dev/null -s UUID -o value $device_name", \@uuid, 0); @@ -119,21 +120,36 @@ # get the label -- this is likely empty; exit code 3 if no label, but that is # ok here my @label = (); - `$FAI::udev_settle`; - &FAI::execute_ro_command( + ($key_type eq "label") && &FAI::execute_ro_command( "/sbin/blkid -c /dev/null -s LABEL -o value $device_name", \@label, 0); + my @ptlabel = (); + ($key_type eq "partlabel") && &FAI::execute_ro_command( + "/sbin/blkid -c /dev/null -s PARTLABEL -o value $device_name", \@ptlabel, 0); + + my @ptuuid = (); + ($key_type eq "partuuid") && &FAI::execute_ro_command( + "/sbin/blkid -c /dev/null -s PARTUUID -o value $device_name", \@ptuuid, 0); + # print uuid and label to console warn "$device_name UUID=$uuid[0]" if @uuid; warn "$device_name LABEL=$label[0]" if @label; + warn "$device_name PARTUUID=$ptuuid[0]" if @ptuuid; + warn "$device_name PARTLABEL=$ptlabel[0]" if @ptlabel; # using the fstabkey value the desired device entry is defined if ($key_type eq "uuid") { chomp ($uuid[0]); return "UUID=$uuid[0]"; + } elsif ($key_type eq "partuuid") { + chomp($ptuuid[0]); + return "PARTUUID=$ptuuid[0]"; } elsif ($key_type eq "label" && scalar(@label) == 1) { chomp($label[0]); return "LABEL=$label[0]"; + } elsif ($key_type eq "partlabel" && scalar(@ptlabel) == 1) { + chomp($ptlabel[0]); + return "PARTLABEL=$ptlabel[0]"; } else { # otherwise, use the usual device path return $device_name; @@ -354,9 +370,11 @@ if (($c_ref->{mount_options} =~ m/size=/) || ($c_ref->{mount_options} =~ m/nr_blocks=/)) { warn "Specified tmpfs size for $c_ref->{mountpoint} ignored as mount options contain size= or nr_blocks=\n"; } else { - $c_ref->{mount_options} .= "," if ($c_ref->{mount_options} ne ""); - # Size will be in % or MiB - $c_ref->{mount_options} .= "size=" . $c_ref->{size}; + unless ($c_ref->{size} eq '-') { + $c_ref->{mount_options} .= "," if ($c_ref->{mount_options} ne ""); + # Size will be in % or MiB + $c_ref->{mount_options} .= "size=" . $c_ref->{size}; + } } push @fstab, create_fstab_line($c_ref, "tmpfs", "tmpfs"); diff -Nru fai-5.10.3/lib/setup-storage/Init.pm fai-6.0.3+deb12u1/lib/setup-storage/Init.pm --- fai-5.10.3/lib/setup-storage/Init.pm 2021-05-22 15:45:06.000000000 +0000 +++ fai-6.0.3+deb12u1/lib/setup-storage/Init.pm 2021-06-27 22:26:19.000000000 +0000 @@ -30,7 +30,6 @@ # https://wiki.fai-project.org/index.php/Setup-storage # # @author Christian Kern, Michael Tautschnig -# @date Sun Jul 23 16:09:36 CEST 2006 # ################################################################################ diff -Nru fai-5.10.3/lib/setup-storage/Parser.pm fai-6.0.3+deb12u1/lib/setup-storage/Parser.pm --- fai-5.10.3/lib/setup-storage/Parser.pm 2021-05-22 15:45:06.000000000 +0000 +++ fai-6.0.3+deb12u1/lib/setup-storage/Parser.pm 2021-06-27 22:26:19.000000000 +0000 @@ -26,8 +26,7 @@ # # @brief A parser for the disk_config files within FAI. # -# @author Christian Kern, Michael Tautschnig, Sam Vilain, Andreas Schludei -# @date Sun Jul 23 16:09:36 CEST 2006 +# @author Christian Kern, Michael Tautschnig, Sam Vilain, Andreas Schludei, Thomas Lange # ################################################################################ @@ -544,7 +543,7 @@ $FAI::configs{RAID}{volumes}{$_}{preserve} = 2 foreach (split(",", $1)); } } - | /^fstabkey:(device|label|uuid)/ + | /^fstabkey:(device|label|uuid|partuuid|partlabel)/ { # the information preferred for fstab device identifieres $FAI::configs{$FAI::device}{fstabkey} = $1; @@ -558,7 +557,7 @@ } } - btrfs_option: /^fstabkey:(device|label|uuid)/ + btrfs_option: /^fstabkey:(device|label|uuid|partuuid|partlabel)/ { $FAI::configs{$FAI::device}{fstabkey} = $1; } @@ -703,10 +702,13 @@ # this is a configuration for a virtual disk $FAI::configs{$FAI::device}{virtual} = 1; } - | /^fstabkey:(device|label|uuid)/ + | /^fstabkey:(device|label|uuid|partuuid|partlabel)/ { # the information preferred for fstab device identifieres $FAI::configs{$FAI::device}{fstabkey} = $1; + if ($1 eq 'partlabel' && $FAI::configs{$FAI::device}{disklabel} eq 'msdos') { + die "fstabkey:partlabel not allowed with msdos disk label\n"; + } } | /^vg:(\d+)/ { @@ -884,6 +886,13 @@ # partitioning it &FAI::init_part_config("raw"); } + | m{^p=([^/,;\s=]*)\s+} + { + # gpt partition label + my $ptlabel = $1; + &FAI::init_part_config("primary"); + $FAI::partition_pointer->{ptlabel} = $ptlabel if $ptlabel; + } | m{^([^/,\s\-]+)-([^/,\s\-]+)\s+} { # set $FAI::device to VG_$1 @@ -982,7 +991,7 @@ } | - tmpfs_size: /^(RAM:(\d+%)|\d+[kKMGTPiB]*)\s+/ + tmpfs_size: /^(RAM:(\d+%)|\d+[kKMGTPiB]*|-)\s+/ { my $size; @@ -990,6 +999,8 @@ # A percentage is kept as is as tmpfs handles it if (defined($2)) { $size = $2; + } elsif ($1 eq '-') { + $size = '-'; } else { $size = $1; $size .= "MiB" if ($size =~ /\d\s*$/); diff -Nru fai-5.10.3/lib/setup-storage/Sizes.pm fai-6.0.3+deb12u1/lib/setup-storage/Sizes.pm --- fai-5.10.3/lib/setup-storage/Sizes.pm 2021-05-22 15:45:06.000000000 +0000 +++ fai-6.0.3+deb12u1/lib/setup-storage/Sizes.pm 2021-06-27 22:26:19.000000000 +0000 @@ -27,7 +27,6 @@ # @brief Compute the size of the partitions and volumes to be created # # @author Christian Kern, Michael Tautschnig -# @date Sun Jul 23 16:09:36 CEST 2006 # ################################################################################ diff -Nru fai-5.10.3/lib/setup-storage/Volumes.pm fai-6.0.3+deb12u1/lib/setup-storage/Volumes.pm --- fai-5.10.3/lib/setup-storage/Volumes.pm 2021-05-22 15:45:06.000000000 +0000 +++ fai-6.0.3+deb12u1/lib/setup-storage/Volumes.pm 2021-06-27 22:26:19.000000000 +0000 @@ -26,8 +26,7 @@ # # @brief Parse the current partition table and LVM/RAID configurations # -# @author Christian Kern, Michael Tautschnig -# @date Sun Jul 23 16:09:36 CEST 2006 +# @author Christian Kern, Michael Tautschnig, Thomas Lange # ################################################################################ @@ -115,14 +114,14 @@ # try to obtain the partition table for $disk # it might fail with parted_2 in case the disk has no partition table my $error = - &FAI::execute_ro_command("parted -s $disk unit TiB print", \@parted_print, 0); + &FAI::execute_ro_command("parted -sm $disk unit B print", \@parted_print, 0); # possible problems if (!defined($FAI::configs{"PHY_$disk"}) && $error ne "") { warn "Could not determine size and contents of $disk, skipping\n"; next; } elsif (defined($FAI::configs{"PHY_$disk"}) && - $FAI::configs{"PHY_$disk"}{preserveparts} == 1 && $error ne "") { + $FAI::configs{"PHY_$disk"}{preserveparts} == 1 && $error ne "") { die "Failed to determine size and contents of $disk, but partitions should have been preserved\n"; } @@ -136,7 +135,7 @@ ($error eq "") or die "Failed to write disk label\n"; # retry partition-table print $error = - &FAI::execute_ro_command("parted -s $disk unit TiB print", \@parted_print, 0); + &FAI::execute_ro_command("parted -sm $disk unit B print", \@parted_print, 0); } ($error eq "") or die "Failed to read the partition table from $disk\n"; @@ -147,237 +146,66 @@ # initialise the hash $FAI::current_config{$disk}{partitions} = {}; - -# the following code parses the output of parted print, using various units -# (TiB, B, chs) -# the parser is capable of reading the output of parted version 1.7.1, which -# looks like -# -# $ /sbin/parted -s /dev/hda unit B print -# WARNING: You are not superuser. Watch out for permissions. -# -# Disk /dev/hda: 80026361855B -# Sector size (logical/physical): 512B/512B -# Partition Table: mac -# -# Number Start End Size File system Name Flags -# 1 512B 32767B 32256B primary -# 5 32768B 1033215B 1000448B hfs primary boot -# 3 134250496B 32212287487B 32078036992B hfs+ primary -# 6 32212287488B 46212287487B 14000000000B ext3 primary -# 2 46212287488B 47212287999B 1000000512B linux-swap primary swap -# 4 47212288000B 80026361855B 32814073856B ext3 primary -# -# Note that the output contains an additional column on msdos, indicating, -# whether the type of a partition is primary, logical or extended. -# -# $ parted -s /dev/hda unit B print -# -# Disk /dev/hda: 82348277759B -# Sector size (logical/physical): 512B/512B -# Partition Table: msdos -# -# Number Start End Size Type File system Flags -# 1 32256B 24675839B 24643584B primary ext3 -# 2 24675840B 1077511679B 1052835840B primary linux-swap -# 3 1077511680B 13662190079B 12584678400B primary ext3 boot -# 4 13662190080B 82343278079B 68681088000B extended -# 5 13662222336B 14715025919B 1052803584B logical ext3 -# 14715058176B 30449986559B 15734928384B -# 7 30450018816B 32547432959B 2097414144B logical ext3 -# 8 32547465216B 82343278079B 49795812864B logical ext3 -# -# parted 2.2: -# $ parted -s /dev/sda unit TiB print -# Model: ATA VBOX HARDDISK (scsi) -# Disk /dev/sda: 0.06TiB -# Sector size (logical/physical): 512B/512B -# Partition Table: msdos -# -# Number Start End Size Type File system Flags -# 1 0.00TiB 0.00TiB 0.00TiB primary ext3 boot -# 2 0.00TiB 0.00TiB 0.00TiB primary linux-swap(v1) -# 3 0.00TiB 0.00TiB 0.00TiB primary ext3 -# 4 0.00TiB 0.06TiB 0.06TiB extended lba -# 5 0.00TiB 0.00TiB 0.00TiB logical ext3 -# 6 0.00TiB 0.00TiB 0.00TiB logical ext3 -# 7 0.00TiB 0.00TiB 0.00TiB logical ext3 -# 8 0.00TiB 0.01TiB 0.00TiB logical ext3 -# 9 0.01TiB 0.06TiB 0.05TiB logical lvm - - # As shown above, some entries may be blank. Thus the exact column starts - # and lengths must be parsed from the header line. This is stored in the - # following hash - my %cols = (); - - # Parse the output line by line - foreach my $line (@parted_print) { - - # now we test line by line - some of them may be ignored - next if ($line =~ /^Disk / || $line =~ /^Model: / || $line =~ /^\s*$/ - || $line =~ /^WARNING: You are not superuser/ - || $line =~ /^Warning: Not all of the space available to/ - || $line =~ /^Warning: Unable to open \S+ read-write/); - - # determine the logical sector size - if ($line =~ /^Sector size \(logical\/physical\): (\d+)B\/\d+B$/) { - $FAI::current_config{$disk}{sector_size} = $1; - } - - # read and store the current disk label - elsif ($line =~ /^Partition Table: (.+)$/) { - $FAI::current_config{$disk}{disklabel} = $1; - } - - # the line containing the table headers - elsif ($line =~ /^(Number\s+)(\S+\s+)+/) { - my $col_start = 0; - - # check the length of each heading; note that they might contain spaces - while ($line =~ /^(\S+( [a-z]\S+)?\s*)([A-Z].*)?$/) { - my $heading = $1; - - # set the line to the remainder - $line = ""; - $line = $3 if defined ($3); - - # the width of the column includes any whitespace - my $col_width = length ($heading); - $heading =~ s/(\S+)\s*$/$1/; - - # build the hash entry - # this start counter starts at 0, which is useful below - $cols{$heading} = { - "start" => $col_start, - "length" => $col_width - }; - $col_start += $col_width; - } - - defined ($cols{"Flags"}{"start"}) - or &FAI::internal_error("Column Flags not found in parted output"); - ($col_start == $cols{"Flags"}{"start"} + $cols{"Flags"}{"length"}) - or &FAI::internal_error("Flags column is not last"); - } else { # one of the partitions - - # we must have seen the header, otherwise probably the format has - # changed - defined ($cols{"File system"}{"start"}) - or &FAI::internal_error("Table header not yet seen while reading $line"); - - # the info for the partition number - my $num_cols_before = $cols{"Number"}{"start"}; - my $num_col_width = $cols{"Number"}{"length"}; - - # the info for the file system column - my $fs_cols_before = $cols{"File system"}{"start"}; - my $fs_col_width = $cols{"File system"}{"length"}; - - # the info for the flags column - my $flags_cols_before = $cols{"Flags"}{"start"}; - - # get the partition number, if any - $line =~ /^.{$num_cols_before}(.{$num_col_width})/; - my $id = $1; - $id =~ s/\s*//g; - - # if there is no partition number, then it must be free space, so no - # file system either - next if ($id eq ""); - - # extract the file system information - my $fs = ""; - if (length ($line) > $fs_cols_before) { - if (length ($line) >= ($fs_cols_before + $fs_col_width)) { - $line =~ /^.{$fs_cols_before}(.{$fs_col_width})/; - $fs = $1; - } else { - $line =~ /^.{$fs_cols_before}(.+)$/; - $fs = $1; - } - } - - # remove any trailing space - $fs =~ s/\s*$//g; - - # store the information in the hash - $FAI::current_config{$disk}{partitions}{$id}{filesystem} = $fs; - - # extract the file system information - my $flags = ""; - if (length ($line) > $flags_cols_before) { - $line =~ /^.{$flags_cols_before}(.+)$/; - $flags = $1; - } - - # remove any space - $flags =~ s/\s//g; - - # store the information in the hash - $FAI::current_config{$disk}{partitions}{$id}{flags} = $flags; - } - } - - # reset the output list - @parted_print = (); - - # obtain the partition table using bytes as units - $error = - &FAI::execute_ro_command("parted -s $disk unit B print free", \@parted_print, 0); + shift @parted_print; # ignore first line + my ($devpath,$end,$transport,$sector_size,$phy_sec,$disklabel) = + split(':',shift @parted_print); + + $end =~ s/B$//; + $FAI::current_config{$disk}{begin_byte} = 0; + $FAI::current_config{$disk}{end_byte} = $end - 1; + $FAI::current_config{$disk}{size} = $end; + + # determine the logical sector size + $FAI::current_config{$disk}{sector_size} = $sector_size; + # read and store the current disk label + $FAI::current_config{$disk}{disklabel} = $disklabel; # Parse the output of the byte-wise partition table foreach my $line (@parted_print) { - - # the disk size line (Disk /dev/hda: 82348277759B) - if ($line =~ /Disk \Q$disk\E: (\d+)B$/) { - $FAI::current_config{$disk}{begin_byte} = 0; - $FAI::current_config{$disk}{end_byte} = $1 - 1; - $FAI::current_config{$disk}{size} = $1; - - # nothing else to be done - next; - } - - # One of the partition lines, see above example - next unless ($line =~ - /^\s*(\d+)\s+(\d+)B\s+(\d+)B\s+(\d+)B(\s+(primary|logical|extended))?/i); + chomp $line; + my ($n,$begin_byte,$end_byte,$count_byte,$fstype,$ptlabel,$flags) = split(':', $line); + $begin_byte =~ s/B$//; + $end_byte =~ s/B$//; + $count_byte =~ s/B$//; + $flags =~ s/;$//; # mark the bounds of existing partitions - $FAI::current_config{$disk}{partitions}{$1}{begin_byte} = $2; - $FAI::current_config{$disk}{partitions}{$1}{end_byte} = $3; - $FAI::current_config{$disk}{partitions}{$1}{count_byte} = $4; + $FAI::current_config{$disk}{partitions}{$n}{begin_byte} = $begin_byte; + $FAI::current_config{$disk}{partitions}{$n}{end_byte} = $end_byte; + $FAI::current_config{$disk}{partitions}{$n}{count_byte} = $count_byte; + $FAI::current_config{$disk}{partitions}{$n}{ptlabel} = $ptlabel; + $FAI::current_config{$disk}{partitions}{$n}{filesystem} = $fstype; + $FAI::current_config{$disk}{partitions}{$n}{flags} = $flags; # is_extended defaults to false/0 - $FAI::current_config{$disk}{partitions}{$1}{is_extended} = 0; - - # but may be true/1 on msdos disk labels - ( ( $FAI::current_config{$disk}{disklabel} eq "msdos" ) - && ( $6 eq "extended" ) ) - and $FAI::current_config{$disk}{partitions}{$1}{is_extended} = 1; + $FAI::current_config{$disk}{partitions}{$n}{is_extended} = 0; # add entry in device tree - push @{ $FAI::current_dev_children{$disk} }, &FAI::make_device_name($disk, $1); + push @{ $FAI::current_dev_children{$disk} }, &FAI::make_device_name($disk, $n); } - # reset the output list @parted_print = (); - # obtain the partition table using bytes as units $error = - &FAI::execute_ro_command( - "parted -s $disk unit chs print free", \@parted_print, 0); + &FAI::execute_ro_command("parted -s $disk unit chs print free", \@parted_print, 0); # Parse the output of the CHS partition table foreach my $line (@parted_print) { - # find the BIOS geometry that looks like this: - # BIOS cylinder,head,sector geometry: 10011,255,63. Each cylinder is 8225kB. + # find the BIOS geometry that looks like this: + # BIOS cylinder,head,sector geometry: 10011,255,63. Each cylinder is 8225kB. if ($line =~ - /^BIOS cylinder,head,sector geometry:\s*(\d+),(\d+),(\d+)\.\s*Each cylinder is \d+(\.\d+)?kB\.$/) { + /^BIOS cylinder,head,sector geometry:\s*(\d+),(\d+),(\d+)\.\s*Each cylinder is \d+(\.\d+)?kB\.$/) { $FAI::current_config{$disk}{bios_cylinders} = $1; $FAI::current_config{$disk}{bios_heads} = $2; $FAI::current_config{$disk}{bios_sectors_per_track} = $3; } + + # check for extended partition on msdos disk labels + if ( $FAI::current_config{$disk}{disklabel} eq "msdos" && + $line =~ /\s*(\d+)\s+[\d,]+\s+[\d,]+\s+extended/) { + $FAI::current_config{$disk}{partitions}{$1}{is_extended} = 1; + } } # make sure we have determined all the necessary information diff -Nru fai-5.10.3/lib/subroutines fai-6.0.3+deb12u1/lib/subroutines --- fai-5.10.3/lib/subroutines 2021-05-22 15:45:06.000000000 +0000 +++ fai-6.0.3+deb12u1/lib/subroutines 2023-06-23 20:43:21.000000000 +0000 @@ -5,7 +5,7 @@ # subroutines -- useful subroutines for FAI # # This script is part of FAI (Fully Automatic Installation) -# (c) 2000-2021 by Thomas Lange, lange@informatik.uni-koeln.de +# (c) 2000-2022 by Thomas Lange, lange@cs.uni-koeln.de # Universitaet zu Koeln # (c) 2001-2005 by Henning Glawe, glaweh@physik.fu-berlin.de # Freie Universitaet Berlin @@ -79,15 +79,15 @@ # check one single class [ "${debug:-}" ] && echo "Test if class $1 is in ${classes:-}" >&2 # test if a class is defined - local ret + local _ret if [[ "${classes:-}" =~ (^|[[:space:]]+)$1($|[[:space:]]+) ]]; then - ret=0 + _ret=0 else - ret=1 + _ret=1 fi [ "${debug:-}" ] && echo "ifclass returns $ret" >&2 - return $ret + return $_ret } _ifclass_and() { @@ -118,6 +118,66 @@ mount -o rw,remount $1 } # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +rw_target() { + + # make $target and mounted subdirectories read-write + local dir + for dir in $(mount | grep "on $target" | grep -E -v "media/mirror|tmpfs"| awk '{print $3}'); do + rwmount $dir + done +} +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +ctam() { + + # mount pseudo filesystems into /target + if [ -z "$target" -o "$target" = "/" ]; then + echo "ERROR: \$target is not set (correctly)." + return + fi + if [ -f $target/proc/cpuinfo ] ; then + echo "Filesystems already mounted to $target." + return + fi + + for f in /sys /proc /dev /dev/pts; do + mount --bind $f ${target}$f + done + if [ -d /sys/firmware/efi ]; then + mount --bind /sys/firmware/efi/efivars $target/sys/firmware/efi/efivars + fi +} +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +ctau() { + + # umount pseudo filesystems from /target + if [ -z "$target" -o "$target" = "/" ]; then + echo "ERROR: \$target is not set (correctly)." + return + fi + if [ ! -f $target/proc/cpuinfo ] ; then + echo "Filesystems already umounted from $target." + return + fi + + for f in /dev/pts /dev /proc /sys/firmware/efi/efivars /sys; do + mountpoint -q ${target}$f && umount ${target}$f + done +} +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +ctai() { + + # chroot into target + if [ -z "$target" -o "$target" = "/" ]; then + echo "ERROR: \$target is not set (correctly)." + return + fi + if [ ! -f $target/bin/bash ]; then + echo "ERROR: Cannot chroot into $target." + return + fi + chroot $target bash +} +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - save_dmesg() { [ $do_init_tasks -eq 0 ] && return @@ -134,14 +194,17 @@ if [[ $FAI_CONFIG_SRC =~ ^nfs:// ]]; then mountpoint -q $FAI && umount $FAI fi + if [[ $FAI_CONFIG_SRC =~ ^https?:// ]]; then + umount /var/lib/fai + fi } # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - umount_target() { if [ "$target" != '/' ]; then # do not umount during softupdate - umount $FAI_ROOT/proc $FAI_ROOT/sys/firmware/efi/efivars $FAI_ROOT/sys $FAI_ROOT/dev/pts $FAI_ROOT/dev 2>/dev/null - for dir in $(mount | grep $target | grep -E -v "media/mirror|tmpfs"| awk '{print $3}' | sort -r); do + umount $target/proc $target/sys/firmware/efi/efivars $target/sys $target/dev/pts $target/dev 2>/dev/null + for dir in $(mount | grep $target | grep -E -v "media/mirror"| awk '{print $3}' | sort -r); do mountpoint -q $dir && umount $dir done fi @@ -158,8 +221,7 @@ > /var/run/fai/vgremove.$PPID vgroup=$(awk '/Executing: vgcreate/ {print $3}' $LOGDIR/format.log) for v in $vgroup; do - vgchange -an $v - echo vgremove -f $v >> /var/run/fai/vgremove.$PPID + echo blkdeactivate /dev/$v/* >> /var/run/fai/vgremove.$PPID done fi } @@ -297,7 +359,7 @@ continue fi if [ -f $hfile.source ]; then - echo "WARNING: The suffix .source is deprecated. Use .sh instead." >&2 + echo "ERROR: The suffix .source is deprecated. Use .sh instead." >&2 # continue fi if [ -x $hfile.sh ]; then @@ -314,14 +376,6 @@ $hfile $dflag "$@" check_status $hook.$cl $? fi - # deprecated - if [ -x $hfile.source ]; then - echo "Source hook: $hook.$cl.source" - sendmon "HOOK $hook.$cl.source" - # source this hook - . $hfile.source $dflag "$@" - check_status $hook.$cl.source $? - fi done } # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -366,7 +420,7 @@ # this may be moved to an external script if [ $do_init_tasks -eq 1 ] ; then # set the system time and date using rdate or/and ntpdate - [ "$TIMESRVS_1" ] && rdate $TIMESRVS_1 + [ "$TIMESRVS_1" ] && [ -f /bin/rdate ] && rdate $TIMESRVS_1 [ "$NTPSRVS_1" ] && ntpdate -b $NTPSRVS [ "$flag_createvt" ] && { # create two virtual terminals; acces via alt-F2 and alt-F3 @@ -540,12 +594,12 @@ grep ^++ $svar rm $svar fi - unset class svar + cd $odir + unset class svar odir # now all variables are defined. Dump them to variables.log, so we can sources them if needed set | perl -ne 'print if /^\w\w+=/ and not /^(EUID|PPID|SHELLOPTS|UID|rootpw|ROOTPW|USERPW|HOME|PWD|BASHOPTS)|\(/' > $LOGDIR/variables.log # another approach is to use this. A slightly different format, but seems to be robust. # declare -x > $LOGDIR/variables.log - cd $odir } # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - task_mountdisks() { @@ -607,7 +661,6 @@ ### END SUBROUTINE INFO task_faiend() { - local dir cdromdevice : ${flag_reboot:=0} : ${flag_halt:=0} @@ -677,9 +730,7 @@ mkdir -p $FAI_ROOT FAI_ROOT=$(cd $FAI_ROOT;pwd) - xstamp=${FAI_ROOT//\//=} - stamp=/var/run/fai/dirinstall-$xstamp - unset xstamp + stamp=/var/run/fai/dirinstall-${FAI_ROOT//\//=} clean_exit() { rm -f $stamp [ -z "$FAI_ROOT" ] && return @@ -955,7 +1006,7 @@ call_debootstrap() { - local targetarch + local targetarch hostarch1 _debootstrap local dversion=$(dpkg-query -Wf '${Version}\n' debootstrap) echo "Creating base system using debootstrap version $dversion" @@ -984,8 +1035,8 @@ fi fi - echo "Calling $_debootstrap $FAI_DEBOOTSTRAP_OPTS $1 $FAI_ROOT $2" - LC_ALL=C $_debootstrap $FAI_DEBOOTSTRAP_OPTS $1 $FAI_ROOT $2 + echo "Calling $_debootstrap $FAI_DEBOOTSTRAP_OPTS $1 $FAI_ROOT $2 $3" + LC_ALL=C $_debootstrap $FAI_DEBOOTSTRAP_OPTS $1 $FAI_ROOT $2 $3 } # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ### BEGIN SUBROUTINE INFO @@ -1069,21 +1120,7 @@ task_repository () { - # check for old hooks for task prepareapt - local hook cl hfile - hook=prepareapt - for cl in ${classes:-}; do - hfile=$FAI/hooks/$hook.$cl - if [ -f $hfile ]; then - echo "WARNING: The task prepareapt is obsolete. It was renamed to task repository. Please rename your hook $hfile to repository.$cl." >&2 - continue - fi - if [ -f $hfile.source ]; then - echo "WARNING: The task prepareapt is obsolete. It was renamed to task repository. Please rename your hook $hfile.source to repository.$cl.source." >&2 - continue - fi - done - + local v if [ X$verbose = X1 ]; then v=-v fi @@ -1094,6 +1131,9 @@ # resolv.conf is needed, /etc/hosts is useful in /target # use a file from the config space or from /etc inside the nfsroot if ! fcopy -BM $v /etc/resolv.conf ; then + if [ -d "$FAI_ROOT/run/systemd/resolve" ]; then + cp $v /etc/resolv.conf "$FAI_ROOT/run/systemd/resolve/stub-resolv.conf" + fi if [ "$(readlink -f /etc/resolv.conf)" = "$(readlink -f $FAI_ROOT/etc/resolv.conf)" ] ; then : # no need for copy since both are pointing to the same file @@ -1129,12 +1169,7 @@ if [ -f $FAI/package_config/$keyfile.gpg ]; then echo "Copying APT key $keyfile.gpg to target" cp -v --preserve=timestamp $FAI/package_config/$keyfile.gpg $FAI_ROOT/etc/apt/trusted.gpg.d/ - continue fi - [ ! -f $FAI/package_config/$keyfile.asc ] && continue - echo "Copying APT key from $keyfile.asc to $keyfile.asc.gpg " - rm -f $FAI_ROOT/etc/apt/trusted.gpg.d/$keyfile.asc.gpg - gpg --batch -o $FAI_ROOT/etc/apt/trusted.gpg.d/$keyfile.asc.gpg --dearmor $FAI/package_config/$keyfile.asc done # mount Debian mirror via NFS if needed @@ -1201,9 +1236,8 @@ [ -z "$LOGUSER" ] && return # silently return from subroutine - local frsh remotesh + local frsh remotesh hostname local doexit=0 - local hostname read hostname < /proc/sys/kernel/hostname local ipaddr=$(grep IPADDR $LOGDIR/boot.log | cut -d= -f2 | sed "s/'//g") local nexttest=$(grep -E -s ^NEXTTEST= $LOGDIR/test.log | cut -d= -f2) diff -Nru fai-5.10.3/lib/task_inventory fai-6.0.3+deb12u1/lib/task_inventory --- fai-5.10.3/lib/task_inventory 2021-05-22 15:46:28.000000000 +0000 +++ fai-6.0.3+deb12u1/lib/task_inventory 2021-08-01 19:49:24.000000000 +0000 @@ -1,7 +1,7 @@ #! /bin/bash # This script is part of FAI (Fully Automatic Installation) -# Copyright (c) 2013-2018 by Thomas Lange, Universitaet zu Koeln +# Copyright (c) 2013-2021 by Thomas Lange, Universitaet zu Koeln # Inventory function, print hardware inventory, without too much configuration information @@ -21,6 +21,9 @@ # memory, RAM mem=$(/usr/sbin/dmidecode -t memory | awk '( /Size:.*MB/ ) { x+=$2 } END { print x/1024 " GB"}') + if [ "$mem" = "0 GB" ]; then + mem=$(/usr/sbin/dmidecode -t memory | awk '( /Size:.*GB/ ) { x+=$2 } END { print x " GB"}') + fi echo "RAMSIZE: $mem" ncpu=$(grep "model name" /proc/cpuinfo | sed -e 's/model name.*://' -e 's/(R)//g' -e 's/(TM)//g' -e 's/^[[:blank:]]\+//'|wc -l) @@ -66,6 +69,11 @@ if [ -d /sys/firmware/efi ]; then efibootmgr fi + + echo List serial numbers of devices + cd /sys/class/dmi/id + grep . *_serial 2>/dev/null| sed -e 's/:/: /'| egrep -iv 'serial: 0123456789|: Not |N/A|:[[:blank:]]+$' + lsblk -dno name,serial } if [ X$verbose = X1 ]; then diff -Nru fai-5.10.3/lib/task_sysinfo fai-6.0.3+deb12u1/lib/task_sysinfo --- fai-5.10.3/lib/task_sysinfo 2021-05-01 20:23:53.000000000 +0000 +++ fai-6.0.3+deb12u1/lib/task_sysinfo 2022-10-16 18:51:17.000000000 +0000 @@ -2,9 +2,15 @@ # display some information about the system and save it to the logserver -# activate all software RAID arrays -echo DEVICE partitions > /etc/mdadm/mdadm.conf -udevadm trigger +if [ X$do_init_tasks = X1 ] ; then + # activate all software RAID arrays + echo DEVICE partitions > /etc/mdadm/mdadm.conf + udevadm trigger + + # start software raid + /usr/share/mdadm/mkconf > /etc/mdadm/mdadm.conf + /etc/init.d/lvm2 start +fi # first show some hardware info echo Showing system information. @@ -29,6 +35,10 @@ echo "NUMA configuration:" numactl -H +if [ -f /usr/bin/upower ]; then + upower -e | grep 'BAT' | xargs -n1 upower -i | egrep 'native-path|vendor|model|energy-full' +fi + echo if command -v hwinfo >&/dev/null; then hwinfo --short --cpu --sys @@ -56,16 +66,11 @@ echo '==================================================' lspci -command -v sfdisk >&/dev/null && sfdisk -d if [ -d /sys/firmware/efi ]; then efibootmgr fi -# start software raid -/usr/share/mdadm/mkconf > /etc/mdadm/mdadm.conf -/etc/init.d/lvm2 start - for device in /dev/sd?; do [ -b "$device" ] || continue # make sure device exists and is valid block device [ $(stat -c %G $device) = "disk" ] || continue @@ -82,11 +87,16 @@ command -v blkid >&/dev/null && blkid # very detailed +echo "========================================" for disk in $disklist; do - smartctl -i /dev/$disk - hdparm -iv /dev/$disk + smartctl -i /dev/$disk | tail +4 + echo "----------------------------------------" fdisk -lu /dev/$disk + echo "----------------------------------------" parted -s /dev/$disk print + echo "----------------------------------------" + sfdisk -d /dev/$disk + echo "----------------------------------------" LC_ALL=C file -s /dev/$disk?* | grep -v ": empty" done @@ -103,8 +113,10 @@ btrfs fi show -fai-mount-disk -f -[ -f $target/etc/fstab ] && cp -p $target/etc/fstab $LOGDIR +if [ X$do_init_tasks = X1 ]; then + fai-mount-disk -f + [ -f $target/etc/fstab ] && cp -p $target/etc/fstab $LOGDIR +fi df -PTh | grep -E ':|^/|^Filesystem' # - - - - - - - - - - - diff -Nru fai-5.10.3/lib/udev.patch fai-6.0.3+deb12u1/lib/udev.patch --- fai-5.10.3/lib/udev.patch 1970-01-01 00:00:00.000000000 +0000 +++ fai-6.0.3+deb12u1/lib/udev.patch 2022-10-20 20:25:59.000000000 +0000 @@ -0,0 +1,11 @@ +--- /etc/udev/rules.d/69-lvm-metad.rules.orig 2021-02-22 13:39:14.000000000 -0800 ++++ /etc/udev/rules.d/69-lvm-metad.rules 2022-09-01 19:22:52.426117170 -0700 +@@ -75,7 +75,6 @@ + + ENV{SYSTEMD_READY}="1" + +-TEST!="/run/systemd/system", GOTO="direct_pvscan" +-TEST=="/run/systemd/system", GOTO="systemd_background" ++GOTO="systemd_background" + + LABEL="systemd_background" diff -Nru fai-5.10.3/lib/updatebase fai-6.0.3+deb12u1/lib/updatebase --- fai-5.10.3/lib/updatebase 2021-05-22 15:46:28.000000000 +0000 +++ fai-6.0.3+deb12u1/lib/updatebase 2023-06-23 20:43:21.000000000 +0000 @@ -42,9 +42,4 @@ $ROOTCMD dpkg -C [ $? -ne 0 ] && yes '' | $ROOTCMD dpkg --configure -a $ROOTCMD apt-get $aptopt dist-upgrade < /dev/null -# update dpkg info which packages are available -tmp=$($ROOTCMD mktemp) || exit 88 -$ROOTCMD apt-cache dumpavail > $FAI_ROOT/$tmp -$ROOTCMD dpkg --update-avail $tmp -rm -f $FAI_ROOT/$tmp $ROOTCMD apt-get clean diff -Nru fai-5.10.3/man/ainsl.1 fai-6.0.3+deb12u1/man/ainsl.1 --- fai-5.10.3/man/ainsl.1 2021-04-14 13:02:27.000000000 +0000 +++ fai-6.0.3+deb12u1/man/ainsl.1 2022-10-28 18:42:59.000000000 +0000 @@ -107,4 +107,4 @@ for more information on how to use ainsl. The FAI homepage is https://fai-project.org. .SH AUTHOR -Thomas Lange +Thomas Lange diff -Nru fai-5.10.3/man/fai-cd.8 fai-6.0.3+deb12u1/man/fai-cd.8 --- fai-5.10.3/man/fai-cd.8 2021-04-14 13:02:27.000000000 +0000 +++ fai-6.0.3+deb12u1/man/fai-cd.8 2023-06-23 20:43:21.000000000 +0000 @@ -121,7 +121,8 @@ and locales are hidden and will not be put onto the CD or the USB stick. .TP .BI \-J -Use xz compression when calling mksquashfs. Default is gzip. +Use xz compression when calling mksquashfs. Default is zstd, which is +much faster.. .TP .BI "\-M " Do not add the package mirror to the CD. Packages that would be fetched @@ -216,4 +217,4 @@ .FN /etc/fai/grub.cfg The default grub2 menu configuration file for fai-cd. .SH AUTHOR -Thomas Lange +Thomas Lange diff -Nru fai-5.10.3/man/fai-chboot.8 fai-6.0.3+deb12u1/man/fai-chboot.8 --- fai-5.10.3/man/fai-chboot.8 2021-05-01 20:23:53.000000000 +0000 +++ fai-6.0.3+deb12u1/man/fai-chboot.8 2022-10-28 18:42:59.000000000 +0000 @@ -31,6 +31,9 @@ .br .B fai-chboot \-I [OPTION]... HOST... +.br +.B fai-chboot +\-a [ACTION]... HOST... .SH DESCRIPTION This command creates the configuration files for network booting using pxelinux and DHCP. @@ -45,13 +48,22 @@ .SH OPTIONS .TP +.BI "\-a " action +Same as -i but also sets FAI_ACTION. +.TP .BI \-B Set default values for FAI_FLAGS. This is the same as \-f verbose,sshd,reboot .TP .B \-c -Copy an existing config file to one or more hosts or templates and enable -them for network booting. +Copy an existing config file (called template) to one or more hosts and enable +them for network booting. fai-chboot performs these substitutions if +you use $IP or $HOST in your template: + +$IP : the IP address as dotted decimal + +$HOST : the assigned hostname + .TP .BI "\-C " CFDIR Use CFDIR as the configuration directory. Default is /etc/fai. You can @@ -214,4 +226,4 @@ This program is part of FAI (Fully Automatic Installation). See the FAI manual for more information on how to use fai-chboot. The FAI homepage is https://fai-project.org. .SH AUTHOR -Thomas Lange +Thomas Lange diff -Nru fai-5.10.3/man/fai-class.1 fai-6.0.3+deb12u1/man/fai-class.1 --- fai-5.10.3/man/fai-class.1 2021-04-14 13:02:27.000000000 +0000 +++ fai-6.0.3+deb12u1/man/fai-class.1 2022-10-28 18:42:59.000000000 +0000 @@ -157,4 +157,4 @@ homepage is http://fai\-project.org. .SH "AUTHOR" -Written by Thomas Lange +Written by Thomas Lange diff -Nru fai-5.10.3/man/fai-debconf.1 fai-6.0.3+deb12u1/man/fai-debconf.1 --- fai-5.10.3/man/fai-debconf.1 2021-04-14 13:02:27.000000000 +0000 +++ fai-6.0.3+deb12u1/man/fai-debconf.1 2022-10-28 18:42:59.000000000 +0000 @@ -55,4 +55,4 @@ homepage is http://fai\-project.org. .SH "AUTHOR" -Written by Thomas Lange +Written by Thomas Lange diff -Nru fai-5.10.3/man/fai-diskimage.8 fai-6.0.3+deb12u1/man/fai-diskimage.8 --- fai-5.10.3/man/fai-diskimage.8 2019-10-17 01:08:18.000000000 +0000 +++ fai-6.0.3+deb12u1/man/fai-diskimage.8 2022-10-28 18:42:59.000000000 +0000 @@ -48,7 +48,7 @@ You can now build your fist disk image. # export FAI_BASEFILEURL=https://fai-project.org/download/basefiles/ - # cl="DEBIAN,STRETCH64,AMD64,FAIBASE,GRUB_PC,DHCPC,DEMO,CLOUD,LAST" + # cl="DEBIAN,BULLSEYE64,AMD64,FAIBASE,GRUB_PC,DHCPC,DEMO,CLOUD,LAST" # fai-diskimage -vu cloud3 -S2G -c$cl cloud.raw Creates a Debian system with a small set of software packages without @@ -78,7 +78,7 @@ You can start fai-diskimage in a clean shell environment by calling: - # env -i /usr/sbin/fai-diskimage -vNu cloudhost -S5G -cSTRETCH64,GCE disk.raw + # env -i /usr/sbin/fai-diskimage -vNu cloudhost -S5G -cBULLSEYE64,GCE disk.raw You can also build cross-architecture disk images using @@ -90,4 +90,4 @@ This program is part of FAI (Fully Automatic Installation). See the FAI manual for more information on how to use fai-monitor. The FAI homepage is https://fai-project.org. .SH AUTHOR -Thomas Lange +Thomas Lange diff -Nru fai-5.10.3/man/fai-do-scripts.1 fai-6.0.3+deb12u1/man/fai-do-scripts.1 --- fai-5.10.3/man/fai-do-scripts.1 2021-04-14 13:02:27.000000000 +0000 +++ fai-6.0.3+deb12u1/man/fai-do-scripts.1 2022-10-28 18:42:59.000000000 +0000 @@ -11,7 +11,7 @@ .\" .br insert line break .\" .sp insert n+1 empty lines .\" for manpage-specific macros, see man(7) -.TH "fai-do-scripts" "1" "8 March 2012" "FAI 4" "" +.TH "fai-do-scripts" "1" "October 2022" "FAI 6" "" .SH "NAME" fai\-do\-scripts \- call configuration scripts .SH "SYNOPSIS" @@ -25,7 +25,7 @@ that match `/^[0\-9][0\-9].*' (starting with two digits) in this directory are executed. It is possible to have several scripts of different types (shell, -cfengine,...) be executed for one class. +python, ruby, cfengine,...) be executed for one class. .SH "OPTIONS" .TP @@ -44,10 +44,18 @@ # fai\-do\-scripts /fai/scripts +.SH "NOTES" +The output of the scripts is also written to $LOGDIR/scripts.log. +The file $LOGDIR/status.log lists all scripts executed and if they +finished with success or failure. + +If the variable $FAI_USE_OLD_SCRIPT_LOGS is set to 1, the old style +log file names (different name for every type of script) are used. +This may be removed in the future. .SH "SEE ALSO" .br This program is part of FAI (Fully Automatic Installation). The FAI homepage is http:///fai\-project.org. .SH "AUTHOR" -Written by Thomas Lange +Written by Thomas Lange diff -Nru fai-5.10.3/man/fai-link.1 fai-6.0.3+deb12u1/man/fai-link.1 --- fai-5.10.3/man/fai-link.1 2021-04-14 13:02:27.000000000 +0000 +++ fai-6.0.3+deb12u1/man/fai-link.1 2022-10-28 18:42:59.000000000 +0000 @@ -17,4 +17,4 @@ This program is part of FAI (Fully Automatic Installation). See the FAI manual for more information on how to use fai-monitor. The FAI homepage is https://fai-project.org. .SH AUTHOR -Thomas Lange +Thomas Lange diff -Nru fai-5.10.3/man/fai-make-nfsroot.8 fai-6.0.3+deb12u1/man/fai-make-nfsroot.8 --- fai-5.10.3/man/fai-make-nfsroot.8 2021-05-01 20:23:53.000000000 +0000 +++ fai-6.0.3+deb12u1/man/fai-make-nfsroot.8 2022-10-28 18:42:59.000000000 +0000 @@ -41,7 +41,7 @@ Adjust a generic nfsroot. Add resolv.conf, add host entries, and/or set the root password. .TP .B \-B BASETGZ -Use specified BASETGZ file as base.tgz (or base.tar.gz, base.tar.xz, base.txz) +Use specified file as base file (can be base.tar.zst, base.tzst , base.tar.xz, base.txz) for the nfsroot. This avoids calling debootstrap and therefore reduces the buildtime for the nfsroot. .TP @@ -93,7 +93,8 @@ Show simple help. .TP .B \-z -Use gzip for compressing the base.tar file. Default is to use xz. +Use zstd for compressing the base.tar file which is much faster than +xz. Default is to use xz. .SH NOTES .PD 0 @@ -126,12 +127,12 @@ Copy this file to the NFSROOT. .PD 0 .TP -.FN /etc/fai/apt/keys/*.asc -Repository keys in .asc format found here will be installed into the NFSROOT. +.FN /etc/fai/apt/keys/*.gpg +Repository keys in .gpg format found here will be installed into the NFSROOT. .PD 0 .TP .FN /var/log/fai/variables The script will write the values of FAI_VERSION and NFSROOT to this file. .SH AUTHOR -Thomas Lange +Thomas Lange diff -Nru fai-5.10.3/man/fai-mirror.1 fai-6.0.3+deb12u1/man/fai-mirror.1 --- fai-5.10.3/man/fai-mirror.1 2021-04-14 13:02:27.000000000 +0000 +++ fai-6.0.3+deb12u1/man/fai-mirror.1 2022-10-28 18:42:59.000000000 +0000 @@ -164,4 +164,4 @@ configuration file /etc/fai/NFSROOT. .SH AUTHOR -Thomas Lange +Thomas Lange diff -Nru fai-5.10.3/man/fai-mk-configspace.1 fai-6.0.3+deb12u1/man/fai-mk-configspace.1 --- fai-5.10.3/man/fai-mk-configspace.1 2018-03-10 20:42:17.000000000 +0000 +++ fai-6.0.3+deb12u1/man/fai-mk-configspace.1 2022-10-28 18:42:59.000000000 +0000 @@ -19,4 +19,4 @@ This program is part of FAI (Fully Automatic Installation). See the FAI manual for more information on how to use fai-monitor. The FAI homepage is https://fai-project.org. .SH AUTHOR -Thomas Lange +Thomas Lange diff -Nru fai-5.10.3/man/fai-monitor-gui.1 fai-6.0.3+deb12u1/man/fai-monitor-gui.1 --- fai-5.10.3/man/fai-monitor-gui.1 2018-01-19 13:00:17.000000000 +0000 +++ fai-6.0.3+deb12u1/man/fai-monitor-gui.1 2022-10-28 18:42:59.000000000 +0000 @@ -23,4 +23,4 @@ This program is part of FAI (Fully Automatic Installation). See the FAI manual for more information on how to use fai-monitor. The FAI homepage is https://fai-project.org. .SH AUTHOR -Thomas Lange +Thomas Lange diff -Nru fai-5.10.3/man/fai-monitor.8 fai-6.0.3+deb12u1/man/fai-monitor.8 --- fai-5.10.3/man/fai-monitor.8 2021-04-14 13:02:27.000000000 +0000 +++ fai-6.0.3+deb12u1/man/fai-monitor.8 2022-10-28 18:42:59.000000000 +0000 @@ -59,4 +59,4 @@ This program is part of FAI (Fully Automatic Installation). See the FAI manual for more information on how to use fai-monitor. The FAI homepage is https://fai-project.org. .SH AUTHOR -Thomas Lange +Thomas Lange diff -Nru fai-5.10.3/man/fai-sed.1 fai-6.0.3+deb12u1/man/fai-sed.1 --- fai-5.10.3/man/fai-sed.1 2021-05-01 20:23:53.000000000 +0000 +++ fai-6.0.3+deb12u1/man/fai-sed.1 2022-10-28 18:42:59.000000000 +0000 @@ -36,4 +36,4 @@ This program is part of FAI (Fully Automatic Installation). See the FAI manual for more information on how to use fai-monitor. The FAI homepage is https://fai-project.org. .SH AUTHOR -Thomas Lange +Thomas Lange diff -Nru fai-5.10.3/man/fai-setup.8 fai-6.0.3+deb12u1/man/fai-setup.8 --- fai-5.10.3/man/fai-setup.8 2019-10-17 01:08:18.000000000 +0000 +++ fai-6.0.3+deb12u1/man/fai-setup.8 2022-10-28 18:42:59.000000000 +0000 @@ -86,4 +86,4 @@ to this file. .SH AUTHOR -Thomas Lange +Thomas Lange diff -Nru fai-5.10.3/man/fai-statoverride.8 fai-6.0.3+deb12u1/man/fai-statoverride.8 --- fai-5.10.3/man/fai-statoverride.8 2012-05-02 21:00:18.000000000 +0000 +++ fai-6.0.3+deb12u1/man/fai-statoverride.8 2022-10-28 18:42:59.000000000 +0000 @@ -16,4 +16,4 @@ .br This program is part of FAI (Fully Automatic Installation). .SH AUTHOR -Thomas Lange +Thomas Lange diff -Nru fai-5.10.3/man/fai.8 fai-6.0.3+deb12u1/man/fai.8 --- fai-5.10.3/man/fai.8 2019-10-17 01:08:18.000000000 +0000 +++ fai-6.0.3+deb12u1/man/fai.8 2022-10-28 18:42:59.000000000 +0000 @@ -168,4 +168,4 @@ .SH AUTHOR This manual page was written by Henning Glawe - and Thomas Lange . + and Thomas Lange . diff -Nru fai-5.10.3/man/fai.conf.5 fai-6.0.3+deb12u1/man/fai.conf.5 --- fai-5.10.3/man/fai.conf.5 2021-04-14 13:02:27.000000000 +0000 +++ fai-6.0.3+deb12u1/man/fai.conf.5 2022-10-28 18:42:59.000000000 +0000 @@ -103,8 +103,14 @@ .BR FAI_LOGPROTO (see below) to store the generated log files and to change the network boot configuration of the target host. -To fully enable this, configure .rhosts and PAM such that the configured user -can log in from all install clients without password. +By default calling fai-setup(8) will set up ssh access for +\fBLOGUSER\fP so the install client can save the log files onto the +server. + +This will not be passed onto the fai clients. To enable this on the +fai clients check /srv/fai/config/class/FAIBASE.var to activate the +transfer of logfiles to the server. + This account should have write permissions for /srv/tftp/fai. For example, you can use write permissions for the group linuxadm. chgrp linuxadm /srv/tftp/fai;chmod g+w /srv/tftp/fai. diff -Nru fai-5.10.3/man/fcopy.8 fai-6.0.3+deb12u1/man/fcopy.8 --- fai-5.10.3/man/fcopy.8 2021-04-14 13:02:27.000000000 +0000 +++ fai-6.0.3+deb12u1/man/fcopy.8 2022-10-28 18:42:59.000000000 +0000 @@ -107,8 +107,8 @@ Look for SOURCE files relative to \fIsource_dir\fR. Use $FAI/files if not specified. .TP -.BI "\-S " -Enable variable substitution. Every occurence of the pattern {%varname%} +.BI "\-S " +Enable variable substitution. Every occurrence of the pattern {%varname%} will be substituted by the value of the shell variable $varname which is mostly set in class/CLASSNAME.var. You can enable it for all calls of fcopy by setting the environment variable $FCOPY_SUBSTITUTE. Variable @@ -229,6 +229,6 @@ for more information on how to use fcopy. The FAI homepage is https://fai-project.org. .SH AUTHOR -Thomas Lange +Thomas Lange .br Henning Glawe diff -Nru fai-5.10.3/man/ftar.8 fai-6.0.3+deb12u1/man/ftar.8 --- fai-5.10.3/man/ftar.8 2018-01-19 13:00:17.000000000 +0000 +++ fai-6.0.3+deb12u1/man/ftar.8 2022-10-28 18:42:59.000000000 +0000 @@ -106,4 +106,4 @@ for more information on how to use ftar. The FAI homepage is https://fai-project.org. .SH AUTHOR -Thomas Lange +Thomas Lange diff -Nru fai-5.10.3/man/install_packages.8 fai-6.0.3+deb12u1/man/install_packages.8 --- fai-5.10.3/man/install_packages.8 2019-10-17 01:08:18.000000000 +0000 +++ fai-6.0.3+deb12u1/man/install_packages.8 2022-10-28 18:42:59.000000000 +0000 @@ -110,4 +110,4 @@ The FAI package configuration directory. .SH AUTHOR -Thomas Lange +Thomas Lange diff -Nru fai-5.10.3/man/nfsroot.conf.5 fai-6.0.3+deb12u1/man/nfsroot.conf.5 --- fai-5.10.3/man/nfsroot.conf.5 2021-05-01 20:23:53.000000000 +0000 +++ fai-6.0.3+deb12u1/man/nfsroot.conf.5 2022-10-28 18:42:59.000000000 +0000 @@ -1,5 +1,5 @@ .\" Hey, EMACS: -*- nroff -*- -.TH nfsroot.conf 5 "January 2014" "FAI 5.0" +.TH nfsroot.conf 5 "September 2022" "FAI 6.0" .\" Please adjust this date whenever revising the manpage. .SH NAME @@ -17,11 +17,12 @@ .SH VARIABLES .TP .B FAI_DEBOOTSTRAP -Two parameters for debootstrap(8), space separated. Debootstrap is +Two or three parameters for debootstrap(8), space separated. Debootstrap is called as the first part of fai-make-nfsroot unless -B is used. This variable defines -SUITE and MIRROR for debootstrap. Example: +SUITE and MIRROR for debootstrap. The third parameter is +the name of the bootstrap script variant to use. Example: -FAI_DEBOOTSTRAP="stretch http://deb.debian.org/debian" +FAI_DEBOOTSTRAP="bullseye http://deb.debian.org/debian" .TP .B NFSROOT_ETC_HOSTS @@ -106,4 +107,4 @@ homepage is https://fai-project.org. .SH AUTHOR -This man page was written by Thomas Lange . +This man page was written by Thomas Lange . diff -Nru fai-5.10.3/man/setup-storage.8 fai-6.0.3+deb12u1/man/setup-storage.8 --- fai-5.10.3/man/setup-storage.8 2021-05-22 15:45:06.000000000 +0000 +++ fai-6.0.3+deb12u1/man/setup-storage.8 2022-10-28 18:42:59.000000000 +0000 @@ -1,4 +1,4 @@ -.TH setup-storage 8 "Sep 18, 2017" "Debian GNU/Linux" +.TH setup-storage 8 "May, 2021" "FAI 6" .SH NAME \fBsetup-storage\fP \- automatically prepare storage devices @@ -162,96 +162,83 @@ If encryption was configured, a proper \fBcrypttab\fP(5) file plus key files will be generated. + +The output of setup-storage is also written to the log file format.log. + .SH EXAMPLES \fBsetup-storage\fP configures storage devices according to a FAI disk_config file. The full grammar describing the syntax of these disk_config files is -given below. First we show a number of examples to give an intuition what these +given below. The syntax is similar to the structure of an fstab file. +First we show a number of examples to give an intuition what these should look like. -.TP -Simple configuration of /dev/hda +.TP 3m +Simple configuration of /dev/sda .sp .nf -.ta 10n 20n 30n 40n 50n -disk_config hda preserve_always:6,7 disklabel:msdos bootable:3 +.ta 8n +8n +7n +5n +5n +5n +disk_config disk1 disklabel:msdos bootable:3 -primary /boot 20-100 ext3 rw -primary swap 1000 swap sw -primary / 12000 ext3 rw createopts="\-b 2048" -logical /tmp 1000 ext3 rw,nosuid -logical /usr 5000 ext3 rw -logical /var 10%- ext3 rw -logical /nobackup 0- xfs rw +primary /boot 20-100 ext4 rw +primary swap 1G swap sw +primary / 12G ext4 rw,noatime +logical /backup 10%- xfs rw .sp .fi .PP .IP \(bu -Preserve /dev/hda6 and /dev/hda7. The disklabel is msdos which is the default -for x86. Furthermore, partition /dev/hda3 is made bootable. -.IP \(bu -Create a primary partition /dev/hda1 with a size between 20 and 100 MiB and mount it -read-write as /boot; it is formatted using ext3 filesystem. -.IP \(bu -/dev/hda2 will be a swap space of 1000 MiB +The first disk found is going to be partitioned. FAI looks into +/proc/partitions and sets the variable \fIdisklist\fP. +The disklabel is msdos which is the default +for x86. Let's assume /dev/sda is the first disk. Then partition /dev/sda3 is made bootable. .IP \(bu -/dev/hda3 should be formatted using ext3 filesystem; when calling mkfs.ext3 -the option "\-b 2048" is appended. +Create a primary partition /dev/sda1 with a size between 20 and 100 MiB and mount it +read-write as /boot; it is formatted using ext4 filesystem. .IP \(bu -Create the logical partition /dev/hda5 +/dev/sda2 will be a swap space of 1 GiB .IP \(bu -Make /dev/hda7 at least 10% of the disk size +/dev/sda3 should be formatted using ext4 filesystem .IP \(bu -Use mkfs.xfs to format the partition 8 +Create the logical partition /dev/sda5 (because the first logical +partition will always become number 5) +Make it at least 10% of the disk size. +Use mkfs.xfs to format this partition. -.TP -Create a softRAID -.TS -tab(@) nospaces; -l s s s s -l l r l l. +.TP 3m +Create a software RAID +.sp +.nf +.ta 10n +5n +10n +4n +4n +4n disk_config sda -primary @ - @ 20GiB @ - @ - -primary @ - @ 4GiB @ - @ - +primary - 20G - - +primary - 4G - - -.T& -l s s s s. -disk_config sdb -.T& -l l r l l. -primary @ - @ 20GiB @ - @ - -primary @ - @ 4GiB @ - @ - +disk_config sdb sameas: sda -.T& -l s s s s. disk_config raid -.T& -l l l l l. -raid1 @ / @ sda1,sdb1 @ ext3 @ rw -raid1 @ swap @ sda2,sdb2 @ swap @ sw -.TE +raid1 / sda1,sdb1 ext4 rw +raid1 swap sda2,sdb2 swap sw .sp .fi .PP .IP \(bu Create 2 partitions of size 20 and 4 GiB, respectively, on disks /dev/sda and -/dev/sdb. No file system or fstab entry will be created. +/dev/sdb. No file system or fstab entry will be created. on these partitions. .IP \(bu -Create a RAID-1 on /dev/sda1 and /dev/sdb1, format using mkfs.ext3 and mount +Create a RAID-1 on /dev/sda1 and /dev/sdb1, format using mkfs.ext4 and mount it as / .IP \(bu Create a RAID-1 on /dev/sda2 and /dev/sdd2, prepare as swap space and use it as such later on. -.TP +.TP 3m Advanced softRAID features -.TS -tab(@) nospaces; -l s s s s -l l l l l. +.sp +.nf +.ta 7n 12n 23n 27n 37n disk_config raid -raid1 @ / @ sda1,sdd1 @ ext2 @ rw,errors=remount-ro -raid0 @ - @ disk2.2,sdc1,sde1:spare:missing @ ext2 @ default -.TE +raid1 / sda1,sdd1 ext4 rw,errors=remount-ro +raid0 - disk2.2,sdc1,sde1:spare:missing ext4 default .sp .fi .PP @@ -267,19 +254,19 @@ configuration shown in the first example. They may also already be properly set up and hence the configuration can be left out. -.TP +.TP 3m Simple LVM example .sp .nf -.ta 15n 22n 30n 40n -disk_config sda bootable:1 -primary /boot 500 ext3 rw -primary - 4096- - - +.ta 7n +7n +7n +10n +10n +10n +disk_config sda bootable:1 +primary /boot 500 ext4 rw +primary - 4096- - - disk_config lvm -vg my_pv sda2 -my_pv_swap swap 2048 swap sw -my_pv_root / 2048 ext3 rw +vg my_pv sda2 +my_pv_swap swap 2048 swap sw +my_pv_root / 2048 ext4 rw .sp .fi .PP @@ -294,24 +281,24 @@ LVM on software RAID .sp .nf -.ta 18n 28n 38n 45n 55n +.ta 12n +6n +8n +8n +8n disk_config disk1 -primary - 350 - - -primary swap 2G swap sw,pri=1 -primary - 0- - - +primary - 350 - - +primary swap 2G swap sw,pri=1 +primary - 0- - - -disk_config sdb sameas:disk1 +disk_config disk2 sameas:disk1 disk_config raid fstabkey:uuid -raid1 /boot disk1.1,disk2.1 ext4 rw,noatime,errors=remount-ro -raid1 - disk1.3,disk2.3 - - +raid1 /boot disk1.1,disk2.1 ext4 rw,noatime,errors=remount-ro +raid1 - disk1.3,disk2.3 - - disk_config lvm fstabkey:uuid -vg vg_system md1 -vg_system-root / 8G ext4 rw,noatime -vg_system-var /var 20G ext4 rw,noatime -vg_system-home /home 10G ext4 rw,noatime,nosuid,nodev -vg_system-tmp /tmp 30G ext4 rw,noatime,nosuid,nodev +vg vg_system md1 +vg_system-root / 8G ext4 rw,noatime +vg_system-var /var 20G ext4 rw,noatime +vg_system-home /home 10G ext4 rw,noatime,nosuid,nodev +vg_system-tmp /tmp 30G ext4 rw,noatime,nosuid,nodev .sp .fi .PP @@ -334,16 +321,16 @@ .nf .ta 10n 20n 30n 40n 50n disk_config /dev/sdb -primary / 21750 ext3 defaults,errors=remount-ro -primary /boot 250 ext3 defaults -logical - 4000 - - -logical - 2000 - - -logical - 10- - - +primary / 21750 ext4 defaults,errors=remount-ro +primary /boot 250 ext4 defaults +logical - 4000 - - +logical - 2000 - - +logical - 10- - - disk_config cryptsetup -swap swap /dev/sdb5 swap defaults -tmp /tmp /dev/sdb6 ext2 defaults -luks /local00 /dev/sdb7 ext3 defaults,errors=remount-ro createopts="\-m 0" +swap swap /dev/sdb5 swap defaults +tmp /tmp /dev/sdb6 ext2 defaults +luks /local00 /dev/sdb7 ext4 defaults,errors=remount-ro createopts="\-m 0" .sp .fi .PP @@ -369,9 +356,9 @@ .sp .nf -.ta 10n 20n 30n 40n 50n +.ta 7n +7n +7n +7n disk_config cryptsetup -luks - /dev/md1 - - +luks - /dev/md1 - - .sp .fi .PP @@ -383,14 +370,14 @@ .ta 10n 20n 30n 40n 50n disk_config disk1 disklabel:gpt bootable:1 fstabkey:uuid align-at:1M -primary - 100% - - +primary - 100% - - disk_config cryptsetup -luks:"passwd" - disk1.1 - - +luks:"passwd" - disk1.1 - - disk_config lvm fstabkey:uuid -vg vg1 disk1.1 -vg1-root / 30%- ext4 defaults,errors=remount-ro,noatime,rw +vg vg1 disk1.1 +vg1-root / 30%- ext4 defaults,errors=remount-ro,noatime,rw .sp .fi .PP @@ -401,8 +388,9 @@ .nf .ta 10n 20n 30n 40n 50n disk_config tmpfs -tmpfs /tmp RAM:20% defaults -tmpfs /scratch 3GiB defaults +tmpfs /tmp RAM:20% defaults +tmpfs /scratch 3GiB defaults +tmpfs /scratch2 - defaults .sp .fi .PP @@ -412,6 +400,8 @@ options. .IP \(bu Mount a tmpfs on /scratch with a maximum size of 3 GiB. +.IP \(bu +Mount a tmpfs on /scratch2, use the system default size for this tmpfs. .TP nfs example @@ -433,18 +423,18 @@ .nf .ta 10n 20n 30n 40n 50n disk_config disk1 -primary /boot 500 ext4 rw -primary - 2G- - - +primary /boot 500 ext4 rw +primary - 2G- - - disk_config disk2 -primary - 2G- - - +primary - 2G- - - disk_config disk3 sameas:disk2 disk_config disk4 sameas:disk2 disk_config btrfs fstabkey:uuid -btrfs raid1 / disk1.2,disk2.1 noatime,subvol=@/ -btrfs raid1 /home disk3.1,disk4.1 subvol=@home,noatime +btrfs raid1 / disk1.2,disk2.1 noatime,subvol=@/ +btrfs raid1 /home disk3.1,disk4.1 subvol=@home,noatime .sp .fi .PP @@ -470,17 +460,17 @@ .nf .ta 10n 20n 30n 40n 60n disk_config /dev/sda fstabkey:uuid bootable:2 -primary / 20GiB ext3 defaults -primary /boot 250 ext2 defaults -primary swap 4GiB swap defaults -logical - 256 ext3_journal - -logical - 256 ext4_journal - -logical - 256 xfs_journal - +primary / 20GiB ext3 defaults +primary /boot 250 ext2 defaults +primary swap 4GiB swap defaults +logical - 256 ext3_journal - +logical - 256 ext4_journal - +logical - 256 xfs_journal - disk_config /dev/sdb fstabkey:uuid -primary /mnt/ext3 33% ext3:journal=/dev/sda5 defaults -primary /mnt/ext4 33% ext4:journal=/dev/sda6 defaults -primary /mnt/xfs 33% xfs:journal=/dev/sda7 defaults +primary /mnt/ext3 33% ext3:journal=/dev/sda5 defaults +primary /mnt/ext4 33% ext4:journal=/dev/sda6 defaults +primary /mnt/xfs 33% xfs:journal=/dev/sda7 defaults .sp .fi .PP @@ -496,17 +486,22 @@ .sp .nf .ta 10n 20n 30n 40n 60n -disk_config disk1 disklabel:gpt fstabkey:uuid bootable:1 -primary /boot/efi 200 vfat rw -primary / 1G- ext4 rw +disk_config disk1 disklabel:gpt fstabkey:partlabel bootable:1 +p=efi /boot/efi 200 vfat rw +p=root / 1G-20G ext4 rw +p= /data 1G- ext4 rw .sp .fi .PP .IP \(bu -Creating a ESP partition is very simple. Use a GPT partition table, -create a vfat partition which is also bootable. That's it. - - +Creating a ESP partition for UEFI boot is very simple. Use a GPT partition table, +create a vfat partition for /boot/efi which is also bootable. That's it. +A name after p= is used as the partition label. Remember that GPT does +not use logical partition. Just use p= for each partition. +The fstab entries will use the partition labels if defined. Otherwise +it will fall back to the file system UUID or the device name. +Setting fstabkey:partuuid will use the UUID of the partition (not the +UUID of the file system) for the fstab entries. .SH SYNTAX This section describes the syntax of disk_config files @@ -544,9 +539,9 @@ .br | disk_config [^[:space:]]+(