use dev btrfs for a bugfix
authorIan Kelling <iank@fsf.org>
Tue, 13 Aug 2024 03:30:38 +0000 (23:30 -0400)
committerIan Kelling <iank@fsf.org>
Tue, 13 Aug 2024 03:30:38 +0000 (23:30 -0400)
fai-redep
fai/config/scripts/IANK/11-iank

index 5498667df6fd2c148f23b7096401480994f119fc..768e137c272ae0f5f04fb5acc03f8e2829915b39 100755 (executable)
--- a/fai-redep
+++ b/fai-redep
@@ -129,7 +129,7 @@ else
   rsrv -rlpt /q/root/shadow /q/root/luks /fai/config/distro-install-common
 fi
 
-rsrv -rlpt --delete /a/bin/ds/bash-lib-u /a/opt/btrfs-progs-release /fai/config/distro-install-common
+rsrv -rlpt --delete /a/bin/ds/bash-lib-u /a/opt/btrfs-progs-release /a/opt/btrfs-progs /fai/config/distro-install-common
 
 dirs=(/p/c/machine_specific/${target:-*}/filesystem/etc/ssh)
 if [[ -e ${dirs[0]} ]]; then
index 1bb328bfbce9eb5a8775500b7b032dd7d9c81d8b..56a44044bc4400226ca7869ed943e6fd5cf4ab10 100755 (executable)
@@ -383,21 +383,52 @@ case $HOSTNAME in
     ;;
 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=$($ROOTCMD btrfs --version 2>/dev/null | awk '{print $2}') ||:
+
+### using dev version temporarily. comment when done, and uncomment below
+ver='v6.10'
+
+### release version. uncomment when not using dev version
+# 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=$($ROOTCMD btrfs --version 2>/dev/null | head -n1 | awk '{print $2}') ||:
 
 if [[ $FAI_ROOT == / ]]; then
   bp_dir=/a/opt/btrfs-progs-release
+  # dev version. temporary until bug fix gets into release. comment then.
+  bp_dir=/a/opt/btrfs-progs
 else
   bp_dir=$FAI/distro-install-common/btrfs-progs-release
+  # dev version. temporary until bug fix gets into release. comment then.
+  # note, also requires change in fai-redep.
+  bp_dir=$FAI/distro-install-common/btrfs-progs
 fi
+
+last_built_ver=$($bp_dir/btrfs --version 2>/dev/null | head -n1 | awk '{print $2}')
+
 if [[ $ver != "$cur_ver" ]]; then
-  if [[ $ver != "$($bp_dir/btrfs --version 2>/dev/null | awk '{print $2}')" ]]; then
+  if [[ $ver == "$last_built_ver" ]]; then
+    if ! $ROOTCMD dpkg -s -- build-essential  2>&1 | grep -Fx "Status: install ok installed" &>/dev/null; then
+      $ROOTCMD apt-get -y install build-essential
+    fi
+
+    if [[ $FAI_ROOT == / ]]; then
+      cd $bp_dir
+      make install
+    else
+      mkdir -p $target/tmp/bprogs
+      mount -o bind $bp_dir $target/tmp/bprogs
+      $ROOTCMD bash -xe <<EOF
+cd /tmp/bprogs
+make install
+EOF
+    fi
+  else
     cd $target/tmp
     wget $url
     tar xzf $tarball
@@ -428,22 +459,8 @@ EOF
       chown -R iank:iank $target/tmp/${tarball%.tar.gz}
       mv $target/tmp/${tarball%.tar.gz} $bp_dir
     fi
-  else
-    if ! $ROOTCMD dpkg -s -- build-essential  2>&1 | grep -Fx "Status: install ok installed" &>/dev/null; then
-      $ROOTCMD apt-get -y install build-essential
-    fi
 
-    if [[ $FAI_ROOT == / ]]; then
-      cd /a/opt/btrfs-progs-release
-      make install
-    else
-      mkdir -p $target/tmp/bprogs
-      mount -o bind $bp_dir $target/tmp/bprogs
-      $ROOTCMD bash -xe <<EOF
-cd /tmp/bprogs
-make install
-EOF
-    fi
+
   fi
 fi
 ## end get new kernel and btrfs-progs ##