X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=fai%2Fconfig%2Fscripts%2FIANK%2F11-iank;h=6efc767dc344021a59875811401c271928bb62b9;hb=8716af32fa1f2822286917a1acf399d80df824be;hp=5245b35ae7a210dd1bf4733f61a86d4f2dfe417f;hpb=137ffae7de84a51c4b438ccf2fb50f5571f522a6;p=automated-distro-installer diff --git a/fai/config/scripts/IANK/11-iank b/fai/config/scripts/IANK/11-iank index 5245b35..6efc767 100755 --- a/fai/config/scripts/IANK/11-iank +++ b/fai/config/scripts/IANK/11-iank @@ -1,4 +1,20 @@ #!/bin/bash -x +# This file is part of Ian Kelling's automated-distro-installer +# Copyright (C) 2024 Ian Kelling + +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. set -eE -o pipefail trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR @@ -19,7 +35,13 @@ 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 @@ -28,6 +50,8 @@ fcopy -riB /boot # this is also done by FAIBASE/10-misc by default (without B) 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 -riB /etc/apt/preferences.d @@ -51,13 +75,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 ||: +$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) @@ -107,12 +131,12 @@ TimeoutStartSec=20 WantedBy=dev-disk-by\x2did-ata\x2dSamsung_SSD_870_QVO_8TB_S5VUNG0N900656V.device EOF - chroot $FAI_ROOT bash <<'EOFOUTER' + $chroot bash <<'EOFOUTER' systemctl enable myncq.service /usr/bin/myncq no-upgrub EOFOUTER - ;; + ;;& # per rubens suggestion to make a d16 more stable kd|kw) cmdline+=" pci=realloc=off" ;; esac @@ -143,7 +167,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" @@ -155,7 +181,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 @@ -210,6 +224,42 @@ EOF fi +case $HOSTNAME in + sy) + $FAI/distro-install-common/install-stable-kernel-debs + ;; + *) + $chroot apt-get -y install linux-libre + ;; +esac + +pre=https://mirrors.edge.kernel.org/pub/linux/kernel/people/kdave/btrfs-progs +tarball=$(curl -s $pre/sha256sums.asc \ + | awk '$2 ~ /^btrfs-progs-v/ { print $2 }' | grep -v -- -rc | grep "^btrfs-progs-v.*gz\$" | sort -V | tail -n1) +url="$pre/$tarball" +dir=${tarball%.tar.gz} +ver=${dir#btrfs-progs-} +cur_ver=$(btrfs --version 2>/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 <