From 7ade5e2c6113530c5f99cfc95880897fcb479f39 Mon Sep 17 00:00:00 2001 From: Ian Kelling Date: Tue, 24 Nov 2020 14:05:20 -0500 Subject: [PATCH] update to 31b795ca71189b326b80666076398f31aea4f2be --- fai/config/basefiles/mk-basefile | 22 ++++++--- fai/config/class/40-parse-profiles.sh | 4 +- fai/config/class/50-host-classes | 5 +- fai/config/class/85-efi-classes | 17 +++++++ fai/config/class/UBUNTU.var | 2 +- fai/config/class/example.profile | 14 +++--- fai/config/disk_config/CENTOS | 1 - fai/config/disk_config/FAIBASE_EFI | 10 ++++ fai/config/disk_config/FAISERVER_EFI | 12 +++++ fai/config/disk_config/LVM_EFI | 16 ++++++ fai/config/disk_config/XENIAL_EFI | 13 +++++ fai/config/files/etc/rc.local/FAISERVER | 6 ++- fai/config/hooks/mountdisks.DEFAULT | 9 ---- fai/config/hooks/savelog.LAST.sh | 7 +++ fai/config/hooks/updatebase.CENTOS | 11 +++++ fai/config/hooks/updatebase.UBUNTU | 20 ++++++++ fai/config/package_config/CENTOS | 31 ++++++------ fai/config/scripts/CENTOS/10-security | 4 +- fai/config/scripts/CENTOS/30-mkinitrd | 49 ++----------------- fai/config/scripts/CENTOS/40-install-grub | 8 +-- fai/config/scripts/CENTOS/60-network-scripts | 46 ++++++++++------- fai/config/scripts/DEBIAN/30-interface | 11 ++++- fai/config/scripts/DEBIAN/40-misc | 2 +- fai/config/scripts/FAIBASE/10-misc | 13 ++--- fai/config/scripts/FAIBASE/20-removable_media | 4 +- fai/config/scripts/GRUB_EFI/10-setup | 2 +- fai/config/scripts/GRUB_PC/10-setup | 2 +- fai/config/scripts/LAST/50-misc | 4 +- fai/config/scripts/UBUNTU/90-apt | 9 ---- 29 files changed, 211 insertions(+), 143 deletions(-) create mode 100755 fai/config/class/85-efi-classes create mode 100644 fai/config/disk_config/FAIBASE_EFI create mode 100644 fai/config/disk_config/FAISERVER_EFI create mode 100644 fai/config/disk_config/LVM_EFI create mode 100644 fai/config/disk_config/XENIAL_EFI delete mode 100755 fai/config/hooks/mountdisks.DEFAULT diff --git a/fai/config/basefiles/mk-basefile b/fai/config/basefiles/mk-basefile index deb12d4..be00fe2 100755 --- a/fai/config/basefiles/mk-basefile +++ b/fai/config/basefiles/mk-basefile @@ -2,7 +2,7 @@ # mk-basefile, create basefiles for some distributions # -# Thomas Lange, Uni Koeln, 2011-2018 +# Thomas Lange, Uni Koeln, 2011-2020 # based on the Makefile implementation of Michael Goetze # # Usage example: mk-basefile -J STRETCH64 @@ -11,7 +11,7 @@ # Supported distributions (each i386/amd64): # Debian GNU/Linux # Ubuntu 14.04/16.04 -# CentOS 5/6/7 +# CentOS 5/6/7/8 # Scientific Linux Cern 5/6 # # Packages you might want to install to use this command: @@ -29,11 +29,13 @@ EXCLUDE_WHEEZY=info EXCLUDE_JESSIE=info EXCLUDE_STRETCH=info EXCLUDE_BUSTER= +EXCLUDE_BULLSEYE= 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 # here you can add packages, that are needed very early INCLUDE_DEBIAN= @@ -49,7 +51,7 @@ setarch() { check() { - if [ `id -u` != 0 ]; then + if [ $(id -u) != 0 ]; then echo "You must be root to create chroots." exit 1 fi @@ -130,7 +132,7 @@ cleanup-rinse() { tarit() { - tar $attributes --one-file-system -C $xtmp -cf - . | $zip > $target.$ext + tar $attributes --numeric-owner --one-file-system -C $xtmp -cf - . | $zip > $target.$ext } @@ -204,17 +206,20 @@ prtdists() { CENTOS5_32 CENTOS5_64 CENTOS6_32 CENTOS6_64 CENTOS7_32 CENTOS7_64 + CENTOS8_64 SLC5_32 SLC5_64 SLC6_32 SLC6_64 SLC7_64 TRUSTY32 TRUSTY64 XENIAL32 XENIAL64 BIONIC64 + FOCAL64 SQUEEZE32 SQUEEZE64 WHEEZY32 WHEEZY64 JESSIE32 JESSIE64 STRETCH32 STRETCH64 BUSTER32 BUSTER64 + BULLSEYE32 BULLSEYE64 SID32 SID64 " } @@ -224,7 +229,7 @@ usage() { cat </dev/null` -tempfile2=`(tempfile) 2>/dev/null` +tempfile=$(mktemp) +tempfile2=$(mktemp) trap "rm -f $tempfile $tempfile2" EXIT INT QUIT # declare the data structure, use associative arrays diff --git a/fai/config/class/50-host-classes b/fai/config/class/50-host-classes index f0ba873..df38b88 100755 --- a/fai/config/class/50-host-classes +++ b/fai/config/class/50-host-classes @@ -15,10 +15,11 @@ case $HOSTNAME in echo "FAIBASE DEBIAN DEMO XORG XFCE LVM";; 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 I386 && echo CENTOS6_32 # AFAIK there's no 32bit C7 - ifclass AMD64 && echo CENTOS7_64 + ifclass AMD64 && echo CENTOS8_64 ;; slchost) # Scientific Linux Cern, is very similar to CentOS. SLC should alsways use the class CENTOS diff --git a/fai/config/class/85-efi-classes b/fai/config/class/85-efi-classes new file mode 100755 index 0000000..ee2f04b --- /dev/null +++ b/fai/config/class/85-efi-classes @@ -0,0 +1,17 @@ +#! /bin/bash + +# define classes for disk_config in an EFI enironment + +if [ ! -d /sys/firmware/efi ]; then + exit 0 +fi + +if ifclass FAIBASE; then + echo FAIBASE_EFI +elif ifclass FAISERVER; then + echo FAISERVER_EFI +elif ifclass LVM; then + echo LVM_EFI +elif ifclass XENIAL; then + echo XENIAL_EFI +fi diff --git a/fai/config/class/UBUNTU.var b/fai/config/class/UBUNTU.var index 5948df4..a258b6a 100644 --- a/fai/config/class/UBUNTU.var +++ b/fai/config/class/UBUNTU.var @@ -1,2 +1,2 @@ ubuntumirror=http://archive.ubuntu.com -ubuntudist=bionic +ubuntudist=focal diff --git a/fai/config/class/example.profile b/fai/config/class/example.profile index 70a940e..5dc8f3e 100644 --- a/fai/config/class/example.profile +++ b/fai/config/class/example.profile @@ -25,21 +25,21 @@ You should have a fast network connection, because most packages are downloaded from the internet. Classes: INSTALL FAIBASE DEBIAN DEMO XORG GNOME -Name: CentOS 7 -Description: CentOS 7 with Xfce desktop -Short: A normal Xfce desktop, running CentOS 7 -Long: We use the Debian nfsroot for installing the CentOS 7 OS. +Name: CentOS 8 +Description: CentOS 8 with Xfce desktop +Short: A normal Xfce desktop, running CentOS 8 +Long: We use the Debian nfsroot for installing the CentOS 8 OS. You should have a fast network connection, because most packages are downloaded from the internet. -Classes: INSTALL FAIBASE CENTOS CENTOS7_64 XORG +Classes: INSTALL FAIBASE CENTOS CENTOS8_64 XORG Name: Ubuntu -Description: Ubuntu 18.04 desktop installation +Description: Ubuntu 20.04 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 BIONIC BIONIC64 XORG +Classes: INSTALL FAIBASE DEMO DEBIAN UBUNTU FOCAL FOCAL64 XORG Name: Inventory Description: Show hardware info diff --git a/fai/config/disk_config/CENTOS b/fai/config/disk_config/CENTOS index 3b5ef36..9c3c933 100644 --- a/fai/config/disk_config/CENTOS +++ b/fai/config/disk_config/CENTOS @@ -13,5 +13,4 @@ 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 /tmp 100-5G ext4 rw,noatime,nosuid,nodev createopts="-L TMP -m 0" tuneopts="-c 0 -i 0" logical /home 100- ext4 rw,noatime,nosuid,nodev createopts="-L HOME -m 1" tuneopts="-c 0 -i 0" diff --git a/fai/config/disk_config/FAIBASE_EFI b/fai/config/disk_config/FAIBASE_EFI new file mode 100644 index 0000000..8ff0e4b --- /dev/null +++ b/fai/config/disk_config/FAIBASE_EFI @@ -0,0 +1,10 @@ +# example of new config file for setup-storage +# +# + +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" diff --git a/fai/config/disk_config/FAISERVER_EFI b/fai/config/disk_config/FAISERVER_EFI new file mode 100644 index 0000000..30adbe3 --- /dev/null +++ b/fai/config/disk_config/FAISERVER_EFI @@ -0,0 +1,12 @@ +# config file for an FAI install server +# +# + +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" diff --git a/fai/config/disk_config/LVM_EFI b/fai/config/disk_config/LVM_EFI new file mode 100644 index 0000000..b2609a5 --- /dev/null +++ b/fai/config/disk_config/LVM_EFI @@ -0,0 +1,16 @@ +# + +# 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- - - + +disk_config lvm + +vg vg1 disk1.3 +vg1-root / 3G-50G ext4 noatime,rw +vg1-swap swap 200-4G swap sw +vg1-home /home 600- ext4 noatime,nosuid,nodev,rw diff --git a/fai/config/disk_config/XENIAL_EFI b/fai/config/disk_config/XENIAL_EFI new file mode 100644 index 0000000..d72f130 --- /dev/null +++ b/fai/config/disk_config/XENIAL_EFI @@ -0,0 +1,13 @@ +# example of new config file for setup-storage +# +# + +# this is a copy of FAIBASE, but with metadata_csum disabled. +# Ubuntu XENIAL does not yet suport this option + +disk_config disk1 disklabel:gpt bootable:1 fstabkey:uuid + +primary /boot/efi 512M vfat rw +primary / 2G-50G ext4 rw,noatime,errors=remount-ro createopts="-O ^metadata_csum" +primary swap 200-1G swap sw +primary /home 100- ext4 rw,noatime,nosuid,nodev createopts="-L home -m 1 -O ^metadata_csum" tuneopts="-c 0 -i 0" diff --git a/fai/config/files/etc/rc.local/FAISERVER b/fai/config/files/etc/rc.local/FAISERVER index e70fae9..fddf54a 100755 --- a/fai/config/files/etc/rc.local/FAISERVER +++ b/fai/config/files/etc/rc.local/FAISERVER @@ -10,8 +10,10 @@ GREEN='\E[32m' set -o pipefail # setup network -nic=$(awk '/iface/ {print $2}' /etc/network/interfaces |egrep -v ^lo) -ifup $nic +nic=$(cat /etc/network/interfaces /etc/network/interfaces.d/* 2>/dev/null | awk '$1 == "iface" && $2 != "lo" {print $2; exit}') +if [ -n "$nic" ]; then + ifup $nic +fi # regenerate ssh_host keys ls /etc/ssh/ssh_host_* > /dev/null if [ $? -ne 0 ]; then diff --git a/fai/config/hooks/mountdisks.DEFAULT b/fai/config/hooks/mountdisks.DEFAULT deleted file mode 100755 index 95e6a2b..0000000 --- a/fai/config/hooks/mountdisks.DEFAULT +++ /dev/null @@ -1,9 +0,0 @@ -#! /bin/bash - -# stop resync of soft raid -if [ $do_init_tasks -eq 1 ]; then - if grep -q active /proc/mdstat 2>/dev/null; then - echo "frozen" | tee /sys/block/md*/md/sync_action >/dev/null - fi -fi -exit 0 diff --git a/fai/config/hooks/savelog.LAST.sh b/fai/config/hooks/savelog.LAST.sh index c1724f5..7af0d33 100755 --- a/fai/config/hooks/savelog.LAST.sh +++ b/fai/config/hooks/savelog.LAST.sh @@ -64,6 +64,7 @@ libclass-errorhandler-perl zope-ploneerrorreporting libroxen-errormessage liberror-perl +perl-Error libgpg-error-dev libgpg-error0 Opts:.\+errors=remount @@ -167,6 +168,7 @@ errors: 0 Memory Error Correction: Memory Controller 0 - Channel . Error IIO RAS/Control Status/Global Errors +RAS: Correctable Errors collector initialized __stack_chk_fail grub.cfg.new: Directory nonexistent can't derive routing for PCI INT A @@ -176,6 +178,11 @@ Loading user firmware failed, using default values stunnel4 you specified can't be accessed: No such file or directory install-docs --verbose --check file_name' may give more details about the above errors cannot open '/etc/ssl/certs/java/cacerts' for reading: No such file or directory +can't claim BAR +disabling ASPM +data block query control method not found +subprocess.py.\+RuntimeWarning: line buffering +Resource conflict.\+ found update-rc.d: warning: start and stop actions are no longer supported" # add pattern on some conditions diff --git a/fai/config/hooks/updatebase.CENTOS b/fai/config/hooks/updatebase.CENTOS index a315b96..dd418d8 100755 --- a/fai/config/hooks/updatebase.CENTOS +++ b/fai/config/hooks/updatebase.CENTOS @@ -11,4 +11,15 @@ else $ROOTCMD yum -y update >> $LOGDIR/software.log fi +$ROOTCMD systemd-machine-id-setup + +cat > $target/etc/sysconfig/kernel < /var/lib/locales/supported.d/local' && + $ROOTCMD dpkg-reconfigure locales +fi diff --git a/fai/config/package_config/CENTOS b/fai/config/package_config/CENTOS index a4ea3e0..86b2c61 100644 --- a/fai/config/package_config/CENTOS +++ b/fai/config/package_config/CENTOS @@ -1,16 +1,20 @@ -PACKAGES yumgroup +PACKAGES dnfgroup core +minimal-environment +#server-product-environment +#headless-management -PACKAGES yumgroup XORG -#gnome-desktop base-x # slc5/CentOS 5 -#basic-desktop x11 fonts #slc6/CentOS 6 -gnome-desktop # CentOS 7 +PACKAGES dnfgroup XORG +graphical-server-environment +workstation-product-environment -PACKAGES yumi -authconfig +PACKAGES dnfi +NetworkManager +chrony kernel -# sysvinit-tools grub # CentOS 5 and 6 -grub2 # CentOS 7 +dracut +grub2-pc +# CentOS 7 less openssh openssh-clients @@ -18,14 +22,9 @@ openssh-server vim-enhanced man curl -screen unzip which -nfs-utils -pakchois -ncurses-base # currently missing in the base file +ncurses ncurses-base -#sendmail # only for C5 and C6 - -PACKAGES yumi LVM +PACKAGES dnfi LVM lvm2 diff --git a/fai/config/scripts/CENTOS/10-security b/fai/config/scripts/CENTOS/10-security index ecf1c23..566c3f4 100755 --- a/fai/config/scripts/CENTOS/10-security +++ b/fai/config/scripts/CENTOS/10-security @@ -1,12 +1,10 @@ #! /bin/bash # (c) Michael Goetze, 2010-11, mgoetze@mgoetze.net -# Thomas Lange, 2015 +# Thomas Lange, 2015-2020 error=0; trap 'error=$(($?>$error?$?:$error))' ERR # save maximum error code -$ROOTCMD authconfig --enableshadow --enablemd5 \ - --enablelocauthorize --updateall $ROOTCMD usermod -p $ROOTPW root fcopy -v /etc/selinux/config diff --git a/fai/config/scripts/CENTOS/30-mkinitrd b/fai/config/scripts/CENTOS/30-mkinitrd index cd114f9..f7564d4 100755 --- a/fai/config/scripts/CENTOS/30-mkinitrd +++ b/fai/config/scripts/CENTOS/30-mkinitrd @@ -8,57 +8,18 @@ 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-` +version=$($ROOTCMD rpm -qv kernel | cut -d- -f2-) -use_mkinitrd() { - - # CentOS 5 uses mkinitrd - $ROOTCMD kudzu -q -k $version - # Unfortunately mkinitrd is horrible at guessing which modules to include, - # especially when the running kernel is different than the kernel for which - # we are creating an initrd... - - drivers="" - for bus in pci virtio; do - for dr in `$ROOTCMD kudzu -p -k $version -b $bus|grep driver:|cut -d' ' -f2|sort -u`; do - found=`find $target/lib/modules/$version/ -name $dr.ko 2>/dev/null` - if [ -n "$found" ]; then - # add driver only if it's available as .ko module in the destination kernel - drivers+=" --with=$dr" - fi - done - done - - $ROOTCMD mkinitrd -f -v $drivers /boot/initrd-$version.img $version - - if [ $? -eq 1 ]; then - echo "WARNING: generating initrd with list of drivers failed. Trying without." - $ROOTCMD mkinitrd -f -v /boot/initrd-$version.img $version - fi -} - -# CentOS 5 uses mkinitrd -if [ -f $target/sbin/mkinitrd ]; then - use_mkinitrd -fi 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 -# call dracut for CentOS 7 -if [ -f $target/usr/sbin/dracut ]; then - # add filesystem driver into initrd - ainsl -av /etc/dracut.conf.d/fai.conf 'filesystems+="ext4"' - $ROOTCMD dracut -v --kver $version --force -fi -# call dracut for CentOS 6 -if [ -f $target/sbin/dracut ]; then - # add filesystem driver into initrd - ainsl -av /etc/dracut.conf.d/fai.conf 'filesystems+="ext4"' - $ROOTCMD dracut -v $version -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 --git a/fai/config/scripts/CENTOS/40-install-grub b/fai/config/scripts/CENTOS/40-install-grub index 6af18f2..8a74b93 100755 --- a/fai/config/scripts/CENTOS/40-install-grub +++ b/fai/config/scripts/CENTOS/40-install-grub @@ -24,9 +24,9 @@ if [ -d $target/boot/grub2 -a ! -f $target/boot/grub2/device.map ]; then done fi -bootdev=`device2grub $BOOT_DEVICE` -bootpart=`device2grub $BOOT_PARTITION` -version=`$ROOTCMD rpm -qv kernel | cut -d- -f2-` +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='' @@ -69,7 +69,7 @@ else # CentOS 5 iname=initrd fi -title=`head -1 $target/etc/redhat-release` +title=$(head -1 $target/etc/redhat-release) cat > $target/boot/grub/grub.conf <<-EOF timeout 5 diff --git a/fai/config/scripts/CENTOS/60-network-scripts b/fai/config/scripts/CENTOS/60-network-scripts index a9f6d91..2542b9e 100755 --- a/fai/config/scripts/CENTOS/60-network-scripts +++ b/fai/config/scripts/CENTOS/60-network-scripts @@ -1,29 +1,37 @@ #! /bin/bash -# (c) Michael Goetze, 2011, mgoetze@mgoetze.net - error=0 ; trap "error=$((error|1))" ERR -# Note: Kudzu will automatically configure eth0 for DHCP -if [ $FAI_ACTION != "softupdate" ] && ! ifclass DHCPC -then - ainsl -v /etc/sysconfig/network "^GATEWAY=$GATEWAYS_1\$" - [ -n "$IPADDR" ] && cat > $target/etc/sysconfig/network-scripts/ifcfg-eth0 <<-EOF + +# 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 - DEVICE=eth0 - BOOTPROTO=static + 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 - HWADDR=`ip l sh dev eth0 | tail -1 | cut -d" " -f6` - IPADDR=$IPADDR - NETMASK=$NETMASK EOF - # Kudzu for some reason won't write eth0 into /etc/sysconfig/hwconf - # from within the chroot. The following hack puts it in there - # so that Kudzu doesn't overwrite our config on first boot. - if [ -f $target/sbin/kudzu ]; then - grep eth0 $target/etc/sysconfig/hwconf || $ROOTCMD kudzu -c NETWORK -p \ - >> $target/etc/sysconfig/hwconf - fi fi fcopy -iv /etc/sysconfig/network /etc/resolv.conf /etc/networks diff --git a/fai/config/scripts/DEBIAN/30-interface b/fai/config/scripts/DEBIAN/30-interface index 34c98e8..bff6863 100755 --- a/fai/config/scripts/DEBIAN/30-interface +++ b/fai/config/scripts/DEBIAN/30-interface @@ -49,6 +49,7 @@ iface_stanza() { newnicnames() { # determine predictable network names only for stretch and above + local name [ $do_init_tasks -eq 0 ] && return [ -z "$NIC1" ] && return @@ -63,10 +64,16 @@ newnicnames() { name=$(udevadm info /sys/class/net/$NIC1 | sed -rn "s/^E: $field=(.+)/\1/p") if [[ $name ]]; then NIC1=$name - break + return fi done - if [[ ! $name ]]; then + + # try to get altname net dev + name=$(ip link show $NIC1 | awk '/altname / { print $2 }') + if [[ $name ]]; then + NIC1=$name + return + else echo "$0: error: could not find systemd predictable network name. Using $NIC1." fi } diff --git a/fai/config/scripts/DEBIAN/40-misc b/fai/config/scripts/DEBIAN/40-misc index 58a2920..714be55 100755 --- a/fai/config/scripts/DEBIAN/40-misc +++ b/fai/config/scripts/DEBIAN/40-misc @@ -33,7 +33,7 @@ if [ ! -f $target/etc/machine-id ]; then > $target/etc/machine-id fi # recreate machine-id if the file is empty -if [ X"$(stat -c '%s' $target/etc/machine-id 2>/dev/null)" = X0 -a -f /bin/systemd-machine-id-setup ]; then +if [ X"$(stat -c '%s' $target/etc/machine-id 2>/dev/null)" = X0 -a -f $target/bin/systemd-machine-id-setup ]; then $ROOTCMD systemd-machine-id-setup fi diff --git a/fai/config/scripts/FAIBASE/10-misc b/fai/config/scripts/FAIBASE/10-misc index fbf85c1..7a0599d 100755 --- a/fai/config/scripts/FAIBASE/10-misc +++ b/fai/config/scripts/FAIBASE/10-misc @@ -11,15 +11,14 @@ else cp -f /usr/share/zoneinfo/${TIMEZONE} $target/etc/localtime fi +if [ -f $target/etc/hosts.orig ]; then + mv $target/etc/hosts.orig $target/etc/hosts +fi if [ -n "$IPADDR" ]; then ifclass DHCPC || ainsl -s /etc/hosts "$IPADDR $HOSTNAME.$DOMAIN $HOSTNAME" else ifclass DHCPC && ainsl -s /etc/hosts "127.0.0.1 $HOSTNAME" fi - -if [ -f $target/etc/hosts.orig ]; then - mv $target/etc/hosts.orig $target/etc/hosts -fi fcopy -iM /etc/hosts /etc/motd # make /root accessible only by root @@ -28,8 +27,10 @@ chown -c root:root $target/root # copy default dotfiles for root account fcopy -ir /root -# use tmpfs for /tmp -ainsl /etc/fstab "tmpfs /tmp tmpfs nodev,nosuid,size=50%,mode=1777 0 0" +# use tmpfs for /tmp if not defined in disk_config +if ! grep -Pq '\s/tmp\s' $target/etc/fstab; then + ainsl /etc/fstab "tmpfs /tmp tmpfs nodev,nosuid,size=50%,mode=1777 0 0" +fi chmod -c 1777 ${target}/tmp chown -c 0:0 ${target}/tmp diff --git a/fai/config/scripts/FAIBASE/20-removable_media b/fai/config/scripts/FAIBASE/20-removable_media index 4ba258f..8d07029 100755 --- a/fai/config/scripts/FAIBASE/20-removable_media +++ b/fai/config/scripts/FAIBASE/20-removable_media @@ -3,8 +3,6 @@ # (c) Thomas Lange, 2006,2009, lange@debian.org # create entries for removable media in fstab and directories in /media -[ -b $target/dev/fd0 ] && ainsl /etc/fstab "/dev/fd0 /media/floppy auto users,noauto 0 0" - cdromlist() { [ -f /proc/sys/dev/cdrom/info ] || return devs=$(grep 'drive name:' /proc/sys/dev/cdrom/info | cut -d ":" -f 2) @@ -23,5 +21,5 @@ for cdrom in $(cdromlist | tac); do [ $i -eq 0 ] && ln -sfn cdrom0 $target/media/cdrom mkdir -p $target/media/cdrom$i fstabline /dev/$cdrom /media/cdrom$i udf,iso9660 ro,user,noauto 0 0 - i=$(($i + 1)) + i=$((i + 1)) done diff --git a/fai/config/scripts/GRUB_EFI/10-setup b/fai/config/scripts/GRUB_EFI/10-setup index f586ba1..fa8dd51 100755 --- a/fai/config/scripts/GRUB_EFI/10-setup +++ b/fai/config/scripts/GRUB_EFI/10-setup @@ -45,7 +45,7 @@ fi if [[ $BOOT_DEVICE =~ '/dev/md' ]]; then raiddev=${BOOT_DEVICE#/dev/} # install grub on all members of RAID - for device in `LC_ALL=C perl -ne 'if(/^'$raiddev'\s.+raid\d+\s(.+)/){ $_=$1; s/\d+\[\d+\]//g; print }' /proc/mdstat`; do + for device in $(LC_ALL=C perl -ne 'if(/^'$raiddev'\s.+raid\d+\s(.+)/){ $_=$1; s/\d+\[\d+\]//g; print }' /proc/mdstat); do echo Install grub on /dev/$device $ROOTCMD grub-install --no-floppy --force-extra-removable "/dev/$device" done diff --git a/fai/config/scripts/GRUB_PC/10-setup b/fai/config/scripts/GRUB_PC/10-setup index 5563275..cbff2d8 100755 --- a/fai/config/scripts/GRUB_PC/10-setup +++ b/fai/config/scripts/GRUB_PC/10-setup @@ -37,7 +37,7 @@ fi if [[ $BOOT_DEVICE =~ '/dev/md' ]]; then raiddev=${BOOT_DEVICE#/dev/} # install grub on all members of RAID - for device in `LC_ALL=C perl -ne 'if(/^'$raiddev'\s.+raid\d+\s(.+)/){ $_=$1; s/\d+\[\d+\]//g; print }' /proc/mdstat`; do + for device in $(LC_ALL=C perl -ne 'if(/^'$raiddev'\s.+raid\d+\s(.+)/){ $_=$1; s/\d+\[\d+\]//g; s/(nvme.+?)p/$1/g; print }' /proc/mdstat); do echo Install grub on /dev/$device $ROOTCMD grub-install --no-floppy "/dev/$device" done diff --git a/fai/config/scripts/LAST/50-misc b/fai/config/scripts/LAST/50-misc index eebb379..5b34f7b 100755 --- a/fai/config/scripts/LAST/50-misc +++ b/fai/config/scripts/LAST/50-misc @@ -46,7 +46,7 @@ fi # Make sure everything is configured properly if ifclass DEBIAN ; then - $ROOTCMD apt-get -f install + $ROOTCMD apt-get -f install -y fi if [ $FAI_ACTION = "install" ]; then @@ -72,7 +72,7 @@ setrel() { return fi - dists="jessie stretch buster bullseye bookworm bionic xenial trusty" + dists="jessie stretch buster bullseye bookworm focal bionic xenial trusty" for d in $dists; do if grep -iq $d $target/etc/os-release; then release=$d diff --git a/fai/config/scripts/UBUNTU/90-apt b/fai/config/scripts/UBUNTU/90-apt index 15ac4bb..4da7029 100755 --- a/fai/config/scripts/UBUNTU/90-apt +++ b/fai/config/scripts/UBUNTU/90-apt @@ -1,14 +1,5 @@ #! /bin/bash -if ifclass GERMAN; then - $ROOTCMD locale-gen LANG=de_DE.UTF-8 - $ROOTCMD update-locale LANG=de_DE.UTF-8 -else - ainsl -v /etc/locale.gen '^en_US.UTF-8 UTF-8' - $ROOTCMD locale-gen - $ROOTCMD update-locale LANG=en_US.UTF-8 -fi - # check if we already use an external mirror grep -q "external mirror" $target/etc/apt/sources.list && exit 0 -- 2.30.2