From aea5cdf632335df4fffa0091307fd1ebb81daf87 Mon Sep 17 00:00:00 2001 From: Ian Kelling Date: Tue, 13 Aug 2024 01:06:28 -0400 Subject: [PATCH] minor refactor --- fai/config/scripts/IANK/11-iank | 43 +++++++++++++++++---------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/fai/config/scripts/IANK/11-iank b/fai/config/scripts/IANK/11-iank index 56a4404..932f542 100755 --- a/fai/config/scripts/IANK/11-iank +++ b/fai/config/scripts/IANK/11-iank @@ -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 -- 2.30.2