minor refactor
authorIan Kelling <iank@fsf.org>
Tue, 13 Aug 2024 05:06:28 +0000 (01:06 -0400)
committerIan Kelling <iank@fsf.org>
Tue, 13 Aug 2024 05:06:28 +0000 (01:06 -0400)
fai/config/scripts/IANK/11-iank

index 56a44044bc4400226ca7869ed943e6fd5cf4ab10..932f542b71d419ee5c703e85512a30f2b1d6e8cb 100755 (executable)
@@ -383,36 +383,37 @@ case $HOSTNAME in
     ;;
 esac
 
-
-### 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-}
-
-
+### using dev version for bug fix temporarily. when done, set this to false,
+### and we can stop copying it in fai-redep.
+static_ver=true
+if $static_ver; then
+  # The version with the bug fix is really some git version, but this is
+  # what it outputs for --version.
+  ver=6.10
+  bp_dirname=btrfs-progs
+else
+  bp_dirname=btrfs-progs-release
+  # latest released 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-}
+fi
 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
+  bp_dir=/a/opt/$bp_dirname
 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
+  bp_dir=$FAI/distro-install-common/$bp_dirname
 fi
 
 last_built_ver=$($bp_dir/btrfs --version 2>/dev/null | head -n1 | awk '{print $2}')
 
 if [[ $ver != "$cur_ver" ]]; then
-  if [[ $ver == "$last_built_ver" ]]; then
+  # Assume we've build the static_ver version.
+  if $static_ver || [[ $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