ip config changes, do kernel upgrades
authorIan Kelling <iank@fsf.org>
Sun, 14 Apr 2024 20:54:40 +0000 (16:54 -0400)
committerIan Kelling <iank@fsf.org>
Sun, 14 Apr 2024 20:54:40 +0000 (16:54 -0400)
fai-redep
fai/config/scripts/IANK/11-iank
wrt-setup-local

index de195d56e4893f7c39285604781bcee52fe57d7c..5e08b2f4b106329291c349b83b28607f60dccf3e 100755 (executable)
--- a/fai-redep
+++ b/fai-redep
@@ -76,7 +76,7 @@ install --owner=iank --group=iank -d fai/config/files/usr/local/bin/hssh
 install --owner=iank --group=iank -d fai/config/files/usr/local/bin/ssh_filter_btrbk.sh
 rsync -atL /a/opt/btrbk/ssh_filter_btrbk.sh fai/config/files/usr/local/bin/ssh_filter_btrbk.sh/STANDARD
 
-m rsync -rlpt --delete --relative --exclude /fai/config/basefiles/ fai/config /a/opt/btrfs-progs-release/btrfs-progs-v6.3.2 "${rpre[@]}"/srv
+m rsync -rlpt --delete --relative --exclude /fai/config/basefiles/ fai/config /a/opt/btrfs-progs-release "${rpre[@]}"/srv
 
 # todo: automatically disable faiserver after a period so
 # these files are not available.
index 0b8d6c5576caba9763234f1de2bbca79f9a0e41a..1aa974057798a449b7ae9c08c85fffeb0b645c70 100755 (executable)
@@ -19,8 +19,11 @@ if [[ -e /a/bin/fai/fai-wrapper ]]; then
   }
 fi
 
-if [[ $FAI_ROOT != / ]]; then
-  bprogs_pre=/srv
+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
 
@@ -117,7 +120,7 @@ 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
@@ -205,21 +208,33 @@ EOF
 
 fi
 
-# for btrfs bug reporting, install latest kernel and btrfs progs, as of
-# 2023-07-21
+# 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
-    va=6.4.3
-    vb=$va-060403
-    vc=${vb}.202307110536
-    pre="https://kernel.ubuntu.com/~kernel-ppa/mainline/v$va/amd64/linux-"
-    if ! dpkg -s -- linux-headers-${vb}  2>&1 | grep -Fx "Status: install ok installed" &>/dev/null; then
-      urls=(
-        ${pre}headers-${vb}_${vc}_all.deb
-        ${pre}{headers,image-unsigned,modules}-${vb}-generic_${vc}_amd64.deb
-      )
+    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 <<EOF
 cd /tmp/kernel-debs
@@ -232,12 +247,32 @@ EOF
     ;;
 esac
 
-cp -ra $bprogs_pre/a/opt/btrfs-progs-release/btrfs-progs-v6.3.2 $FAI_ROOT/tmp/btrfs-progs
-$chroot bash <<EOF
-cd /tmp/btrfs-progs
+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${ver}.*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 <<EOF
+cd $bprogs_dir
 make install
 EOF
-
+  fi
+fi
 
 if ifclass LINODE; then
   mkdir -p $target/etc/initramfs-tools/conf.d
@@ -312,7 +347,6 @@ fi
 # but that made a service that started too soon and didn't pick up our
 # x env vars. instead, copy from the root ssh-agent just the
 # appropriate things into a new service.
-rm -f /home/iank/.config/systemd/user/default.target.wants/ssh-agent.service
 
 rm -f /home/iank/.local/share/systemd/user/sshaiank.service \
   /home/iank/.config/systemd/user/default.target.wants/sshaiank.service
index 39321173d639f6295e1309cdafe2d296779e387f..d9f11ab9aac9701ef8dc22ebe50bfd8b8c630add 100755 (executable)
@@ -789,9 +789,9 @@ config rule
 config redirect
  option name sshfrodo
  option src              wan
- option src_dport        2228
- option dest_port        22
- option dest_ip          $l.28
+ option src_dport        2234
+ option dest_port        34
+ option dest_ip          $l.34
  option dest             lan
 config rule
  option src              wan
@@ -824,6 +824,18 @@ config rule
  option dest_port        $wgport
  option proto            udp
 
+config redirect
+ option name navidromehttps
+ option src              wan
+ option src_dport        4500
+ option dest_port        4500
+ option dest_ip          $l.2
+ option dest             lan
+config rule
+ option src              wan
+ option target           ACCEPT
+ option dest_port        4500
+
 config redirect
  option name navidrome
  option src              wan
@@ -864,7 +876,7 @@ config redirect
  option src              wan
  option src_dport        80
  option dest             lan
- option dest_ip          $l.2
+ option dest_ip          $l.12
  option proto            tcp
 config rule
  option src              wan
@@ -877,7 +889,7 @@ config redirect
  option src              wan
  option src_dport        443
  option dest             lan
- option dest_ip          $l.2
+ option dest_ip          $l.12
  option proto            tcp
 config rule
  option src              wan
@@ -1284,11 +1296,11 @@ dhcp-host=00:1b:a9:8c:a8:23,set:brother,$l.19,brother
 dhcp-host=00:26:b6:f7:d4:d8,set:amyw,$l.23,amyw
 dhcp-host=9a:c6:52:6f:ce:7c,set:onep9,$l.24,onep9
 dhcp-host=38:63:bb:07:5a:f9,set:hp,$l.25,hp
-dhcp-host=14:dd:a9:d5:31:7a,set:frodo,$l.28,frodo
-#dhcp-host=00:26:b6:f6:0f:e9,set:frodow,$l.28,frodow
 dhcp-host=70:a6:cc:3a:bb:b4,set:bow,$l.29,bow
 dhcp-host=6c:56:97:88:7b:74,set:amazontab,$l.31,amazontab
 dhcp-host=0a:8a:9b:cf:b5:ec,set:samsungtab,$l.32,samsungtab
+dhcp-host=14:dd:a9:d5:31:7a,set:frodo,$l.34,frodo
+#dhcp-host=00:26:b6:f6:0f:e9,set:frodow,$l.34,frodow
 # server d16:
 dhcp-host=38:2c:4a:c9:33:13,set:bigs,$l.48,bigs
 dhcp-host=e4:5f:01:07:50:40,set:pi4,$l.49,pi4