From f57a7739716866987b65e1aa28f503f67aae387d Mon Sep 17 00:00:00 2001 From: Vladimir Safonkin Date: Fri, 31 Jul 2020 11:16:12 +0000 Subject: [PATCH] Remove cached ghc versions from Ubuntu docs (#1310) * Remove cached ghc versions from Ubuntu docs * Add default ghc to path * Create symlink for ghc * Create symlink for cabal --- images/linux/scripts/installers/haskell.sh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/images/linux/scripts/installers/haskell.sh b/images/linux/scripts/installers/haskell.sh index 32e4fc4dd..242a0f32c 100644 --- a/images/linux/scripts/installers/haskell.sh +++ b/images/linux/scripts/installers/haskell.sh @@ -5,6 +5,7 @@ ################################################################################ # Source the helpers for use with the script +source $HELPER_SCRIPTS/etc-environment.sh source $HELPER_SCRIPTS/document.sh # Install Herbert V. Riedel's PPA for managing multiple version of ghc on ubuntu. @@ -22,6 +23,7 @@ for version in $ghcMajorMinorVersions; do exactVersion=$(echo "$allGhcVersions" | grep $version | sort --unique --version-sort | tail -1) apt-get install -y ghc-$exactVersion ghcInstalledVersions+=("$exactVersion") + defaultGHCVersion=$exactVersion done # Get latest cabal version @@ -35,7 +37,7 @@ curl -sSL https://get.haskellstack.org/ | sh # Run tests to determine that the software installed as expected echo "Testing to make sure that script performed as expected, and basic scenarios work" # Check all ghc versions -for version in $ghcVersions; do +for version in ${ghcInstalledVersions[@]}; do if ! command -v /opt/ghc/$version/bin/ghc; then echo "ghc $version was not installed" exit 1 @@ -53,10 +55,12 @@ if ! command -v stack; then exit 1 fi +# Create symlink for ghc and cabal in /usr/bin +ln -s "/opt/ghc/$defaultGHCVersion/bin/ghc" "/usr/bin/ghc" +ln -s "/opt/cabal/$cabalVersion/bin/cabal" "/usr/bin/cabal" + # Document what was added to the image echo "Lastly, documenting what we added to the metadata file" -DocumentInstalledItem "Haskell Cabal ($(/opt/cabal/$cabalVersion/bin/cabal --version))" -for version in ${ghcInstalledVersions[@]}; do - DocumentInstalledItem "GHC ($(/opt/ghc/$version/bin/ghc --version))" -done +DocumentInstalledItem "Haskell Cabal ($(cabal --version))" +DocumentInstalledItem "GHC ($(ghc --version))" DocumentInstalledItem "Haskell Stack ($(stack --version))"