$NetBSD: patch-bin_lein-pkg,v 1.1 2025/08/16 01:49:03 ryoon Exp $ * POSIX shell portability. --- bin/lein-pkg.orig 2024-02-14 00:41:31.000000000 +0000 +++ bin/lein-pkg @@ -6,39 +6,39 @@ export LEIN_VERSION="2.11.2" -if [[ "$CLASSPATH" != "" ]]; then +if [ "$CLASSPATH" != "" ]; then cat <<-'EOS' 1>&2 WARNING: You have $CLASSPATH set, probably by accident. It is strongly recommended to unset this before proceeding. EOS fi -if [[ "$OSTYPE" == "cygwin" ]] || [[ "$OSTYPE" == "msys" ]]; then +if [ "$OSTYPE" = "cygwin" ] || [ "$OSTYPE" = "msys" ]; then delimiter=";" else delimiter=":" fi -if [[ "$OSTYPE" == "cygwin" ]]; then +if [ "$OSTYPE" = "cygwin" ]; then cygwin=true else cygwin=false fi -function msg { +msg() { echo "$@" 1>&2 } -function command_not_found { +command_not_found() { msg "Leiningen couldn't find $1 in your \$PATH ($PATH), which is required." exit 1 } -function make_native_path { +make_native_path() { # ensure we have native paths - if $cygwin && [[ "$1" == /* ]]; then + if $cygwin && [ "$1" = /* ]; then echo -n "$(cygpath -wp "$1")" - elif [[ "$OSTYPE" == "msys" && "$1" == /?/* ]]; then + elif [ "$OSTYPE" = "msys" ] && [ "$1" = /?/* ]; then echo -n "$(sh -c "(cd $1 2/dev/null 2>&1; then + if type sha256sum >/dev/null 2>&1; then export SHASUM_CMD="sha256sum" - elif type -p shasum >/dev/null 2>&1; then + elif type shasum >/dev/null 2>&1; then export SHASUM_CMD="shasum --algorithm 256" - elif type -p sha256 >/dev/null 2>&1; then + elif type sha256 >/dev/null 2>&1; then export SHASUM_CMD="sha256 -q" else command_not_found sha256sum @@ -221,16 +221,16 @@ grep -E -q '^\s*:eval-in\s+:classloader\ run_from_checkout "$1" -if [ ! -x "$JAVA_CMD" ] && ! type -f java >/dev/null +if [ ! -x "$JAVA_CMD" ] && ! type @PKG_JVM@-java >/dev/null then msg "Leiningen couldn't find 'java' executable, which is required." msg "Please either set JAVA_CMD or put java (>=1.6) in your \$PATH ($PATH)." exit 1 fi -export LEIN_JAVA_CMD="${LEIN_JAVA_CMD:-${JAVA_CMD:-java}}" +export LEIN_JAVA_CMD="${LEIN_JAVA_CMD:-${JAVA_CMD:-@PKG_JVM@-java}}" -if [[ -z "${DRIP_INIT+x}" && "$(basename "$LEIN_JAVA_CMD")" == *drip* ]]; then +if [ -z "${DRIP_INIT+x}" ] && [ "$(basename "$LEIN_JAVA_CMD")" = *drip* ]; then export DRIP_INIT="$(printf -- '-e\n(require (quote leiningen.repl))')" export DRIP_INIT_CLASS="clojure.main" fi