From dad646ce38ad2196254097962c3cb349ab684480 Mon Sep 17 00:00:00 2001 From: Gert Goet Date: Sun, 4 May 2025 10:27:03 +0200 Subject: [PATCH 1/2] Make install-script wget-compatible (#1816) --- CHANGELOG.md | 1 + README.md | 2 ++ install | 36 +++++++++++++++++++++++++++++++----- 3 files changed, 34 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c207079..70f8e55b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ A preview of the next release can be installed from ## Unreleased +- [#1815](https://github.com/babashka/babashka/issues/1815): Make install-script wget-compatible - Bump `fs` to `0.5.25` - Bump `jsoup` to `1.20.1` - Bump `edamame` to `1.4.30` diff --git a/README.md b/README.md index 6a289fde..a14b9fe9 100644 --- a/README.md +++ b/README.md @@ -232,6 +232,8 @@ Install via the installer script for linux and macOS: ``` shell $ curl -sLO https://raw.githubusercontent.com/babashka/babashka/master/install +# or +$ wget -qO install https://raw.githubusercontent.com/babashka/babashka/master/install $ chmod +x install $ ./install ``` diff --git a/install b/install index 0e9796cf..9e2f50eb 100755 --- a/install +++ b/install @@ -29,6 +29,32 @@ print_help() { exit 1 } +has() { + command -v "$1" >/dev/null 2>&1 +} + +fetch() { + local url=$1 + local outfile=${2:-} + + if has wget; then + if [[ -n $outfile ]]; then + wget -qO "$outfile" "$url" + else + wget -qO - "$url" + fi + elif has curl; then + if [[ -n $outfile ]]; then + curl -fsSL "$url" -o "$outfile" + else + curl -fsSL "$url" + fi + else + >&2 echo "Either 'wget' or 'curl' needs to be on PATH!" + exit 1 + fi +} + while [[ $# -gt 0 ]] do key="$1" @@ -80,9 +106,9 @@ fi if [[ "$version" == "" ]]; then if [[ "$dev_build" == "true" ]]; then - version="$(curl -sL https://raw.githubusercontent.com/babashka/babashka/master/resources/BABASHKA_VERSION)" + version="$(fetch https://raw.githubusercontent.com/babashka/babashka/master/resources/BABASHKA_VERSION)" else - version="$(curl -sL https://raw.githubusercontent.com/babashka/babashka/master/resources/BABASHKA_RELEASED_VERSION)" + version="$(fetch https://raw.githubusercontent.com/babashka/babashka/master/resources/BABASHKA_RELEASED_VERSION)" fi fi @@ -144,9 +170,9 @@ download_url="https://github.com/babashka/$repo/releases/download/v$version/$fil # macOS only have shasum available by default # Some Linux distros (RHEL-like) only have sha256sum available by default (others have both) -if command -v sha256sum >/dev/null; then +if has sha256sum; then sha256sum_cmd="sha256sum" -elif command -v shasum >/dev/null; then +elif has shasum; then sha256sum_cmd="shasum -a 256" else >&2 echo "Either 'sha256sum' or 'shasum' needs to be on PATH for '--checksum' flag!" @@ -159,7 +185,7 @@ mkdir -p "$download_dir" && ( cd "$download_dir" echo -e "Downloading $download_url to $download_dir" - curl -o "$filename" -sL "$download_url" + fetch "$download_url" "$filename" if [[ -n "$checksum" ]]; then if ! echo "$checksum *$filename" | $sha256sum_cmd --check --status; then >&2 echo "Failed checksum on $filename" From 57b799e63d9fe9a94efc64452b0058132d6c0b9c Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Sun, 4 May 2025 17:27:46 +0200 Subject: [PATCH 2/2] Add odoyle-rules to tested libs --- deps.edn | 4 +++- test-resources/lib_tests/bb-tested-libs.edn | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/deps.edn b/deps.edn index c8dbd20b..d9630228 100644 --- a/deps.edn +++ b/deps.edn @@ -176,7 +176,9 @@ org.clj-commons/hickory {:git/url "https://github.com/clj-commons/hickory" :git/sha "9385b6708ef35f161732d8464b3a3aa57dd79f30"} com.potetm/fusebox {:git/url "https://github.com/potetm/fusebox" - :git/sha "ac6d6a0a69510b009b3c1bb2247cd110fd9f7246"}} + :git/sha "ac6d6a0a69510b009b3c1bb2247cd110fd9f7246"} + net.sekao/odoyle-rules {:git/url "https://github.com/oakes/odoyle-rules" + :git/sha "0b1d825ec45a998c4d3481dfb292e08ce6a47f0b"}} :classpath-overrides {org.clojure/clojure nil org.clojure/spec.alpha nil}} :clj-nvd diff --git a/test-resources/lib_tests/bb-tested-libs.edn b/test-resources/lib_tests/bb-tested-libs.edn index 2b9a56fe..7a1e5785 100644 --- a/test-resources/lib_tests/bb-tested-libs.edn +++ b/test-resources/lib_tests/bb-tested-libs.edn @@ -213,4 +213,8 @@ #_com.potetm.fusebox.rate-limit-test com.potetm.fusebox.registry-test com.potetm.fusebox.retry-test - #_com.potetm.fusebox.timeout-test]}} + #_com.potetm.fusebox.timeout-test]} + net.sekao/odoyle-rules {:git-url "https://github.com/oakes/odoyle-rules" + :git-sha "0b1d825ec45a998c4d3481dfb292e08ce6a47f0b" + :test-paths ["test"] + :test-namespaces [odoyle.rules-test]}}