dist=${DIST%%[0-9][0-9]}
local exc="EXCLUDE_$dist"
+ [ -n "${!exc}" ] && exc="--exclude=${!exc}" || unset exc
dist=${dist,,}
check
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
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
# 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
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
#! /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
-release=stretch
+release=buster
apt_cdn=http://deb.debian.org
security_cdn=http://security.debian.org
-ubuntudist=xenial
+ubuntumirror=http://archive.ubuntu.com
+ubuntudist=bionic
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
# Linux command line:
-grub-pc grub2/linux_cmdline_default string elevator=noop quiet
+grub-pc grub2/linux_cmdline_default string elevator=noop quiet
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
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
# 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;
# For a detailed description see nfsroot.conf(5)
# "<suite> <mirror>" 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
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
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
# 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
gstreamer.\+-plugins-really-bad
liberrors.so
liberrors-samba
+libsamba-errors
gsambad
libad
libtest-nowarnings-perl
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
cat <<EOM > $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
nscd psmisc
bind9 dnsutils
iptables-persistent
-emacs25-nox
+zile
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
xfce4-goodies # additional tools
lightdm
firefox-esr
+network-manager-gnome
xscreensaver-gl
xterm
desktop-base
+
+PACKAGES install UBUNTU
+ubuntu-server-
+ubuntu-standard
+ubuntu-desktop
$ROOTCMD usermod -p "$ROOTPW" root
else
$ROOTCMD usermod -L root
+ # enable sudo for user
+ ainsl /etc/sudoers "$username ALL = ALL"
fi
exit $error
#! /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
}
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
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"
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
$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"
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
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
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
cat <<EOM > $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
--- /dev/null
+#! /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