From f6b9ade60186b7be2ecf39266ced982ec7efc633 Mon Sep 17 00:00:00 2001 From: Ian Kelling Date: Fri, 16 Sep 2016 08:48:01 -0700 Subject: [PATCH] add xenial support with basic debian parity --- fai-redep | 3 +++ fai-revm | 7 +++++-- fai/config/class/50-host-classes | 9 +++++---- fai/config/class/DEBIAN.var | 2 +- fai/config/class/UBUNTU.var | 2 +- .../{NON_FREE => DEBIAN_NON_FREE} | 0 .../{NON_FREE => DEBIAN_NON_FREE} | 0 .../etc/apt/sources.list.d/xenial.list/XENIAL64 | 11 +++++++++++ fai/config/hooks/partition.DEFAULT | 1 + fai/config/hooks/updatebase.UBUNTU | 16 +--------------- fai/config/package_config/FAIBASE | 2 +- fai/config/package_config/UBUNTU | 2 +- fai/config/scripts/GRUB_PC/11-ian | 16 ++++++++++++++-- fai/config/scripts/LAST/50-misc | 2 +- fai/config/scripts/UBUNTU/10-rootpw | 1 + fai/config/scripts/UBUNTU/30-interface | 1 + fai/config/scripts/UBUNTU/90-apt | 16 ---------------- 17 files changed, 47 insertions(+), 44 deletions(-) mode change 100644 => 120000 fai/config/class/UBUNTU.var rename fai/config/files/etc/apt/sources.list.d/testing-non-free.list/{NON_FREE => DEBIAN_NON_FREE} (100%) rename fai/config/files/etc/apt/sources.list.d/unstable-non-free.list/{NON_FREE => DEBIAN_NON_FREE} (100%) create mode 100644 fai/config/files/etc/apt/sources.list.d/xenial.list/XENIAL64 mode change 100755 => 120000 fai/config/hooks/updatebase.UBUNTU create mode 120000 fai/config/scripts/UBUNTU/10-rootpw create mode 120000 fai/config/scripts/UBUNTU/30-interface delete mode 100755 fai/config/scripts/UBUNTU/90-apt diff --git a/fai-redep b/fai-redep index de4fe30..43d34bb 100755 --- a/fai-redep +++ b/fai-redep @@ -46,4 +46,7 @@ ssh root@$faiserver_host bash <<'EOF' set -eE -o pipefail chmod 644 /srv/fai/config/files/home/ian/.ssh/authorized_keys/GRUB_PC chmod -R a+rX /srv/fai/config/distro-install-common +cd /srv/fai/config/basefiles +u=http://fai-project.org/download/basefiles/XENIAL64.tar.xz +wget -nv -O /srv/fai/config/basefiles/${u##*/} $u EOF diff --git a/fai-revm b/fai-revm index d8833ab..547689d 100755 --- a/fai-revm +++ b/fai-revm @@ -65,7 +65,9 @@ if [[ $1 == -r ]]; then redeploy=false fi -disk_count=2 +# change this to test different disk counts. 1 and > 1 should be the only +# important things to test. +disk_count=1 if [[ $script_dir == /a/bin/* ]]; then @@ -95,7 +97,8 @@ else if $redeploy; then ./fai-redep fi - variant=debian8 + variant=ubuntu16.04 + #variant=debian8 fi name=demohost diff --git a/fai/config/class/50-host-classes b/fai/config/class/50-host-classes index 6f32a08..6f3f8a8 100755 --- a/fai/config/class/50-host-classes +++ b/fai/config/class/50-host-classes @@ -24,12 +24,13 @@ # We check the reverse condition in 51-multi-boot, # and set what os we are installing, but don't check it # into git since it changes regularly. Each host needs -# to have a class of either STABLE or STRETCH64. +# to have a class of either DEBIAN + STABLE or STRETCH64, +# or UBUNTU + XENIAL64. # # It's shell looks like this: # if [[ ! -e /a/bin/fai/fai-wrapper ]]; then # case $HOSTNAME in -# tp) STABLE ;; +# tp) DEBIAN STABLE ;; # # add more multi-boot hostnames here # esac # fi @@ -39,10 +40,10 @@ if [[ -e /a/bin/fai/fai-wrapper ]] && isdebian-stable; then fi # use a list of classes for our demo machine -echo "FAIBASE DEBIAN PARTITION_PROMPT" +echo "FAIBASE PARTITION_PROMPT" case $HOSTNAME in x2|frodo|treetowl) - echo "NON_FREE" + echo "DEBIAN_NON_FREE" if [[ -e /a/bin/fai/fai-wrapper ]] && isdebian-stable; then echo "STABLE_NON_FREE" fi diff --git a/fai/config/class/DEBIAN.var b/fai/config/class/DEBIAN.var index 1f6e441..397b5ea 100644 --- a/fai/config/class/DEBIAN.var +++ b/fai/config/class/DEBIAN.var @@ -10,7 +10,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. -# uncommented from upstream +# ian: uncommented FAI_RAMDISKS="$target/var/lib/dpkg $target/var/cache" # if you want to use the faiserver as APT proxy diff --git a/fai/config/class/UBUNTU.var b/fai/config/class/UBUNTU.var deleted file mode 100644 index f45c3ce..0000000 --- a/fai/config/class/UBUNTU.var +++ /dev/null @@ -1 +0,0 @@ -ubuntudist=xenial diff --git a/fai/config/class/UBUNTU.var b/fai/config/class/UBUNTU.var new file mode 120000 index 0000000..702cb15 --- /dev/null +++ b/fai/config/class/UBUNTU.var @@ -0,0 +1 @@ +DEBIAN.var \ No newline at end of file diff --git a/fai/config/files/etc/apt/sources.list.d/testing-non-free.list/NON_FREE b/fai/config/files/etc/apt/sources.list.d/testing-non-free.list/DEBIAN_NON_FREE similarity index 100% rename from fai/config/files/etc/apt/sources.list.d/testing-non-free.list/NON_FREE rename to fai/config/files/etc/apt/sources.list.d/testing-non-free.list/DEBIAN_NON_FREE diff --git a/fai/config/files/etc/apt/sources.list.d/unstable-non-free.list/NON_FREE b/fai/config/files/etc/apt/sources.list.d/unstable-non-free.list/DEBIAN_NON_FREE similarity index 100% rename from fai/config/files/etc/apt/sources.list.d/unstable-non-free.list/NON_FREE rename to fai/config/files/etc/apt/sources.list.d/unstable-non-free.list/DEBIAN_NON_FREE diff --git a/fai/config/files/etc/apt/sources.list.d/xenial.list/XENIAL64 b/fai/config/files/etc/apt/sources.list.d/xenial.list/XENIAL64 new file mode 100644 index 0000000..452f266 --- /dev/null +++ b/fai/config/files/etc/apt/sources.list.d/xenial.list/XENIAL64 @@ -0,0 +1,11 @@ +###### Ubuntu Main Repos +deb http://us.archive.ubuntu.com/ubuntu/ xenial main universe +deb-src http://us.archive.ubuntu.com/ubuntu/ xenial main universe + +###### Ubuntu Update Repos +deb http://us.archive.ubuntu.com/ubuntu/ xenial-security main universe +deb http://us.archive.ubuntu.com/ubuntu/ xenial-updates main universe +deb http://us.archive.ubuntu.com/ubuntu/ xenial-backports main universe +deb-src http://us.archive.ubuntu.com/ubuntu/ xenial-security main universe +deb-src http://us.archive.ubuntu.com/ubuntu/ xenial-updates main universe +deb-src http://us.archive.ubuntu.com/ubuntu/ xenial-backports main universe diff --git a/fai/config/hooks/partition.DEFAULT b/fai/config/hooks/partition.DEFAULT index 39c0b3f..8c3140b 100755 --- a/fai/config/hooks/partition.DEFAULT +++ b/fai/config/hooks/partition.DEFAULT @@ -342,6 +342,7 @@ EOF # these 2 are alternative ways to identify a subvol, i think i prefer the 2nd. if ifclass treetowl; then cat >> /tmp/fai/fstab <<'EOF' +$first_root_crypt /i btrfs noatime,subvol=i 0 0 UUID=3f7b31cd-f299-40b4-a86b-7604282e2715 /i btrfs noatime 0 2 EOF fi diff --git a/fai/config/hooks/updatebase.UBUNTU b/fai/config/hooks/updatebase.UBUNTU deleted file mode 100755 index dadaa48..0000000 --- a/fai/config/hooks/updatebase.UBUNTU +++ /dev/null @@ -1,15 +0,0 @@ -#! /bin/bash - -# use external mirror, remove this script when using a mirror from CD - -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 -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/hooks/updatebase.UBUNTU b/fai/config/hooks/updatebase.UBUNTU new file mode 120000 index 0000000..77bc497 --- /dev/null +++ b/fai/config/hooks/updatebase.UBUNTU @@ -0,0 +1 @@ +updatebase.DEBIAN \ No newline at end of file diff --git a/fai/config/package_config/FAIBASE b/fai/config/package_config/FAIBASE index 591327b..cab58ba 100644 --- a/fai/config/package_config/FAIBASE +++ b/fai/config/package_config/FAIBASE @@ -1,4 +1,4 @@ -PACKAGES aptitude DEBIAN +PACKAGES aptitude DEBIAN UBUNTU fai-client cron debconf-utils diff --git a/fai/config/package_config/UBUNTU b/fai/config/package_config/UBUNTU index 6028909..4a5a976 100644 --- a/fai/config/package_config/UBUNTU +++ b/fai/config/package_config/UBUNTU @@ -13,7 +13,7 @@ PACKAGES install DHCPC isc-dhcp-client PACKAGES install GRUB_PC -grub-pc +grub-pc cryptsetup btrfs-tools bridge-utils PACKAGES aptitude-r XORG ubuntu-desktop diff --git a/fai/config/scripts/GRUB_PC/11-ian b/fai/config/scripts/GRUB_PC/11-ian index 5d064be..11cd818 100755 --- a/fai/config/scripts/GRUB_PC/11-ian +++ b/fai/config/scripts/GRUB_PC/11-ian @@ -26,9 +26,10 @@ fi if ifclass DEBIAN; then fcopy -M /etc/apt/preferences.d/unstable - fcopy -riM /etc/apt/sources.list.d - $ROOTCMD apt-get update fi +fcopy -riM /etc/apt/sources.list.d +$ROOTCMD apt-get update + # note: @@ -55,6 +56,17 @@ chmod 700 /root/.ssh # default jessie groups + kvm, systemd-journal, adm usermod -aG adm,cdrom,floppy,sudo,audio,dip,video,plugdev,netdev,systemd-journal ian + +# https://askubuntu.com/questions/33416/how-do-i-disable-the-boot-splash-screen-and-only-show-kernel-and-boot-text-inst +# it suggests not having plymouth-theme-ubuntu-text, but +# making it not installed then kills plymouth, then makes +# the system not boot. +sed -ri 's/(^ *GRUB_CMDLINE_LINUX.*)quiet splash/\1/' /etc/default/grub +# on xenial, no grub is displayed at all. fix that. +# found just by noticing this in the config file, and a +# warning about it in error.log +sed -i '/^ *GRUB_HIDDEN_TIMEOUT/d' /etc/default/grub +update-grub2 EOF diff --git a/fai/config/scripts/LAST/50-misc b/fai/config/scripts/LAST/50-misc index 11bafd5..232b0c8 100755 --- a/fai/config/scripts/LAST/50-misc +++ b/fai/config/scripts/LAST/50-misc @@ -46,7 +46,7 @@ if [ $do_init_tasks -eq 1 ] ; then fi # Make sure everything is configured properly -if ifclass DEBIAN ; then +if ifclass DEBIAN || ifclass UBUNTU; then echo "Running \"apt-get -f install\" for the last time." $ROOTCMD apt-get -f install fi diff --git a/fai/config/scripts/UBUNTU/10-rootpw b/fai/config/scripts/UBUNTU/10-rootpw new file mode 120000 index 0000000..c0d9817 --- /dev/null +++ b/fai/config/scripts/UBUNTU/10-rootpw @@ -0,0 +1 @@ +../DEBIAN/10-rootpw \ No newline at end of file diff --git a/fai/config/scripts/UBUNTU/30-interface b/fai/config/scripts/UBUNTU/30-interface new file mode 120000 index 0000000..e3dce43 --- /dev/null +++ b/fai/config/scripts/UBUNTU/30-interface @@ -0,0 +1 @@ +../DEBIAN/30-interface \ No newline at end of file diff --git a/fai/config/scripts/UBUNTU/90-apt b/fai/config/scripts/UBUNTU/90-apt deleted file mode 100755 index b75555b..0000000 --- a/fai/config/scripts/UBUNTU/90-apt +++ /dev/null @@ -1,16 +0,0 @@ -#! /bin/bash - -# check if we already use an external mirror -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 -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 -- 2.30.2