diff options
| author | Tom Smeding <tom@tomsmeding.com> | 2025-01-06 21:27:43 +0100 | 
|---|---|---|
| committer | Tom Smeding <tom@tomsmeding.com> | 2025-01-06 21:27:43 +0100 | 
| commit | e5ef33adc831b0176f39b81ca8913108ef9c30fe (patch) | |
| tree | e63190ee4ae08e69495d01ca490767d0baed83c7 /bwrap-files/workdir | |
| parent | 488b6bfdd505508527b26f171f966245fc32cf1f (diff) | |
Take the latest installed version, not the 'latest' only if available
Diffstat (limited to 'bwrap-files/workdir')
| -rwxr-xr-x | bwrap-files/workdir/entry.sh | 12 | 
1 files changed, 8 insertions, 4 deletions
| diff --git a/bwrap-files/workdir/entry.sh b/bwrap-files/workdir/entry.sh index ce66a8d..61c09d5 100755 --- a/bwrap-files/workdir/entry.sh +++ b/bwrap-files/workdir/entry.sh @@ -3,13 +3,17 @@ set -euo pipefail  cd "$(dirname "$0")" -ver=$(ghcup --offline list -t ghc -c installed -r 2>/dev/null | sed -n '/latest/ s/^ghc \([^ ]*\).*/\1/p') +ghcup='ghcup --no-verbose --offline' + +# Just take the latest version that ghcup prints, assuming that that's the latest installed one +ver=$($ghcup list -t ghc -c installed -r 2>/dev/null | sed -n '$ s/^ghc \([^ ]*\).*/\1/p')  if [[ -n $ver ]]; then -  versionargs=( --ghc "$ver" )  # if we can get "latest", take that +  versionargs=( --ghc "$ver" )  else -  versionargs=()  # just fall back to the currently "set" version +  # If that fails for whatever reason, just fall back to the currently "set" version +  versionargs=()  fi -ghcup --offline run "${versionargs[@]}" -- ghci Yahb2Defs.hs 2>&1 +$ghcup run "${versionargs[@]}" -- ghci Yahb2Defs.hs 2>&1  # vim: set sw=2 ts=8 et: | 
