From a5618d3c5fa5d49637b0270ea1dbe5ebad4c96cb Mon Sep 17 00:00:00 2001 From: Asger Gitz-Johansen Date: Tue, 16 Jun 2026 22:44:25 +0200 Subject: [PATCH] fix: validate input in wget-and-sci.sh --- scripts/wget-and-sci.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/wget-and-sci.sh b/scripts/wget-and-sci.sh index 1b79fc3..5e7585e 100755 --- a/scripts/wget-and-sci.sh +++ b/scripts/wget-and-sci.sh @@ -1,13 +1,18 @@ #!/bin/sh # NOTE: This script assumes that the url is a .tar.gz file. -# TODO: check if $# is >= 1 and give a warning that the extract dir should be provided. +if [ "$#" -lt 1 ]; then + printf '%s\n' "usage: $0 EXTRACT_DIR" >&2 + printf '%s\n' "EXTRACT_DIR is the directory to enter after extracting the archive." >&2 + exit 2 +fi + set -ex # print all that we're doing (no need for echo's) env tmpdir=$(mktemp -d) wget "$SCI_PIPELINE_URL" -P "$tmpdir" cd "$tmpdir" tar xf *.tar.gz -cd $1 +cd "$1" sh .sci.sh cd - rm -rf "$tmpdir"