From 00a20fc49a590aec901f656ad6c985a2d2df8ae0 Mon Sep 17 00:00:00 2001 From: Alexandre Archambault Date: Sun, 17 Oct 2021 16:30:56 +0200 Subject: [PATCH] Make scala-cli.sh more reliable The .gz file we download might already be in cache (downloaded manually by users say), while the uncompressed launcher can be missing. These changes make sure we uncompress the .gz file if needed, even if it was already in cache. --- scala-cli.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scala-cli.sh b/scala-cli.sh index 8e872521e9..f28cc8c9fc 100755 --- a/scala-cli.sh +++ b/scala-cli.sh @@ -29,8 +29,14 @@ if [ ! -f "$CACHE_DEST" ]; then echo "Downloading $SCALA_CLI_URL" curl -fLo "$TMP_DEST" "$SCALA_CLI_URL" mv "$TMP_DEST" "$CACHE_DEST" +fi + +if [ ! -f "$SCALA_CLI_BIN_PATH" ]; then gunzip -k "$CACHE_DEST" +fi + +if [ ! -x "$SCALA_CLI_BIN_PATH" ]; then chmod +x "$SCALA_CLI_BIN_PATH" fi -exec "$SCALA_CLI_BIN_PATH" "$@" \ No newline at end of file +exec "$SCALA_CLI_BIN_PATH" "$@"