From 4e30ac8e9e3aa11a309a2ab4610042646276f1bd Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Mon, 1 Oct 2018 09:15:57 -1000 Subject: [PATCH] install: cleanups --- hledger-install/hledger-install.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/hledger-install/hledger-install.sh b/hledger-install/hledger-install.sh index 382074383..38194315c 100755 --- a/hledger-install/hledger-install.sh +++ b/hledger-install/hledger-install.sh @@ -812,14 +812,20 @@ quietly_run() { # For the stack method, it's necessary to provide not only the package(s) you want to # install but also all dependencies which are not in the specified stackage $RESOLVER. try_install() { - (cd # avoid any project-specific stack/cabal config, install at user level - (! has_cmd stack && has_cmd cabal && echo "using $(cabal --version)" && try_info cabal install "$@" --verbose="$CABAL_VERBOSITY" ) || + (cd # ensure we install at user level, not in some project's stack/cabal setup + # cabal and not stack installed ? use cabal + (! has_cmd stack && has_cmd cabal && ( + echo "no stack installed, $(cabal --version) installed; trying cabal install" && + try_info cabal install "$@" --verbose="$CABAL_VERBOSITY" ) + ) || + # use stack, installing it if missing or too old (ensure_stack && ( #(try_info stack install --install-ghc "$@" --verbosity=$STACK_VERBOSITY ) || # existing resolver (try_info stack install --install-ghc $RESOLVER "$@" --verbosity="$STACK_VERBOSITY" ) # specific resolver ) ) || - echo Failed to install "$@" + # or give up + echo "Failed to install $@" ) }