#! /bin/bash
# mk-basefile, create basefiles for some distributions
#
-# Thomas Lange, Uni Koeln, 2011-2020
+# Thomas Lange, Uni Koeln, 2011-2021
# based on the Makefile implementation of Michael Goetze
#
# Usage example: mk-basefile -J STRETCH64
EXCLUDE_STRETCH=info
EXCLUDE_BUSTER=
EXCLUDE_BULLSEYE=
+EXCLUDE_BOOKWORM=
+EXCLUDE_TRIXIE=
EXCLUDE_SID=
EXCLUDE_BELENOS=dhcp3-client,dhcp3-common,info
STRETCH32 STRETCH64
BUSTER32 BUSTER64
BULLSEYE32 BULLSEYE64
+ BOOKWORM32 BOOKWORM64
+ TRIXIE32 TRIXIE64
SID32 SID64
"
}
debgeneric $target $MIRROR_TRISQUEL ;;
TRUSTY*|XENIAL*|BIONIC*|FOCAL*)
debgeneric $target $MIRROR_UBUNTU ;;
- SQUEEZE*|WHEEZY*|JESSIE*|STRETCH*|BUSTER*|BULLSEYE*|SID*)
+ SQUEEZE*|WHEEZY*|JESSIE*|STRETCH*|BUSTER*|BULLSEYE*|BOOKWORM*|TRIXIE*|SID*)
debgeneric $target $MIRROR_DEBIAN $ARCH;;
*) echo "Unknown distribution. Aborting."
prtdists
modprobe -a $mod 1>/dev/null 2>&1
done
-ip ad show up | egrep -iv 'loopback|127.0.0.1|::1/128|_lft'
+# show the basic information about the network interface
+ip -br li show up|egrep -v ^lo; ip -br a show up|egrep -v ^lo
echo $printk > /proc/sys/kernel/printk
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
+for c in LVM FAISERVER FAIBASE; do
+ if ifclass $c; then
+ echo ${c}_EFI
+ break
+ fi
+done
-# sources are set with fcopy
-#release=buster
-#apt_cdn=http://deb.debian.org
-#security_cdn=http://security.debian.org
+# ian, commented, sources are set with fcopy
+# release=bullseye
+# 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
+ secsuite=buster/updates
+else
+ secsuite=$release-security
+fi
CONSOLEFONT=
KEYMAP=us-latin1
Classes: INSTALL FAIBASE CENTOS CENTOS8_64 XORG
Name: Ubuntu
-Description: Ubuntu 20.04 desktop installation
+Description: Ubuntu 20.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
+++ /dev/null
-# example of new config file for setup-storage
-#
-# <type> <mountpoint> <size> <fs type> <mount options> <misc options>
-
-# this is a copy of FAIBASE, but with metadata_csum disabled.
-# Ubuntu XENIAL does not yet suport this option
-
-disk_config disk1 disklabel:msdos bootable:1 fstabkey:uuid
-
-primary / 2G-50G ext4 rw,noatime,errors=remount-ro createopts="-O ^metadata_csum"
-logical swap 200-1G swap sw
-logical /home 100- ext4 rw,noatime,nosuid,nodev createopts="-L home -m 1 -O ^metadata_csum" tuneopts="-c 0 -i 0"
+++ /dev/null
-# example of new config file for setup-storage
-#
-# <type> <mountpoint> <size> <fs type> <mount options> <misc options>
-
-# 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"
# For a detailed description see nfsroot.conf(5)
# "<suite> <mirror>" for debootstrap
-FAI_DEBOOTSTRAP="buster http://deb.debian.org/debian"
+FAI_DEBOOTSTRAP="bullseye http://deb.debian.org/debian"
FAI_ROOTPW='$1$kBnWcO.E$djxB128U7dMkrltJHPf6d1'
NFSROOT=/srv/fai/nfsroot
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 -P -o '(?<=inet )[^/]+' | grep -v 127.0.0.1)
+ _nic=$(ip route | awk '/^default/ {print $5}'|head -1)
+ myip=$(ip -br ad sh $_nic | awk '{print $3}')
+ myip=${myip%/*}
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
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 buster.tmpl
+fai-chboot -Iv -f verbose,sshd,createvt,menu -u nfs://faiserver/srv/fai/config bullseye.tmpl
# Since we do not know the MAC address, our DHCP cannot provide the hostname.
# Therefore we do explicitly set the hostname
bad
bad
no space
-syntax
Couldn't stat
Cannot access
conflict
# you may want these non-free kernel drivers
firmware-bnx2 firmware-bnx2x firmware-realtek
firmware-linux-nonfree
+# a list of firmware for wifi/wireless
+atmel-firmware firmware-atheros firmware-brcm80211
+firmware-iwlwifi firmware-libertas firmware-ralink firmware-zd1211
+firmware-brcm80211 firmware-ti-connectivity
+firmware-netronome firmware-netxen firmware-realtek
+firmware-cavium
+# firmware-ipw2x00 # needs a debconf question
PACKAGES install I386
linux-image-686-pae
PACKAGES install LVM
lvm2
-
-PACKAGES install CLOUD
-unattended-upgrades
#thunderbird
menu gdm3
gnome-core
-gconf-editor
gnome-screensaver gnome-system-monitor gnome-system-tools
network-manager-gnome
openssh-client
pciutils
perl
-# newer distros dont have python, it gets naturally removed
+# ian: newer distros dont have python, it gets naturally removed
python
python-minimal
python3
# a version in security, but theres a later version in updates that the system
# really wants to install.
grub-efi-amd64
-
-PACKAGES install NABIA FOCAL
# set root password
if [ -n "$ROOTPW" ]; then
- $ROOTCMD usermod -p "$ROOTPW" root
-else
+ $ROOTCMD chpasswd --encrypted <<< "root:${ROOTPW}"
+elif [ -n "$username" ]; then
$ROOTCMD usermod -L root
fi
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 -P -o '(?<=inet )[^/]+' | grep -v 127.0.0.1)
+ _nic=$(ip route | awk '/^default/ {print $5}'|head -1)
+ myip=$(ip -br ad sh $_nic | awk '{print $3}')
+ myip=${myip%/*}
ainsl /etc/hosts "$myip faiserver" # that's me
ainsl /etc/hosts "192.168.33.100 demohost"
ainsl /etc/hosts "192.168.33.101 xfcehost"
exit 189
fi
-# disable os-prober because of #788062
+# disable os-prober because of #802717
ainsl /etc/default/grub 'GRUB_DISABLE_OS_PROBER=true'
# skip the rest, if not an initial installation
exit 189
fi
-# disable os-prober because of #788062
+# disable os-prober because of #802717
ainsl /etc/default/grub 'GRUB_DISABLE_OS_PROBER=true'
# skip the rest, if not an initial installation
exit $error
fi
-GROOT=$($ROOTCMD grub-probe -tdrive -d $BOOT_DEVICE)
+get_stable_devname() {
+
+ local _DEV="$1"
+ local i
+ declare -a _RES
+
+ # prefer SCSI over ATA over WWN over path
+ # do not use by-path
+
+ for i in $($ROOTCMD udevadm info -r --query=symlink "$_DEV"); do
+ if [[ "$i" =~ /by-id/scsi ]]; then
+ _RES[10]="$i"
+ elif [[ "$i" =~ /by-id/ata ]]; then
+ _RES[20]="$i"
+ elif [[ "$i" =~ /by-id/wwn ]]; then
+ _RES[99]="$i"
+ fi
+ done
+
+ echo "${_RES[@]::1}"
+}
# handle /boot in lvm-on-md
_bdev=$(readlink -f $BOOT_DEVICE)
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; s/(nvme.+?)p/$1/g; print }' /proc/mdstat); do
- echo Install grub on /dev/$device
+ pdevice=$(get_stable_devname /dev/$device)
+ if [ -z "$pdevice" ]; then
+ # if we cannot find a persistent name (for e.g. in a VM) use old name
+ pdevice="/dev/$device"
+ fi
+ mbrdevices+="$pdevice, "
+ echo Installing grub on /dev/$device = $pdevice
$ROOTCMD grub-install --no-floppy "/dev/$device"
done
+ # remove last ,
+ mbrdevices=${mbrdevices%, }
else
- for dev in $BOOT_DEVICE; do
- GROOT=$($ROOTCMD grub-probe -tdrive -d $dev)
- $ROOTCMD grub-install --no-floppy "$GROOT"
- if [ $? -eq 0 ]; then
- echo "Grub installed on $dev = $GROOT"
- fi
- done
+ for dev in $BOOT_DEVICE; do
+ mbrdevices=$(get_stable_devname $dev)
+ if [ -z "$mbrdevices" ]; then
+ # if we cannot find a persistent name (for e.g. in a VM) use old name
+ mbrdevices=$dev
+ fi
+ echo "Installing grub on $dev = $mbrdevices"
+ $ROOTCMD grub-install --no-floppy "$mbrdevices"
+ done
fi
-$ROOTCMD update-grub
+echo "grub-pc grub-pc/install_devices multiselect $mbrdevices" | $ROOTCMD debconf-set-selections
+$ROOTCMD dpkg-reconfigure grub-pc
exit $error
return
fi
- dists="jessie stretch buster bullseye bookworm focal bionic xenial trusty"
+ dists="jessie stretch buster bullseye bookworm trixie focal bionic xenial trusty"
for d in $dists; do
if grep -iq $d $target/etc/os-release; then
release=$d
if [ -f $target/etc/apt/sources.list -a -n "$release" ]; then
grep -q 'file generated by fai-cd' $target/etc/apt/sources.list && cat <<EOF > $target/etc/apt/sources.list
deb $apt_cdn/debian $release main contrib non-free
-deb $apt_cdn/debian-security $release/updates main contrib non-free
+deb $security_cdn/debian-security ${secsuite} main contrib non-free
#deb [trusted=yes] http://fai-project.org/download $release koeln
EOF
# if the package fai-server was installed, enable the project's repository