From a6f3eaed0a1eebb5c58853fb9faa8bfbec404de3 Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Mon, 8 Aug 2016 22:40:54 -0700 Subject: [PATCH] update to 5.1.2 example --- fai/config/basefiles/mk-basefile | 18 +++++++++++++++++- fai/config/class/DEBIAN.var | 2 +- fai/config/class/GERMAN.var | 2 ++ fai/config/class/UBUNTU.var | 1 + fai/config/class/example.profile | 4 ++-- fai/config/debconf/GERMAN | 8 ++++++++ fai/config/disk_config/CENTOS | 17 +++++++++++++++++ fai/config/disk_config/FAIBASE | 10 ++++++++++ fai/config/disk_config/FAISERVER | 11 +++++++++++ fai/config/disk_config/LVM | 15 +++++++++++++++ fai/config/files/etc/rc.local/FAISERVER | 4 ++-- fai/config/hooks/instsoft.DEBIAN | 2 +- fai/config/hooks/savelog.LAST.sh | 1 + fai/config/hooks/setup.DEFAULT.sh | 8 +++++++- fai/config/hooks/updatebase.UBUNTU | 8 +++----- fai/config/package_config/CENTOS | 5 ++++- fai/config/package_config/GERMAN | 5 +++++ fai/config/package_config/XFCE | 2 +- fai/config/scripts/CENTOS/30-mkinitrd | 12 +++++++++++- fai/config/scripts/DEBIAN/30-interface | 4 ++-- fai/config/scripts/LAST/50-misc | 14 +++++++++----- fai/config/scripts/UBUNTU/90-apt | 8 +++----- 22 files changed, 133 insertions(+), 28 deletions(-) create mode 100644 fai/config/class/GERMAN.var create mode 100644 fai/config/class/UBUNTU.var create mode 100644 fai/config/debconf/GERMAN create mode 100644 fai/config/disk_config/CENTOS create mode 100644 fai/config/disk_config/FAIBASE create mode 100644 fai/config/disk_config/FAISERVER create mode 100644 fai/config/disk_config/LVM create mode 100644 fai/config/package_config/GERMAN diff --git a/fai/config/basefiles/mk-basefile b/fai/config/basefiles/mk-basefile index 6eb29db..591a878 100755 --- a/fai/config/basefiles/mk-basefile +++ b/fai/config/basefiles/mk-basefile @@ -10,7 +10,7 @@ # Supported distributions (each i386/amd64): # Debian GNU/Linux -# Ubuntu 14.04 +# Ubuntu 14.04/16.04 # CentOS 5/6/7 # Scientific Linux Cern 5/6 # @@ -31,6 +31,7 @@ EXCLUDE_SQUEEZE=isc-dhcp-client,isc-dhcp-common,info,tasksel,tasksel-data EXCLUDE_WHEEZY=isc-dhcp-client,isc-dhcp-common,info,tasksel,tasksel-data EXCLUDE_JESSIE=isc-dhcp-client,isc-dhcp-common,info,tasksel,tasksel-data EXCLUDE_TRUSTY=dhcp3-client,dhcp3-common,info +EXCLUDE_XENIAL=isc-dhcp-client,isc-dhcp-common,udhcpc,dibbler-client,dhcpcd5,info,tasksel,tasksel-data INCLUDE_DEBIAN=aptitude @@ -197,6 +198,16 @@ trusty() { tarit } +xenial() { + + local arch=$1 + + check + debootstrap --arch $arch --exclude=${EXCLUDE_XENIAL} --include=${INCLUDE_DEBIAN} xenial $xtmp ${MIRROR_UBUNTU} + cleanup-deb + tarit +} + unknown() { @@ -208,7 +219,9 @@ unknown() { CENTOS7_32 CENTOS7_64 SLC5_32 SLC5_64 SLC6_32 SLC6_64 + SLC7_64 TRUSTY32 TRUSTY64 + XENIAL32 XENIAL64 SQUEEZE32 SQUEEZE64 WHEEZY32 WHEEZY64 JESSIE32 JESSIE64 @@ -251,8 +264,11 @@ case "$target" in SLC5_64) slc amd64 5 ;; SLC6_32) slc i386 6 ;; SLC6_64) slc amd64 6 ;; + SLC7_64) slc amd64 7 ;; TRUSTY32) trusty i386 ;; TRUSTY64) trusty amd64 ;; + XENIAL32) xenial i386 ;; + XENIAL64) xenial amd64 ;; SQUEEZE32) squeeze i386 ;; SQUEEZE64) squeeze amd64 ;; WHEEZY32) wheezy i386 ;; diff --git a/fai/config/class/DEBIAN.var b/fai/config/class/DEBIAN.var index 37cbe7a..a6fb66b 100644 --- a/fai/config/class/DEBIAN.var +++ b/fai/config/class/DEBIAN.var @@ -9,7 +9,7 @@ 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" +#FAI_RAMDISKS="$target/var/lib/dpkg $target/var/cache" # if you want to use the faiserver as APT proxy #APTPROXY=http://faiserver:3142 diff --git a/fai/config/class/GERMAN.var b/fai/config/class/GERMAN.var new file mode 100644 index 0000000..cbe2c93 --- /dev/null +++ b/fai/config/class/GERMAN.var @@ -0,0 +1,2 @@ +# german environment (for Debian) +KEYMAP=de-latin1-nodeadkeys diff --git a/fai/config/class/UBUNTU.var b/fai/config/class/UBUNTU.var new file mode 100644 index 0000000..f45c3ce --- /dev/null +++ b/fai/config/class/UBUNTU.var @@ -0,0 +1 @@ +ubuntudist=xenial diff --git a/fai/config/class/example.profile b/fai/config/class/example.profile index 084824f..d8467fc 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 14.04 desktop installation +Description: Ubuntu 16.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 TRUSTY TRUSTY64 XORG +Classes: INSTALL FAIBASE DEMO DEBIAN UBUNTU XENIAL XENIAL64 XORG Name: Inventory Description: Show hardware info diff --git a/fai/config/debconf/GERMAN b/fai/config/debconf/GERMAN new file mode 100644 index 0000000..a1fbc27 --- /dev/null +++ b/fai/config/debconf/GERMAN @@ -0,0 +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 diff --git a/fai/config/disk_config/CENTOS b/fai/config/disk_config/CENTOS new file mode 100644 index 0000000..99bf0b5 --- /dev/null +++ b/fai/config/disk_config/CENTOS @@ -0,0 +1,17 @@ +# example of new config file for setup-storage +# +# + +disk_config disk1 disklabel:msdos bootable:1 fstabkey:label + +# Note that the CentOS 5 version of GRUB cannot read from ext3 filesystems with inode_size > 128 +# CentOS 5.6 needs /boot as ext3, so we use ext3 for / + +#primary / 350 ext3 rw,noatime,errors=remount-ro createopts="-L ROOT -I 128" + +# use following line for CentOS 7 +primary / 4G-10G ext4 rw,noatime,errors=remount-ro createopts="-L ROOT" + +logical swap 200-1000 swap sw createopts="-L SWAP" +logical /tmp 100-1G ext4 rw,noatime,nosuid,nodev createopts="-L TMP -m 0" tuneopts="-c 0 -i 0" +logical /home 100-50% ext4 rw,noatime,nosuid,nodev createopts="-L HOME -m 1" tuneopts="-c 0 -i 0" diff --git a/fai/config/disk_config/FAIBASE b/fai/config/disk_config/FAIBASE new file mode 100644 index 0000000..c6d2d3e --- /dev/null +++ b/fai/config/disk_config/FAIBASE @@ -0,0 +1,10 @@ +# example of new config file for setup-storage +# +# + +disk_config disk1 disklabel:msdos bootable:1 fstabkey:uuid + +primary / 2G-15G ext4 rw,noatime,errors=remount-ro +logical swap 200-1G swap sw +logical /tmp 100-1G ext4 rw,noatime,nosuid,nodev createopts="-L tmp -m 0" tuneopts="-c 0 -i 0" +logical /home 100-50% ext4 rw,noatime,nosuid,nodev createopts="-L home -m 1" tuneopts="-c 0 -i 0" diff --git a/fai/config/disk_config/FAISERVER b/fai/config/disk_config/FAISERVER new file mode 100644 index 0000000..29bf219 --- /dev/null +++ b/fai/config/disk_config/FAISERVER @@ -0,0 +1,11 @@ +# config file for an FAI install server +# +# + +disk_config disk1 disklabel:msdos fstabkey:uuid + +primary / 2G-15G ext4 rw,noatime,errors=remount-ro +logical swap 200-1000 swap sw +logical /tmp 100-1000 ext4 rw,noatime,nosuid,nodev createopts="-m 0" tuneopts="-c 0 -i 0" +logical /home 100-40% ext4 rw,noatime,nosuid,nodev createopts="-m 1" tuneopts="-c 0 -i 0" +logical /srv 1G-50% ext4 rw,noatime createopts="-m 1" tuneopts="-c 0 -i 0" diff --git a/fai/config/disk_config/LVM b/fai/config/disk_config/LVM new file mode 100644 index 0000000..f1b43fc --- /dev/null +++ b/fai/config/disk_config/LVM @@ -0,0 +1,15 @@ +# + +# entire disk with LVM, separate /home + +disk_config disk1 fstabkey:uuid align-at:1M + +primary /boot 200 ext2 rw,noatime +primary - 4G- - - + +disk_config lvm + +vg vg1 disk1.2 +vg1-root / 3G-15G ext4 noatime,rw +vg1-swap swap 200-4G swap sw +vg1-home /home 600- ext4 noatime,nosuid,nodev,rw diff --git a/fai/config/files/etc/rc.local/FAISERVER b/fai/config/files/etc/rc.local/FAISERVER index 764c62a..6640ab1 100755 --- a/fai/config/files/etc/rc.local/FAISERVER +++ b/fai/config/files/etc/rc.local/FAISERVER @@ -26,7 +26,7 @@ echo "=================================" >/dev/console 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" + 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) echo "APTPROXY=http://$myip:3142" >> /srv/fai/config/class/DEBIAN.var # determine a fast mirror for Ubuntu @@ -35,7 +35,7 @@ if [ ! -d "$FAI_CONFIGDIR/class" ]; then sed -i -e "s#MIRRORURL#$mirror#" /srv/fai/config/files/etc/apt/sources.list/UBUNTU fi # set the LOGUSER, wo we get all the logs from our install clients -ainsl /etc/fai/fai.conf "LOGUSER=fai" +ainsl /etc/fai/fai.conf "^LOGUSER=fai" # make index, then import the packages from the CD mirror apt-get update diff --git a/fai/config/hooks/instsoft.DEBIAN b/fai/config/hooks/instsoft.DEBIAN index f036e2a..c503a04 100755 --- a/fai/config/hooks/instsoft.DEBIAN +++ b/fai/config/hooks/instsoft.DEBIAN @@ -8,7 +8,7 @@ if [ $FAI_ACTION != "install" ]; then fi fcopy -Bi /etc/apt/apt.conf.d/force_confdef -ainsl -av /etc/ucf.conf "conf_force_conffold=YES" +ainsl -av /etc/ucf.conf "^conf_force_conffold=YES" install_packages -l 2>/dev/null | egrep -q ' locales|locales ' if [ $? -eq 0 ]; then diff --git a/fai/config/hooks/savelog.LAST.sh b/fai/config/hooks/savelog.LAST.sh index 994a947..74aa116 100755 --- a/fai/config/hooks/savelog.LAST.sh +++ b/fai/config/hooks/savelog.LAST.sh @@ -10,6 +10,7 @@ errfile=$LOGDIR/error.log globalerrorpatterns="error fail warn + bad bad no space syntax diff --git a/fai/config/hooks/setup.DEFAULT.sh b/fai/config/hooks/setup.DEFAULT.sh index 711fa7f..bd9c3be 100755 --- a/fai/config/hooks/setup.DEFAULT.sh +++ b/fai/config/hooks/setup.DEFAULT.sh @@ -2,4 +2,10 @@ # use short hostname instead of FQDN export HOSTNAME=${HOSTNAME%%.*} -echo $HOSTNAME > /proc/sys/kernel/hostname +# n.b. use $action instead of $FAI_ACTION +# as the latter is apparently unset at this point in dirinstall +if [ "$action" = "dirinstall" ] ; then + : +else + echo $HOSTNAME > /proc/sys/kernel/hostname +fi diff --git a/fai/config/hooks/updatebase.UBUNTU b/fai/config/hooks/updatebase.UBUNTU index 226fb75..dadaa48 100755 --- a/fai/config/hooks/updatebase.UBUNTU +++ b/fai/config/hooks/updatebase.UBUNTU @@ -2,13 +2,11 @@ # use external mirror, remove this script when using a mirror from CD -dist=trusty - cat < $target/etc/apt/sources.list # external mirror -deb MIRRORURL $dist main restricted universe multiverse -deb MIRRORURL $dist-updates main restricted universe multiverse -deb MIRRORURL $dist-security main restricted universe multiverse +deb MIRRORURL $ubuntudist main restricted universe multiverse +deb MIRRORURL $ubuntudist-updates main restricted universe multiverse +deb MIRRORURL $ubuntudist-security main restricted universe multiverse EOM # determine a fast mirror for Ubuntu diff --git a/fai/config/package_config/CENTOS b/fai/config/package_config/CENTOS index 96f8719..a4ea3e0 100644 --- a/fai/config/package_config/CENTOS +++ b/fai/config/package_config/CENTOS @@ -9,7 +9,7 @@ gnome-desktop # CentOS 7 PACKAGES yumi authconfig kernel -# grub # CentOS 5 and 6 +# sysvinit-tools grub # CentOS 5 and 6 grub2 # CentOS 7 less openssh @@ -26,3 +26,6 @@ pakchois ncurses-base # currently missing in the base file #sendmail # only for C5 and C6 + +PACKAGES yumi LVM +lvm2 diff --git a/fai/config/package_config/GERMAN b/fai/config/package_config/GERMAN new file mode 100644 index 0000000..6ef01fa --- /dev/null +++ b/fai/config/package_config/GERMAN @@ -0,0 +1,5 @@ +PACKAGES aptitude +task-german + +PACKAGES aptitude GNOME +iceweasel-l10n-de icedove-l10n-de diff --git a/fai/config/package_config/XFCE b/fai/config/package_config/XFCE index a248674..965f5a0 100644 --- a/fai/config/package_config/XFCE +++ b/fai/config/package_config/XFCE @@ -1,5 +1,5 @@ PACKAGES aptitude xfce4 # base system xfce4-goodies # additional tools -xdm +lightdm iceweasel diff --git a/fai/config/scripts/CENTOS/30-mkinitrd b/fai/config/scripts/CENTOS/30-mkinitrd index 89357b9..cd114f9 100755 --- a/fai/config/scripts/CENTOS/30-mkinitrd +++ b/fai/config/scripts/CENTOS/30-mkinitrd @@ -42,6 +42,11 @@ 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 @@ -49,6 +54,11 @@ if [ -f $target/usr/sbin/dracut ]; then $ROOTCMD dracut -v --kver $version --force fi -# for CentOS 6 we do not need to call dracut +# 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 exit $error diff --git a/fai/config/scripts/DEBIAN/30-interface b/fai/config/scripts/DEBIAN/30-interface index c3fbeaa..9883731 100755 --- a/fai/config/scripts/DEBIAN/30-interface +++ b/fai/config/scripts/DEBIAN/30-interface @@ -2,7 +2,7 @@ error=0; trap 'error=$(($?>$error?$?:$error))' ERR # save maximum error code -if ifclass DHCPC && [ $FAI_ACTION = "install" ] +if ifclass DHCPC && [ $FAI_ACTION = "install" -o $FAI_ACTION = "dirinstall" ] then cat > $target/etc/network/interfaces <<-EOF # generated by FAI @@ -10,7 +10,7 @@ then iface lo inet loopback iface $NIC1 inet dhcp EOF -elif [ $FAI_ACTION = "install" ] +elif [ $FAI_ACTION = "install" -o $FAI_ACTION = "dirinstall" ] then [ -n "$IPADDR" ] && cat > $target/etc/network/interfaces <<-EOF # generated by FAI diff --git a/fai/config/scripts/LAST/50-misc b/fai/config/scripts/LAST/50-misc index 62c31db..25b6ce7 100755 --- a/fai/config/scripts/LAST/50-misc +++ b/fai/config/scripts/LAST/50-misc @@ -4,20 +4,24 @@ error=0; trap 'error=$(($?>$error?$?:$error))' ERR # save maximum error code -# check if mdadm has been forgotten -if grep -q active /proc/mdstat 2>/dev/null; then +if [ "$FAI_ACTION" = "dirinstall" ] ; then + : +else + # check if mdadm has been forgotten + if grep -q active /proc/mdstat 2>/dev/null; then if [ ! -d $target/etc/mdadm ]; then echo ERROR: Found Software RAID, but the mdadm package was not installed error=1 fi -fi + fi -usedm=$(dmsetup ls | egrep -v '^live-rw|^live-base|^No devices found' | wc -l) -if [ $usedm -ne 0 ]; then + usedm=$(dmsetup ls | 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 diff --git a/fai/config/scripts/UBUNTU/90-apt b/fai/config/scripts/UBUNTU/90-apt index 072e560..b75555b 100755 --- a/fai/config/scripts/UBUNTU/90-apt +++ b/fai/config/scripts/UBUNTU/90-apt @@ -3,13 +3,11 @@ # check if we already use an external mirror grep -q "external mirror" $target/etc/apt/sources.list && exit 0 -dist=trusty - cat < $target/etc/apt/sources.list # external mirror -deb MIRRORURL $dist main restricted universe multiverse -deb MIRRORURL $dist-updates main restricted universe multiverse -deb MIRRORURL $dist-security main restricted universe multiverse +deb MIRRORURL $ubuntudist main restricted universe multiverse +deb MIRRORURL $ubuntudist-updates main restricted universe multiverse +deb MIRRORURL $ubuntudist-security main restricted universe multiverse EOM # determine a fast mirror for Ubuntu -- 2.30.2