# E: Could not get lock /var/lib/apt/lists/lock - open (11: Resource temporarily unavailable)
# so add a sleep. 1 sec is probably way more than needed.
sleep 1
-$ROOTCMD apt-get update
+f=$FAI_ROOT/var/cache/apt/pkgcache.bin
+if [[ ! -r $f ]] || (( $(( $(date +%s) - $(stat -c %Y $f ) )) > 60*60*2 )); then
+ $ROOTCMD apt-get update
+fi
chroot $FAI_ROOT bash <<'EOF'
if [[ $FAI_ACTION != dirinstall ]]; then
- if ifclass BUSTER_LINODE; then
+ if ifclass LINODE; then
speed=19200
# luks.crypttab=no see man systemd-cryptsetup-generator
cmdline="luks.crypttab=no console=ttyS0,${speed}n8"
EOF
-
chroot $FAI_ROOT bash <<EOF
set -eE -o pipefail
# https://askubuntu.com/questions/33416/how-do-i-disable-the-boot-splash-screen-and-only-show-kernel-and-boot-text-inst
# we remove quiet and splash, and all thats left is what we want
-sed -ri 's/^ *GRUB_CMDLINE_LINUX_DEFAULT=.*"/GRUB_CMDLINE_LINUX_DEFAULT="$cmdline"/' /etc/default/grub
+if grep -qF "$cmdline" /etc/default/grub; then
+ # already set things, exit
+ exit 0
+fi
+sed -ri 's/^ *GRUB_CMDLINE_LINUX_DEFAULT=.*/GRUB_CMDLINE_LINUX_DEFAULT="$cmdline"/' /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
+ if [[ ! FAI_WRAPPER ]]; then
+ chroot $FAI_ROOT bash <<EOF
# Just include all of them for now incase we are creating
# an install for a different machine.. in distro-begin, we
# slim it down to whats used.
find /lib/modules/*/kernel/drivers/net /lib/modules/*/kernel/net -type f -name '*.ko' -printf "%f\n" | sed 's/.ko$//' | sort -u >/etc/initramfs-tools/modules
update-initramfs -u -k all
EOF
+ fi
fi