fix: validate input in wget-and-sci.sh

This commit is contained in:
2026-06-16 22:44:25 +02:00
parent e1ab3f28d6
commit a5618d3c5f
+7 -2
View File
@@ -1,13 +1,18 @@
#!/bin/sh #!/bin/sh
# NOTE: This script assumes that the url is a .tar.gz file. # 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) set -ex # print all that we're doing (no need for echo's)
env env
tmpdir=$(mktemp -d) tmpdir=$(mktemp -d)
wget "$SCI_PIPELINE_URL" -P "$tmpdir" wget "$SCI_PIPELINE_URL" -P "$tmpdir"
cd "$tmpdir" cd "$tmpdir"
tar xf *.tar.gz tar xf *.tar.gz
cd $1 cd "$1"
sh .sci.sh sh .sci.sh
cd - cd -
rm -rf "$tmpdir" rm -rf "$tmpdir"