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
This commit is contained in:
Vladimir Safonkin
2020-07-31 11:16:12 +00:00
committed by GitHub
parent 3542c55a31
commit f57a773971

View File

@@ -5,6 +5,7 @@
################################################################################ ################################################################################
# Source the helpers for use with the script # Source the helpers for use with the script
source $HELPER_SCRIPTS/etc-environment.sh
source $HELPER_SCRIPTS/document.sh source $HELPER_SCRIPTS/document.sh
# Install Herbert V. Riedel's PPA for managing multiple version of ghc on ubuntu. # 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) exactVersion=$(echo "$allGhcVersions" | grep $version | sort --unique --version-sort | tail -1)
apt-get install -y ghc-$exactVersion apt-get install -y ghc-$exactVersion
ghcInstalledVersions+=("$exactVersion") ghcInstalledVersions+=("$exactVersion")
defaultGHCVersion=$exactVersion
done done
# Get latest cabal version # 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 # Run tests to determine that the software installed as expected
echo "Testing to make sure that script performed as expected, and basic scenarios work" echo "Testing to make sure that script performed as expected, and basic scenarios work"
# Check all ghc versions # Check all ghc versions
for version in $ghcVersions; do for version in ${ghcInstalledVersions[@]}; do
if ! command -v /opt/ghc/$version/bin/ghc; then if ! command -v /opt/ghc/$version/bin/ghc; then
echo "ghc $version was not installed" echo "ghc $version was not installed"
exit 1 exit 1
@@ -53,10 +55,12 @@ if ! command -v stack; then
exit 1 exit 1
fi 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 # Document what was added to the image
echo "Lastly, documenting what we added to the metadata file" echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "Haskell Cabal ($(/opt/cabal/$cabalVersion/bin/cabal --version))" DocumentInstalledItem "Haskell Cabal ($(cabal --version))"
for version in ${ghcInstalledVersions[@]}; do DocumentInstalledItem "GHC ($(ghc --version))"
DocumentInstalledItem "GHC ($(/opt/ghc/$version/bin/ghc --version))"
done
DocumentInstalledItem "Haskell Stack ($(stack --version))" DocumentInstalledItem "Haskell Stack ($(stack --version))"