From: Ian Kelling Date: Mon, 22 Apr 2024 16:48:59 +0000 (-0400) Subject: Merge branch 'upstream' X-Git-Url: https://iankelling.org/git/?p=automated-distro-installer;a=commitdiff_plain;h=edb1a99660561c51aa5c7803d978284c7b423842 Merge branch 'upstream' --- edb1a99660561c51aa5c7803d978284c7b423842 diff --cc fai/config/basefiles/mk-basefile index b81965f,7ced32d..d449c60 --- a/fai/config/basefiles/mk-basefile +++ b/fai/config/basefiles/mk-basefile @@@ -1,7 -1,8 +1,7 @@@ #! /bin/bash - # mk-basefile, create basefiles for some distributions # - # Thomas Lange, Uni Koeln, 2011-2021 + # Thomas Lange, Uni Koeln, 2011-2024 # based on the Makefile implementation of Michael Goetze # # Usage example: mk-basefile -J STRETCH64 @@@ -32,18 -34,15 +34,20 @@@ EXCLUDE_BUSTER EXCLUDE_BULLSEYE= EXCLUDE_BOOKWORM= EXCLUDE_TRIXIE= + EXCLUDE_FORKY= EXCLUDE_SID= +EXCLUDE_BELENOS=dhcp3-client,dhcp3-common,info EXCLUDE_TRUSTY=dhcp3-client,dhcp3-common,info EXCLUDE_XENIAL=udhcpc,dibbler-client,info +EXCLUDE_FLIDAS=udhcpc,dibbler-client,info EXCLUDE_BIONIC=udhcpc,dibbler-client,info +EXCLUDE_ETIONA=udhcpc,dibbler-client,info EXCLUDE_FOCAL=udhcpc,dibbler-client,info +EXCLUDE_NABIA=udhcpc,dibbler-client,info - EXCLUDE_JAMMY= - EXCLUDE_ARAMO= + EXCLUDE_JAMMY=udhcpc,dibbler-client,info ++EXCLUDE_ARAMO=udhcpc,dibbler-client,info + EXCLUDE_NOBLE=udhcpc,dibbler-client,info # here you can add packages, that are needed very early INCLUDE_DEBIAN= @@@ -229,13 -247,10 +261,14 @@@ prtdists() SLC7_64 TRUSTY32 TRUSTY64 XENIAL32 XENIAL64 + FLIDAS64 BIONIC64 + ETIONA64 FOCAL64 + NABIA64 JAMMY64 + ARAMO64 + NOBLE64 SQUEEZE32 SQUEEZE64 WHEEZY32 WHEEZY64 JESSIE32 JESSIE64 @@@ -260,11 -276,9 +294,11 @@@ Usage: mk-basefile [OPTION] ... DISTRIB -s Show list of supported linux distributions -f ARCH Build for foreign architecture ARCH. -d DIR Use DIR for creating the temporary subtree structure. - -z Use gzip for compressing the tar file. + -z Use zstd for compressing the tar file. -J Use xz for compressing the tar file. -k Keep the temporary subtree structure, do not remove it. + -x CMD Run CMD in chroot. If CMD exists as a file, copy it and run it. + Debian based only -h Print help. Usage example: mk-basefile -J STRETCH64 @@@ -321,11 -337,9 +358,11 @@@ case "$target" i SLC6_32) slc i386 6 ;; SLC6_64) slc amd64 6 ;; SLC7_64) slc amd64 7 ;; + BELENOS*|FLIDAS*|ETIONA*|NABIA*|ARAMO*) + debgeneric $target $MIRROR_TRISQUEL ;; - TRUSTY*|XENIAL*|BIONIC*|FOCAL*|JAMMY*) + TRUSTY*|XENIAL*|BIONIC*|FOCAL*|JAMMY*|NOBLE*) debgeneric $target $MIRROR_UBUNTU ;; - SQUEEZE*|WHEEZY*|JESSIE*|STRETCH*|BUSTER*|BULLSEYE*|BOOKWORM*|TRIXIE*|SID*) + SQUEEZE*|WHEEZY*|JESSIE*|STRETCH*|BUSTER*|BULLSEYE*|BOOKWORM*|TRIXIE*|FORKY*|SID*) debgeneric $target $MIRROR_DEBIAN $ARCH;; *) echo "Unknown distribution. Aborting." prtdists diff --cc fai/config/class/DEBIAN.var index a00d0f8,492d995..18b49b5 --- a/fai/config/class/DEBIAN.var +++ b/fai/config/class/DEBIAN.var @@@ -1,7 -1,6 +1,7 @@@ -release=bookworm -apt_cdn=http://deb.debian.org -security_cdn=http://security.debian.org +# ian, commented, sources are set with fcopy - # release=bullseye ++# release=bookworm +# apt_cdn=http://deb.debian.org +# security_cdn=http://security.debian.org # since bullseye Debian changed the suite name for security if [ $release = buster ]; then @@@ -21,8 -20,28 +21,29 @@@ MODULESLIST="usbhid psmouse # if you have enough RAM (>2GB) you may want to enable this line. It # also puts /var/cache into a ramdisk. -#FAI_RAMDISKS="$target/var/lib/dpkg $target/var/cache" +# ian: uncommented +FAI_RAMDISKS="$target/var/lib/dpkg $target/var/cache" # if you want to use the faiserver as APT proxy - # APTPROXY=http://faiserver:3142 + #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 --cc fai/config/class/FAIBASE.var index 34d95ac,0e38a1f..2492def --- a/fai/config/class/FAIBASE.var +++ b/fai/config/class/FAIBASE.var @@@ -16,9 -17,13 +16,13 @@@ STOP_ON_ERROR=70 # 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' +#username=demo +#USERPW='$1$kBnWcO.E$djxB128U7dMkrltJHPf6d1' # set a default FAI_DEBOOTSTRAP="bookworm http://deb.debian.org/debian" diff --cc fai/config/class/ROCKY.var index 0000000,0000000..1ec7250 new file mode 100644 --- /dev/null +++ b/fai/config/class/ROCKY.var @@@ -1,0 -1,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 --cc fai/config/class/UBUNTU.var index 6a42495,0f99b95..a453a88 --- a/fai/config/class/UBUNTU.var +++ b/fai/config/class/UBUNTU.var @@@ -1,4 -1,2 +1,4 @@@ -ubuntumirror=http://archive.ubuntu.com -ubuntudist=jammy +#iank, i define these by classes. commenting +# to make sure these arent used +#ubuntumirror=http://archive.ubuntu.com - #ubuntudist=focal ++#ubuntudist=jammy diff --cc fai/config/disk_config/CLOUD_EFI index 0000000,0000000..0e15072 new file mode 100644 --- /dev/null +++ b/fai/config/disk_config/CLOUD_EFI @@@ -1,0 -1,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 --cc fai/config/disk_config/ROCKY index 0000000,0000000..7b03a39 new file mode 100644 --- /dev/null +++ b/fai/config/disk_config/ROCKY @@@ -1,0 -1,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 --cc fai/config/files/etc/apt/sources.list/DEBIAN_DEFAULT index 0000000,0000000..74cec08 new file mode 100644 --- /dev/null +++ b/fai/config/files/etc/apt/sources.list/DEBIAN_DEFAULT @@@ -1,0 -1,0 +1,3 @@@ ++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 {%apt_cdn%}/debian {%release%}-updates main contrib non-free non-free-firmware diff --cc fai/config/files/etc/rc.local/LIVEISO index 0000000,0000000..22fbe75 new file mode 120000 --- /dev/null +++ b/fai/config/files/etc/rc.local/LIVEISO @@@ -1,0 -1,0 +1,1 @@@ ++CLOUD diff --cc fai/config/files/etc/selinux/config/ROCKY index 0000000,0000000..9878acb new file mode 100644 --- /dev/null +++ b/fai/config/files/etc/selinux/config/ROCKY @@@ -1,0 -1,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 --cc fai/config/hooks/debconf.ROCKY index 0000000,0000000..f98becd new file mode 100755 --- /dev/null +++ b/fai/config/hooks/debconf.ROCKY @@@ -1,0 -1,0 +1,3 @@@ ++#! /bin/bash ++ ++skiptask debconf diff --cc fai/config/hooks/repository.ROCKY index 0000000,0000000..32e53c3 new file mode 100755 --- /dev/null +++ b/fai/config/hooks/repository.ROCKY @@@ -1,0 -1,0 +1,27 @@@ ++#! /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 ++ ctam ++ [ -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 ++ ++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 --cc fai/config/hooks/subroutines index 0000000,0000000..816ead1 new file mode 100755 --- /dev/null +++ b/fai/config/hooks/subroutines @@@ -1,0 -1,0 +1,31 @@@ ++#! /bin/bash ++ ++# This file is sourced during task_setup ++# you can define your own functions and use them later, for e.g. ++# in scripts/... ++ ++ ++cleanup_base() { ++ ++ rm -f $target/etc/mailname \ ++ $target/etc/machine-id \ ++ $target/var/lib/dbus/machine-id \ ++ $target/var/log/install_packages.list ++ ++ > $target/etc/machine-id ++ shred --remove $target/etc/ssh/ssh_host_* ++} ++ ++ ++cleanup_dpkg_apt() { ++ ++ rm -f $target/var/log/alternatives.log \ ++ $target/var/log/apt/* \ ++ $target/var/log/bootstrap.log \ ++ $target/var/log/dpkg.log ++ ++ rm -rf $target/var/cache/apt/* ++ rm -rf $target/var/lib/apt/lists/* ++ rm -f $target/var/lib/dpkg/available* ++ rm -f -- $target/var/lib/dpkg/*-old ++} diff --cc fai/config/hooks/updatebase.ROCKY index 0000000,0000000..dd418d8 new file mode 100755 --- /dev/null +++ b/fai/config/hooks/updatebase.ROCKY @@@ -1,0 -1,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 ++ ++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 --cc fai/config/scripts/GRUB_PC/10-setup index 11535f1,b23cf36..ed8d878 --- a/fai/config/scripts/GRUB_PC/10-setup +++ b/fai/config/scripts/GRUB_PC/10-setup @@@ -3,7 -3,11 +3,12 @@@ error=0; trap 'error=$(($?>$error?$?:$error))' ERR # save maximum error code +set -x + # do only execute for Debian and similar distros + if ! ifclass DEBIAN ; then + exit 0 + fi + set -a # do not set up grub during dirinstall diff --cc fai/config/scripts/LAST/50-misc index 831f15d,b80e846..e7b9e6d --- a/fai/config/scripts/LAST/50-misc +++ b/fai/config/scripts/LAST/50-misc @@@ -15,15 -20,18 +20,19 @@@ els fi fi - # i use dm for crypt, not lvm, so this gives false positive. todo, send patch to remove this - # upstream. - # usedm=$(dmsetup ls 2>/dev/null | egrep -v '^live-rw|^live-base|^No devices found' | wc -l) - # if [ $usedm -ne 0 ]; then - # if [ ! -d $target/etc/lvm ]; then - # echo ERROR: Found lvm devices, but the lvm2 package was not installed - # error=1 - # fi - # fi + 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 + ++ # note, if we used dm for crypt, not lvm, so would givee false positive. todo, send patch to fix + usedm=$(dmsetup ls 2>/dev/null | egrep -v '^live-rw|^live-base|^No devices found' | wc -l) + if [ $usedm -ne 0 ]; then + if [ ! -d $target/etc/lvm ]; then + echo ERROR: Found lvm devices, but the lvm2 package was not installed + error=1 + fi + fi fi # remove backup files from cfengine, but only if cfengine is installed @@@ -74,7 -82,7 +83,7 @@@ setrel() return fi - dists="jessie stretch buster bullseye bookworm trixie jammy focal bionic xenial trusty aramo nabia etiona" - dists="jessie stretch buster bullseye bookworm trixie forky noble jammy focal bionic xenial trusty" ++ dists="jessie stretch buster bullseye bookworm trixie forky noble jammy focal bionic xenial trusty aramo nabia etiona" for d in $dists; do if grep -iq $d $target/etc/os-release; then release=$d diff --cc fai/config/scripts/LIVEISO/20-initrd index 0000000,0000000..4dcbc66 new file mode 100755 --- /dev/null +++ b/fai/config/scripts/LIVEISO/20-initrd @@@ -1,0 -1,0 +1,15 @@@ ++#! /bin/bash ++ ++# create an initrd for booting from ISO ++ ++# get highest kernel version ++ver=$(ls -r1 $target/boot/initrd.img-*|tail -1| sed 's/.\+initrd.img-//') ++if [ -z "$ver" ]; then ++ echo "ERROR: no initrd found in $0" ++ exit 9 ++fi ++ ++rm $target/boot/initrd.img-$ver ++$ROOTCMD dracut -N --zstd --filesystems ext4 -a "dmsquash-live " -o"btrfs crypt dash lvm resume usrmount modsign mdraid shutdown virtfs" /boot/initrd.img-$ver $ver ++ ++echo ISO initrd was created diff --cc fai/config/scripts/LIVEISO/90-cleanup index 0000000,0000000..08828d2 new file mode 100755 --- /dev/null +++ b/fai/config/scripts/LIVEISO/90-cleanup @@@ -1,0 -1,0 +1,7 @@@ ++#! /bin/bash ++ ++# this is defined in hooks/subroutines ++cleanup_dpkg_apt ++cleanup_base ++ ++echo cleanup for live ISO done diff --cc fai/config/scripts/ROCKY/10-security index 0000000,0000000..566c3f4 new file mode 100755 --- /dev/null +++ b/fai/config/scripts/ROCKY/10-security @@@ -1,0 -1,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 --cc fai/config/scripts/ROCKY/30-mkinitrd index 0000000,0000000..4d86bec new file mode 100755 --- /dev/null +++ b/fai/config/scripts/ROCKY/30-mkinitrd @@@ -1,0 -1,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 --cc fai/config/scripts/ROCKY/40-install-grub index 0000000,0000000..5590ded new file mode 100755 --- /dev/null +++ b/fai/config/scripts/ROCKY/40-install-grub @@@ -1,0 -1,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 --cc fai/config/scripts/ROCKY/50-sysconfig index 0000000,0000000..e9054b6 new file mode 100755 --- /dev/null +++ b/fai/config/scripts/ROCKY/50-sysconfig @@@ -1,0 -1,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 --cc fai/config/scripts/ROCKY/60-network-scripts index 0000000,0000000..9777418 new file mode 100755 --- /dev/null +++ b/fai/config/scripts/ROCKY/60-network-scripts @@@ -1,0 -1,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 --cc fai/config/scripts/ROCKY/80-misc index 0000000,0000000..09c8d49 new file mode 100755 --- /dev/null +++ b/fai/config/scripts/ROCKY/80-misc @@@ -1,0 -1,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 --cc fai/config/scripts/ROCKY/90-cleanup index 0000000,0000000..2eadacd new file mode 100755 --- /dev/null +++ b/fai/config/scripts/ROCKY/90-cleanup @@@ -1,0 -1,0 +1,3 @@@ ++#! /bin/bash ++ ++$ROOTCMD yum clean all