From f8e7e925a0eba5b0091354ccf26842bcfda9b84e Mon Sep 17 00:00:00 2001 From: Ian Kelling Date: Wed, 3 Jul 2019 21:12:52 -0400 Subject: [PATCH] update to db59a1a2dd 2019-03-07 --- fai/config/basefiles/mk-basefile | 5 +- fai/config/class/20-hwdetect.sh | 3 +- fai/config/class/50-host-classes | 4 +- fai/config/class/60-misc | 9 +- fai/config/class/DEBIAN.var | 2 +- fai/config/class/UBUNTU.var | 3 +- fai/config/class/example.profile | 4 +- fai/config/debconf/CLOUD | 2 +- fai/config/debconf/DEBIAN | 12 +- fai/config/debconf/GERMAN | 12 +- .../files/etc/dhcp/dhcpd.conf/FAISERVER | 7 +- .../files/etc/fai/nfsroot.conf/FAISERVER | 2 +- fai/config/files/etc/rc.local/FAISERVER | 4 +- fai/config/hooks/instsoft.DEBIAN | 1 - fai/config/hooks/savelog.LAST.sh | 10 ++ fai/config/hooks/updatebase.UBUNTU | 11 +- fai/config/package_config/FAISERVER | 2 +- fai/config/package_config/UBUNTU | 8 +- fai/config/package_config/XFCE | 1 + fai/config/package_config/XORG | 5 + fai/config/scripts/DEBIAN/10-rootpw | 2 + fai/config/scripts/DEBIAN/30-interface | 103 +++++++++++++----- fai/config/scripts/FAISERVER/10-conffiles | 2 +- fai/config/scripts/GRUB_EFI/10-setup | 8 +- fai/config/scripts/GRUB_PC/10-setup | 12 +- fai/config/scripts/LAST/50-misc | 2 +- fai/config/scripts/UBUNTU/90-apt | 11 +- fai/config/scripts/UBUNTU/91-misc | 7 ++ 28 files changed, 169 insertions(+), 85 deletions(-) create mode 100755 fai/config/scripts/UBUNTU/91-misc diff --git a/fai/config/basefiles/mk-basefile b/fai/config/basefiles/mk-basefile index 2fc0d2a..deb12d4 100755 --- a/fai/config/basefiles/mk-basefile +++ b/fai/config/basefiles/mk-basefile @@ -174,6 +174,7 @@ debgeneric() { dist=${DIST%%[0-9][0-9]} local exc="EXCLUDE_$dist" + [ -n "${!exc}" ] && exc="--exclude=${!exc}" || unset exc dist=${dist,,} check @@ -182,7 +183,7 @@ debgeneric() { fi if [ -n "$arch" ]; then - qemu-debootstrap --arch $arch --exclude=${!exc} $inc $dist $xtmp $mirror + qemu-debootstrap --arch $arch ${exc} $inc $dist $xtmp $mirror target="${target}_${arch^^}" else if [[ $DIST =~ 64 ]]; then @@ -190,7 +191,7 @@ debgeneric() { else arch=i386 fi - debootstrap --arch $arch --exclude=${!exc} $inc $dist $xtmp $mirror + debootstrap --arch $arch ${exc} $inc $dist $xtmp $mirror fi cleanup-deb tarit diff --git a/fai/config/class/20-hwdetect.sh b/fai/config/class/20-hwdetect.sh index a928b54..510be75 100755 --- a/fai/config/class/20-hwdetect.sh +++ b/fai/config/class/20-hwdetect.sh @@ -12,8 +12,7 @@ echo 0 > /proc/sys/kernel/printk # 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" ;; - 3*) kernelmodules="$kernelmodules mptspi dm-mod md-mod aes dm-crypt" ;; - 4*) 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 diff --git a/fai/config/class/50-host-classes b/fai/config/class/50-host-classes index fc89c1d..f0ba873 100755 --- a/fai/config/class/50-host-classes +++ b/fai/config/class/50-host-classes @@ -19,13 +19,13 @@ case $HOSTNAME in 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 - exit 0 ;; # CentOS does not use the GRUB class + ;; 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 - exit 0 ;; # CentOS/SLC does not use the GRUB class + ;; *) echo "FAIBASE DEBIAN DEMO" ;; esac diff --git a/fai/config/class/60-misc b/fai/config/class/60-misc index 9733dcb..1c3b4fd 100755 --- a/fai/config/class/60-misc +++ b/fai/config/class/60-misc @@ -1,6 +1,11 @@ #! /bin/bash ifclass -o CENTOS SLC && exit 0 -if ifclass -o I386 AMD64 ; then - ifclass -o GRUB_PC GRUB_EFI ||echo GRUB_PC + +ifclass -o GRUB_PC GRUB_EFI && exit 0 + +if [ -d /sys/firmware/efi ]; then + echo GRUB_EFI +elif ifclass -o I386 AMD64 ; then + echo GRUB_PC fi diff --git a/fai/config/class/DEBIAN.var b/fai/config/class/DEBIAN.var index b7146a7..e9a2756 100644 --- a/fai/config/class/DEBIAN.var +++ b/fai/config/class/DEBIAN.var @@ -1,4 +1,4 @@ -release=stretch +release=buster apt_cdn=http://deb.debian.org security_cdn=http://security.debian.org diff --git a/fai/config/class/UBUNTU.var b/fai/config/class/UBUNTU.var index f45c3ce..5948df4 100644 --- a/fai/config/class/UBUNTU.var +++ b/fai/config/class/UBUNTU.var @@ -1 +1,2 @@ -ubuntudist=xenial +ubuntumirror=http://archive.ubuntu.com +ubuntudist=bionic diff --git a/fai/config/class/example.profile b/fai/config/class/example.profile index 75ff37f..70a940e 100644 --- a/fai/config/class/example.profile +++ b/fai/config/class/example.profile @@ -34,12 +34,12 @@ downloaded from the internet. Classes: INSTALL FAIBASE CENTOS CENTOS7_64 XORG Name: Ubuntu -Description: Ubuntu 16.04 desktop installation +Description: Ubuntu 18.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 XENIAL XENIAL64 XORG +Classes: INSTALL FAIBASE DEMO DEBIAN UBUNTU BIONIC BIONIC64 XORG Name: Inventory Description: Show hardware info diff --git a/fai/config/debconf/CLOUD b/fai/config/debconf/CLOUD index a5ab74d..e3614d6 100644 --- a/fai/config/debconf/CLOUD +++ b/fai/config/debconf/CLOUD @@ -1,2 +1,2 @@ # Linux command line: -grub-pc grub2/linux_cmdline_default string elevator=noop quiet +grub-pc grub2/linux_cmdline_default string elevator=noop quiet diff --git a/fai/config/debconf/DEBIAN b/fai/config/debconf/DEBIAN index e9dc3c1..1e14af7 100644 --- a/fai/config/debconf/DEBIAN +++ b/fai/config/debconf/DEBIAN @@ -1,9 +1,9 @@ exim4-config exim4/dc_eximconfig_configtype select local delivery only; not on a network locales locales/default_environment_locale select en_US.UTF-8 locales locales/locales_to_be_generated multiselect en_US.UTF-8 UTF-8 -keyboard-configuration keyboard-configuration/modelcode string pc105 -keyboard-configuration keyboard-configuration/xkb-keymap select us -keyboard-configuration keyboard-configuration/variant select USA -keyboard-configuration keyboard-configuration/model select Generic 105-key (Intl) PC -keyboard-configuration keyboard-configuration/layoutcode string us -keyboard-configuration keyboard-configuration/optionscode string ctrl:nocaps,terminate:ctrl_alt_bksp +keyboard-configuration keyboard-configuration/modelcode string pc105 +keyboard-configuration keyboard-configuration/xkb-keymap select us +keyboard-configuration keyboard-configuration/variant select USA +keyboard-configuration keyboard-configuration/model select Generic 105-key (Intl) PC +keyboard-configuration keyboard-configuration/layoutcode string us +keyboard-configuration keyboard-configuration/optionscode string ctrl:nocaps,terminate:ctrl_alt_bksp diff --git a/fai/config/debconf/GERMAN b/fai/config/debconf/GERMAN index a1fbc27..cca0416 100644 --- a/fai/config/debconf/GERMAN +++ b/fai/config/debconf/GERMAN @@ -1,8 +1,8 @@ locales locales/default_environment_locale select de_DE.UTF-8 locales locales/locales_to_be_generated multiselect de_DE.UTF-8 UTF-8 -keyboard-configuration keyboard-configuration/modelcode string pc105 -keyboard-configuration keyboard-configuration/xkb-keymap select de -keyboard-configuration keyboard-configuration/variant select Germany -keyboard-configuration keyboard-configuration/model select Generic 105-key (Intl) PC -keyboard-configuration keyboard-configuration/layoutcode string de -keyboard-configuration keyboard-configuration/optionscode string ctrl:nocaps,terminate:ctrl_alt_bksp +keyboard-configuration keyboard-configuration/modelcode string pc105 +keyboard-configuration keyboard-configuration/xkb-keymap select de +keyboard-configuration keyboard-configuration/variant select Germany +keyboard-configuration keyboard-configuration/model select Generic 105-key (Intl) PC +keyboard-configuration keyboard-configuration/layoutcode string de +keyboard-configuration keyboard-configuration/optionscode string ctrl:nocaps,terminate:ctrl_alt_bksp diff --git a/fai/config/files/etc/dhcp/dhcpd.conf/FAISERVER b/fai/config/files/etc/dhcp/dhcpd.conf/FAISERVER index 55784e2..b0343cc 100644 --- a/fai/config/files/etc/dhcp/dhcpd.conf/FAISERVER +++ b/fai/config/files/etc/dhcp/dhcpd.conf/FAISERVER @@ -15,7 +15,12 @@ subnet 192.168.33.0 netmask 255.255.255.0 { # option ntp-servers faiserver; server-name faiserver; next-server faiserver; - filename "fai/pxelinux.0"; + if substring(option vendor-class-identifier, 0, 20) = "PXEClient:Arch:00000" { + filename "fai/pxelinux.0"; + } + if substring(option vendor-class-identifier, 0, 20) = "PXEClient:Arch:00007" { + filename "fai/syslinux.efi"; + } allow unknown-clients; pool { range 192.168.33.100 192.168.33.150; diff --git a/fai/config/files/etc/fai/nfsroot.conf/FAISERVER b/fai/config/files/etc/fai/nfsroot.conf/FAISERVER index 9e192c6..dfa5c1f 100644 --- a/fai/config/files/etc/fai/nfsroot.conf/FAISERVER +++ b/fai/config/files/etc/fai/nfsroot.conf/FAISERVER @@ -1,7 +1,7 @@ # For a detailed description see nfsroot.conf(5) # " " for debootstrap -FAI_DEBOOTSTRAP="stretch http://deb.debian.org/debian" +FAI_DEBOOTSTRAP="buster http://deb.debian.org/debian" FAI_ROOTPW='$1$kBnWcO.E$djxB128U7dMkrltJHPf6d1' NFSROOT=/srv/fai/nfsroot diff --git a/fai/config/files/etc/rc.local/FAISERVER b/fai/config/files/etc/rc.local/FAISERVER index 8710678..e70fae9 100755 --- a/fai/config/files/etc/rc.local/FAISERVER +++ b/fai/config/files/etc/rc.local/FAISERVER @@ -33,7 +33,7 @@ if [ ! -d "$FAI_CONFIGDIR/class" ]; then mkdir -p $FAI_CONFIGDIR cp -a /usr/share/doc/fai-doc/examples/simple/* $FAI_CONFIGDIR ainsl /srv/fai/config/class/FAIBASE.var "^LOGUSER=fai" - myip=$(ip addr show up| grep -w inet | cut -d t -f 2 | cut -d ' ' -f 2 | cut -d / -f 1 | grep -v 127.0.0.1) + myip=$(ip addr show up| grep -P -o '(?<=inet )[^/]+' | grep -v 127.0.0.1) echo "APTPROXY=http://$myip:3142" >> /srv/fai/config/class/DEBIAN.var fi # set the LOGUSER, wo we get all the logs from our install clients @@ -79,7 +79,7 @@ EOF 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 stretch.tmpl +fai-chboot -Iv -f verbose,sshd,createvt,menu -u nfs://faiserver/srv/fai/config buster.tmpl # Since we do not know the MAC address, our DHCP cannot provide the hostname. # Therefore we do explicitly set the hostname diff --git a/fai/config/hooks/instsoft.DEBIAN b/fai/config/hooks/instsoft.DEBIAN index ebf7d8a..35ac306 100755 --- a/fai/config/hooks/instsoft.DEBIAN +++ b/fai/config/hooks/instsoft.DEBIAN @@ -11,7 +11,6 @@ ainsl -a /etc/ucf.conf "^conf_force_conffold=YES" # in case the locales are already included inside the base file (Ubuntu) if [ -f $target/usr/sbin/locale-gen ]; then - $ROOTCMD dpkg-reconfigure -fnoninteractive locales exit fi diff --git a/fai/config/hooks/savelog.LAST.sh b/fai/config/hooks/savelog.LAST.sh index e77b9be..dd922ba 100755 --- a/fai/config/hooks/savelog.LAST.sh +++ b/fai/config/hooks/savelog.LAST.sh @@ -55,6 +55,7 @@ kolabadmin gstreamer.\+-plugins-really-bad liberrors.so liberrors-samba +libsamba-errors gsambad libad libtest-nowarnings-perl @@ -159,6 +160,15 @@ Warning: apt-key output should not be parsed WARNING: Failed to connect to lvmetad. Falling back to device scanning Warning: The home dir /var/lib/usbmux you specified diff: /var/lib/apparmor/profiles/.apparmor.md5sums: No such file or directory +error reporting disabled +Enabling Firmware First mode for corrected errors +errors: 0 + 0 errors +Memory Error Correction: +Memory Controller 0 - Channel . Error +IIO RAS/Control Status/Global Errors +__stack_chk_fail +grub.cfg.new: Directory nonexistent update-rc.d: warning: start and stop actions are no longer supported" # add pattern on some conditions diff --git a/fai/config/hooks/updatebase.UBUNTU b/fai/config/hooks/updatebase.UBUNTU index dadaa48..00ba437 100755 --- a/fai/config/hooks/updatebase.UBUNTU +++ b/fai/config/hooks/updatebase.UBUNTU @@ -4,12 +4,7 @@ cat < $target/etc/apt/sources.list # external mirror -deb MIRRORURL $ubuntudist main restricted universe multiverse -deb MIRRORURL $ubuntudist-updates main restricted universe multiverse -deb MIRRORURL $ubuntudist-security main restricted universe multiverse +deb $ubuntumirror/ubuntu $ubuntudist main restricted universe multiverse +deb $ubuntumirror/ubuntu $ubuntudist-updates main restricted universe multiverse +deb $ubuntumirror/ubuntu $ubuntudist-security main restricted universe multiverse EOM - -# determine a fast mirror for Ubuntu -list=$(curl -s http://mirrors.ubuntu.com/mirrors.txt) -mirror=$(netselect $list | awk '{print $2}') -sed -i -e "s#MIRRORURL#$mirror#" $target/etc/apt/sources.list diff --git a/fai/config/package_config/FAISERVER b/fai/config/package_config/FAISERVER index b26cdd9..25672c8 100644 --- a/fai/config/package_config/FAISERVER +++ b/fai/config/package_config/FAISERVER @@ -10,4 +10,4 @@ apt-cacher-ng nscd psmisc bind9 dnsutils iptables-persistent -emacs25-nox +zile diff --git a/fai/config/package_config/UBUNTU b/fai/config/package_config/UBUNTU index 79a6b3c..47e9e73 100644 --- a/fai/config/package_config/UBUNTU +++ b/fai/config/package_config/UBUNTU @@ -12,7 +12,9 @@ memtest86+ PACKAGES install GRUB_PC grub-pc -PACKAGES install XORG -ubuntu-desktop -ubuntu-standard +PACKAGES install ubuntu-minimal +ubuntu-server + +PACKAGES install GERMAN +language-pack-gnome-de diff --git a/fai/config/package_config/XFCE b/fai/config/package_config/XFCE index 28cade9..2e878d3 100644 --- a/fai/config/package_config/XFCE +++ b/fai/config/package_config/XFCE @@ -3,3 +3,4 @@ xfce4 # base system xfce4-goodies # additional tools lightdm firefox-esr +network-manager-gnome diff --git a/fai/config/package_config/XORG b/fai/config/package_config/XORG index 5859084..2dd9d0b 100644 --- a/fai/config/package_config/XORG +++ b/fai/config/package_config/XORG @@ -5,3 +5,8 @@ xscreensaver xscreensaver-gl xterm desktop-base + +PACKAGES install UBUNTU +ubuntu-server- +ubuntu-standard +ubuntu-desktop diff --git a/fai/config/scripts/DEBIAN/10-rootpw b/fai/config/scripts/DEBIAN/10-rootpw index 7a7f617..bb77d1a 100755 --- a/fai/config/scripts/DEBIAN/10-rootpw +++ b/fai/config/scripts/DEBIAN/10-rootpw @@ -7,6 +7,8 @@ if [ -n "$ROOTPW" ]; then $ROOTCMD usermod -p "$ROOTPW" root else $ROOTCMD usermod -L root + # enable sudo for user + ainsl /etc/sudoers "$username ALL = ALL" fi exit $error diff --git a/fai/config/scripts/DEBIAN/30-interface b/fai/config/scripts/DEBIAN/30-interface index c994ce9..34c98e8 100755 --- a/fai/config/scripts/DEBIAN/30-interface +++ b/fai/config/scripts/DEBIAN/30-interface @@ -1,20 +1,62 @@ #! /bin/bash -error=0; trap 'error=$(($?>$error?$?:$error))' ERR # save maximum error code +netplan_yaml() { + # network configuration using ubuntu's netplan.io + local IFNAME="$1" + local METHOD="$2" + echo "Generating netplan configuration for $IFNAME ($METHOD)" >&2 + echo "# generated by FAI" + echo "network:" + echo " version: 2" + echo " renderer: $RENDERER" + case "$RENDERER" in + networkd) + echo " ethernets:" + echo " $IFNAME:" + case "$METHOD" in + dhcp) + echo " dhcp4: true" + ;; + static) + echo " addresses: [$CIDR]" + echo " gateway4: $GATEWAYS_1" + echo " nameservers:" + echo " search: [$DOMAIN]" + echo " addresses: [${DNSSRVS// /, }]" + ;; + esac + esac +} +iface_stanza() { + # classic network configuration using /etc/network/interfaces + local IFNAME="$1" + local METHOD="$2" + echo "Generating interface configuration for $IFNAME ($METHOD)" >&2 + echo "# generated by FAI" + echo "auto $IFNAME" + echo "iface $IFNAME inet $METHOD" + case "$METHOD" in + static) + echo " address $IPADDR" + echo " netmask $NETMASK" + echo " broadcast $BROADCAST" + echo " gateway $GATEWAYS" + ;; + esac +} newnicnames() { # determine predictable network names only for stretch and above [ $do_init_tasks -eq 0 ] && return - + [ -z "$NIC1" ] && return ver=$($ROOTCMD dpkg-query --showformat='${Version}' --show udev) if dpkg --compare-versions $ver lt 220-7; then return fi - [ -z "$NIC1" ] && return fields="ID_NET_NAME_FROM_DATABASE ID_NET_NAME_ONBOARD ID_NET_NAME_SLOT ID_NET_NAME_PATH" for field in $fields; do @@ -30,32 +72,43 @@ newnicnames() { } if [ -z "$NIC1" ]; then - echo "ERROR: \$NIC1 is not defined. Cannot configure /etc/network/interfaces properly." + echo "WARNING: \$NIC1 is not defined. Cannot add ethernet to /etc/network/interfaces." fi -newnicnames CIDR=$(ip -o -f inet addr show $NIC1 | awk '{print $4}') -if ifclass DHCPC && [ $FAI_ACTION = "install" -o $FAI_ACTION = "dirinstall" ]; then +newnicnames + +case "$FAI_ACTION" in + install|dirinstall) + ifclass DHCPC && METHOD=dhcp || METHOD=static + ifclass XORG && RENDERER=NetworkManager || RENDERER=networkd + + if [ -d $target/etc/netplan ]; then + # Ubuntu >= 17.10 with netplan.io + if [ -n "$NIC1" ]; then + netplan_yaml $NIC1 $METHOD > $target/etc/netplan/01-${NIC1}.yaml + fi + elif [ -d $target/etc/network/interfaces.d ]; then + # ifupdown >= 0.7.41 (Debian >= 8, Ubuntu >= 14.04) + iface_stanza lo loopback > $target/etc/network/interfaces.d/lo - cat > $target/etc/network/interfaces <<-EOF - # generated by FAI - auto lo $NIC1 - iface lo inet loopback - iface $NIC1 inet dhcp -EOF -elif [ $FAI_ACTION = "install" -o $FAI_ACTION = "dirinstall" ]; then - [ -n "$CIDR" ] && cat > $target/etc/network/interfaces <<-EOF - # generated by FAI - auto lo $NIC1 - iface lo inet loopback - iface $NIC1 inet static - address $CIDR - gateway $GATEWAYS -EOF - [ -n "$NETWORK" ] && echo "localnet $NETWORK" > $target/etc/networks - if [ ! -L $target/etc/resolv.conf -a -e /etc/resolv.conf ]; then - cp -p /etc/resolv.conf $target/etc + if [ -n "$NIC1" -a ! -f $target/etc/NetworkManager/NetworkManager.conf ]; then + iface_stanza $NIC1 $METHOD > $target/etc/network/interfaces.d/$NIC1 + fi + else + ( + iface_stanza lo loopback + iface_stanza $NIC1 $METHOD + ) > $target/etc/network/interfaces fi -fi + + if ! ifclass DHCPC ; then + [ -n "$NETWORK" ] && echo "localnet $NETWORK" > $target/etc/networks + if [ ! -L $target/etc/resolv.conf -a -e /etc/resolv.conf ]; then + cp -p /etc/resolv.conf $target/etc + fi + fi + ;; +esac # here fcopy is mostly used, when installing a client for running in a # different subnet than during the installation diff --git a/fai/config/scripts/FAISERVER/10-conffiles b/fai/config/scripts/FAISERVER/10-conffiles index 812003b..578255f 100755 --- a/fai/config/scripts/FAISERVER/10-conffiles +++ b/fai/config/scripts/FAISERVER/10-conffiles @@ -18,7 +18,7 @@ if [ $FAI_ACTION = "install" -o $FAI_ACTION = "dirinstall" ] ; then ainsl -av /etc/apt/apt.conf.d/02proxy 'Acquire::http::Proxy "http://127.0.0.1:3142";' # create some host entries - myip=$(ip addr show up| grep -w inet | cut -d t -f 2 | cut -d ' ' -f 2 | cut -d / -f 1 | grep -v 127.0.0.1) + myip=$(ip addr show up| grep -P -o '(?<=inet )[^/]+' | grep -v 127.0.0.1) ainsl /etc/hosts "$myip faiserver" # that's me ainsl /etc/hosts "192.168.33.100 demohost" ainsl /etc/hosts "192.168.33.101 xfcehost" diff --git a/fai/config/scripts/GRUB_EFI/10-setup b/fai/config/scripts/GRUB_EFI/10-setup index 3e610ad..f586ba1 100755 --- a/fai/config/scripts/GRUB_EFI/10-setup +++ b/fai/config/scripts/GRUB_EFI/10-setup @@ -35,6 +35,11 @@ fi GROOT=$($ROOTCMD grub-probe -tdrive -d $BOOT_DEVICE) +# handle /boot in lvm-on-md +_bdev=$(readlink -f $BOOT_DEVICE) +if [ "${_bdev%%-*}" = "/dev/dm" ]; then + BOOT_DEVICE=$( lvs --noheadings -o devices $BOOT_DEVICE | sed -e 's/^*\([^(]*\)(.*$/\1/' ) +fi # Check if RAID is used for the boot device if [[ $BOOT_DEVICE =~ '/dev/md' ]]; then @@ -45,7 +50,8 @@ if [[ $BOOT_DEVICE =~ '/dev/md' ]]; then $ROOTCMD grub-install --no-floppy --force-extra-removable "/dev/$device" done -elif [[ $GROOT =~ 'hostdisk' ]]; then +elif [[ $BOOT_DEVICE =~ '/dev/loop' ]]; then + # do not update vmram when using a loop device $ROOTCMD grub-install --no-floppy --force-extra-removable --modules=part_gpt --no-nvram $BOOT_DEVICE if [ $? -eq 0 ]; then echo "Grub installed on hostdisk $BOOT_DEVICE" diff --git a/fai/config/scripts/GRUB_PC/10-setup b/fai/config/scripts/GRUB_PC/10-setup index c19d4fa..5563275 100755 --- a/fai/config/scripts/GRUB_PC/10-setup +++ b/fai/config/scripts/GRUB_PC/10-setup @@ -27,6 +27,11 @@ fi GROOT=$($ROOTCMD grub-probe -tdrive -d $BOOT_DEVICE) +# handle /boot in lvm-on-md +_bdev=$(readlink -f $BOOT_DEVICE) +if [ "${_bdev%%-*}" = "/dev/dm" ]; then + BOOT_DEVICE=$( lvs --noheadings -o devices $BOOT_DEVICE | sed -e 's/^*\([^(]*\)(.*$/\1/' ) +fi # Check if RAID is used for the boot device if [[ $BOOT_DEVICE =~ '/dev/md' ]]; then @@ -36,13 +41,6 @@ if [[ $BOOT_DEVICE =~ '/dev/md' ]]; then echo Install grub on /dev/$device $ROOTCMD grub-install --no-floppy "/dev/$device" done - -elif [[ $GROOT =~ 'hostdisk' ]]; then - $ROOTCMD grub-install --no-floppy --modules=part_msdos $BOOT_DEVICE - if [ $? -eq 0 ]; then - echo "Grub installed on hostdisk $BOOT_DEVICE" - fi - else $ROOTCMD grub-install --no-floppy "$GROOT" if [ $? -eq 0 ]; then diff --git a/fai/config/scripts/LAST/50-misc b/fai/config/scripts/LAST/50-misc index a85fd14..eebb379 100755 --- a/fai/config/scripts/LAST/50-misc +++ b/fai/config/scripts/LAST/50-misc @@ -72,7 +72,7 @@ setrel() { return fi - dists="jessie stretch buster xenial trusty" + dists="jessie stretch buster bullseye bookworm bionic xenial trusty" for d in $dists; do if grep -iq $d $target/etc/os-release; then release=$d diff --git a/fai/config/scripts/UBUNTU/90-apt b/fai/config/scripts/UBUNTU/90-apt index f08a23d..15ac4bb 100755 --- a/fai/config/scripts/UBUNTU/90-apt +++ b/fai/config/scripts/UBUNTU/90-apt @@ -14,12 +14,7 @@ grep -q "external mirror" $target/etc/apt/sources.list && exit 0 cat < $target/etc/apt/sources.list # external mirror -deb MIRRORURL $ubuntudist main restricted universe multiverse -deb MIRRORURL $ubuntudist-updates main restricted universe multiverse -deb MIRRORURL $ubuntudist-security main restricted universe multiverse +deb $ubuntumirror/ubuntu $ubuntudist main restricted universe multiverse +deb $ubuntumirror/ubuntu $ubuntudist-updates main restricted universe multiverse +deb $ubuntumirror/ubuntu $ubuntudist-security main restricted universe multiverse EOM - -# determine a fast mirror for Ubuntu -list=$(curl -s http://mirrors.ubuntu.com/mirrors.txt) -mirror=$(netselect $list | awk '{print $2}') -sed -i -e "s#MIRRORURL#$mirror#" $target/etc/apt/sources.list diff --git a/fai/config/scripts/UBUNTU/91-misc b/fai/config/scripts/UBUNTU/91-misc new file mode 100755 index 0000000..0d1d6d8 --- /dev/null +++ b/fai/config/scripts/UBUNTU/91-misc @@ -0,0 +1,7 @@ +#! /bin/bash + +# disable the first login screen +$ROOTCMD dpkg-divert --local --rename --add /etc/xdg/autostart/gnome-initial-setup-first-login.desktop +$ROOTCMD dpkg-divert --local --rename --add /etc/xdg/autostart/gnome-initial-setup-copy-worker.desktop +$ROOTCMD deluser --system gnome-initial-setup +$ROOTCMD dpkg-reconfigure keyboard-configuration -- 2.30.2