X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=fai%2Fconfig%2Fscripts%2FIANK%2F11-iank;h=1aa974057798a449b7ae9c08c85fffeb0b645c70;hb=839b3cf02ad7e8900b3d685d54449f11e7b60b60;hp=47b97ad98720d08c4d48338369b413929180bbf5;hpb=4abbc67ed68213ec94fcf5970d3e34661967a87c;p=automated-distro-installer diff --git a/fai/config/scripts/IANK/11-iank b/fai/config/scripts/IANK/11-iank index 47b97ad..1aa9740 100755 --- a/fai/config/scripts/IANK/11-iank +++ b/fai/config/scripts/IANK/11-iank @@ -19,20 +19,27 @@ if [[ -e /a/bin/fai/fai-wrapper ]]; then } fi - +if [[ $FAI_ROOT == / ]]; then + source /a/bin/bash_unpublished/source-state + bprogs_dir=/a/opt/btrfs-progs-release +else + bprogs_dir=/srv/btrfs-progs-release + chroot="chroot $FAI_ROOT" +fi # -r = recursive # -i = ignore non-matching class warnings, always exit 0 # -B = no backup files -fcopy -riBM /boot +fcopy -riB /boot # this is also done by FAIBASE/10-misc by default (without B) -fcopy -riBM /root -fcopy -riBM /usr/local/bin +fcopy -riB /usr/local/bin + +fcopy -riB /etc/apt/logind.conf.d # this gets done by fai, but just happens too often that # I add sources due to new distros, whatever. -fcopy -riBM /etc/apt/preferences.d -fcopy -riBM /etc/apt/sources.list.d +fcopy -riB /etc/apt/preferences.d +fcopy -riB /etc/apt/sources.list.d src=$FAI/distro-install-common/shadow @@ -52,16 +59,13 @@ $FAI/distro-install-common/end # I run this as a single post-fai script to update things that have changed. tmpfile1=$(mktemp) # this can fail if we need an apt update -chroot $FAI_ROOT /usr/bin/apt-cache policy >$tmpfile1 ||: -fcopy -riBM /etc/apt - -# get ubuntu key, for running from fai wrapper. -apt-key add $FAI/package_config/UBUNTU.asc +$chroot /usr/bin/apt-cache policy >$tmpfile1 ||: +fcopy -riB /etc/apt tmpfile2=$(mktemp) -chroot $FAI_ROOT /usr/bin/apt-cache policy >$tmpfile2 +$chroot /usr/bin/apt-cache policy >$tmpfile2 if ! diff -q $tmpfile1 $tmpfile2; then - chroot $FAI_ROOT /usr/bin/apt update + $chroot /usr/bin/apt update fi # outside of fai, this seems to regularly lead to # E: Could not get lock /var/lib/apt/lists/lock - open (11: Resource temporarily unavailable) @@ -84,29 +88,9 @@ fi #### misc configurations -chroot $FAI_ROOT bash <<'EOFOUTER' -if getent group systemd-journal >/dev/null; then - # makes the journal be saved to disk. - mkdir -p /var/log/journal - chmod 755 /var/log/journal -fi -debconf-set-selections <$FAI_ROOT/etc/grub.d/40_custom </dev/null; then - update-grub2 -else - update-grub -fi - -EOF fi ##### end != dirinstall && != NOCRYPT @@ -213,7 +151,9 @@ esac # xorg stopped load nouveau # https://www.linuxquestions.org/questions/slackware-14/kernel-modules-conflicting-with-nouveau-driver-4175623867/ # https://nouveau.freedesktop.org/InstallNouveau.html -if lspci|grep -q 'GeForce GTX 6[0-9][0-9]\]'; then +# And now in t11, things got worse with a newer card also not loading +# nouveau when it did in t10. +if lspci|grep -q 'VGA compatible controller: NVIDIA'; then mkdir -p $target/etc/X11/xorg.conf.d/ cat >$target/etc/X11/xorg.conf.d/10-nouveau.conf <<'EOF' Section "Device" @@ -225,7 +165,7 @@ fi # use networkmanager if this host has wireless. if [[ $HOSTNAME == bo ]] || type -p iw &>/dev/null && [[ $(iw dev) ]]; then - chroot $FAI_ROOT bash < $target/etc/network/interfaces <<-EOF -# generated by FAI -auto lo eth0 -iface lo inet loopback -iface eth0 inet static -address 10.3.0.2/16 - -source-directory /etc/network/interfaces.d -EOF - fi - else cat > $target/etc/network/interfaces <<-EOF # generated by FAI @@ -280,6 +208,72 @@ EOF fi +# for new btrfs features, get latest stable kernel and btrfs progs, +# update ver= as needed. +case $HOSTNAME in + sy) + mkdir -p $FAI_ROOT/tmp/kernel-debs + files=($FAI_ROOT/tmp/kernel-debs/*) + if (( ${#files[@]} >= 1 )); then + rm -rf "${files[@]}" + fi + cd $FAI_ROOT/tmp/kernel-debs + ver='6\.6' + va=$(curl -s https://kernel.ubuntu.com/mainline/ | \ + sed -rn 's,.*alt="\[DIR\]".*href="([^/]+).*,\1,p' | \ + grep -v -- -rc | sed 's/^v//' | grep "^$ver" | sort -V | tail -n1) + + # note the wiki page about these says to install linux-headers.*generic.*amd64, but + # as of 2024, they have a requirement of a very new glibc, and people report + # that installing it is not needed. + pkgs=$(curl -s https://kernel.ubuntu.com/mainline/v$va/amd64/CHECKSUMS | awk '$2 ~ /^linux-/ { print $2 }' | sort -u | grep -iv 'linux-headers.*generic.*amd64' ) + + urls=() + for p in $pkgs; do + if ! dpkg -s -- "${p%%_*}" 2>&1 | grep -Fx "Status: install ok installed" &>/dev/null; then + urls+=(https://kernel.ubuntu.com/mainline/v$va/amd64/$p) + fi + done + if (( ${#urls[@]} >= 1 )); then + wget "${urls[@]}" + $chroot bash </dev/null | awk '{print $2}') ||: +if [[ $ver != "$cur_ver" ]]; then + if [[ $HOST2 == $HOSTNAME && $ver != "$($bprogs_dir/btrfs --version 2>/dev/null | awk '{print $2}')" ]]; then + rm -rf $bprogs_dir + cd /tmp + wget $url + sudo -u iank tar xzf $tarball + mv ${tarball%.tar.gz} $bprogs_dir + cd $bprogs_dir + apt-get -y build-dep btrfs-progs + sudo -u iank ./configure --disable-documentation + sudo -u iank make + make install + else + $chroot bash -xe <$target/etc/initramfs-tools/conf.d/mine < $target/etc/network/interfaces <<-EOF # generated by FAI auto lo eth0 @@ -315,19 +308,13 @@ EOF fi fi -# I prefer to stick with ifup/down for now. a. networkd is not in its -# own package, so cant use in other init systems. b. it works fine. -chroot $FAI_ROOT bash <