[PATCH] kvm-xfstests: fix wget progress bar support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On fedora 41, running kvm-xfstest for the first time throws the
following error:

  Unknown option 'show-progress'

This is because fedora uses wget2 where the --show-progress flag
has been replaced with --force-progress [1]. Hence modify the code
to detect the wget version and use the appropriate flag.

[1] https://gitlab.com/gnuwget/wget2/-/wikis/Home#differing-cli-options-wgetwget2

Signed-off-by: Ojaswin Mujoo <ojaswin@xxxxxxxxxxxxx>
---
 run-fstests/kvm-xfstests | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/run-fstests/kvm-xfstests b/run-fstests/kvm-xfstests
index a53cc89..99e504b 100755
--- a/run-fstests/kvm-xfstests
+++ b/run-fstests/kvm-xfstests
@@ -60,7 +60,19 @@ if test -z "$EXPLICIT_ROOT_FS" ; then
 	f=root_fs.img.$ARCH
 	ROOT_FS="$(dirname $DIR)/test-appliance/$f"
 	echo "Downloading $f..."
-	wget -nv --show-progress -O "$ROOT_FS.new" "$DOWNLOAD_BASE_URL/$f"
+
+	# wget1 and 2 have different flags to show progress bar
+	WGET_VERSION=$(wget --version | head -n1 | awk '{print $3}' | cut -d. -f1)
+	if [[ "$WGET_VERSION" -eq 1 ]]; then
+			PROGRESS_FLAG="--show-progress"
+	elif [[ "$WGET_VERSION" -eq 2 ]]; then
+			PROGRESS_FLAG="--force-progress"
+	else
+			# don't show progress bar if we can't determine version
+			PROGRESS_FLAG=""
+	fi
+	wget -nv $PROGRESS_FLAG -O "$ROOT_FS.new" "$DOWNLOAD_BASE_URL/$f"
+
 	mv "$ROOT_FS.new" "$ROOT_FS"
     fi
 fi
-- 
2.48.1





[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux