easier to install and check if on debian based distrib
This commit is contained in:
parent
8328598fa5
commit
4d01796367
2 changed files with 31 additions and 11 deletions
10
README.md
10
README.md
|
@ -6,8 +6,12 @@ A script to install Haskell and minimize cabal hell.
|
||||||
If you are on Linux install `libgmp-dev`, `bzip2` and `zsh`.
|
If you are on Linux install `libgmp-dev`, `bzip2` and `zsh`.
|
||||||
|
|
||||||
```
|
```
|
||||||
curl -O https://raw.githubusercontent.com/yogsototh/install-haskell/master/install-haskell.sh
|
curl https://raw.githubusercontent.com/yogsototh/install-haskell/master/install-haskell.sh | sudo zsh
|
||||||
chmod ugo+x install-haskell.sh
|
```
|
||||||
sudo ./install-haskell.sh $USER
|
|
||||||
|
If something goes wrong:
|
||||||
|
|
||||||
|
```
|
||||||
|
export SUDO_USER=$USER; curl https://raw.githubusercontent.com/yogsototh/install-haskell/master/install-haskell.sh | sudo zsh
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
#!/usr/bin/env zsh
|
#!/usr/bin/env zsh
|
||||||
|
|
||||||
normaluser=$1
|
normaluser=$SUDO_USER
|
||||||
(( $# < 1 )) && {
|
|
||||||
print -- "usage: sudo ${0:t} \$USER" >&2
|
if [[ $normaluser = "" ]]; then
|
||||||
|
print -- "Please set the SUDO_USER variable with"
|
||||||
|
print -- "export SUDO_USER=\$USER;"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
fi
|
||||||
|
|
||||||
userhome="$(sudo -u $normaluser echo $HOME)"
|
userhome="$(sudo -u $normaluser echo $HOME)"
|
||||||
echo $userhome
|
echo $userhome
|
||||||
|
@ -27,6 +29,16 @@ if [[ $(uname -s) = "Darwin" ]]; then
|
||||||
os="apple-darwin"
|
os="apple-darwin"
|
||||||
cabalos="apple-darwin-mavericks"
|
cabalos="apple-darwin-mavericks"
|
||||||
else
|
else
|
||||||
|
if [[ ! -e /etc/debian_version ]]; then
|
||||||
|
print -- "You don't appear to be on a Debian based Linux"
|
||||||
|
print -- "This script might install files not necessarily at the right place for your distribution"
|
||||||
|
print -- "Do you want to continue?"
|
||||||
|
read answer
|
||||||
|
case $answer in
|
||||||
|
y|Y|yes|YES) print -- "OK" ;;
|
||||||
|
*) print -- "Bye!"; exit 1;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
if [[ $archi = "i686" ]]; then
|
if [[ $archi = "i686" ]]; then
|
||||||
archi=i386
|
archi=i386
|
||||||
fi
|
fi
|
||||||
|
@ -85,15 +97,19 @@ sudo -u $normaluser cabal update
|
||||||
echo "Install useful binaries"
|
echo "Install useful binaries"
|
||||||
sudo -u $normaluser cabal install -j alex happy
|
sudo -u $normaluser cabal install -j alex happy
|
||||||
|
|
||||||
|
if grep 'export PATH=$HOME/.cabal/bin:$PATH' $HOME/.profile >/dev/null; then
|
||||||
|
echo "PATH variable already set in your .profile"
|
||||||
|
else
|
||||||
echo "Update your PATH in .profile for cabal binaries"
|
echo "Update your PATH in .profile for cabal binaries"
|
||||||
sudo -u $normaluser echo 'export PATH=$HOME/.cabal/bin:$PATH' >> $HOME/.profile
|
sudo -u $normaluser echo 'export PATH=$HOME/.cabal/bin:$PATH' >> $HOME/.profile
|
||||||
|
fi
|
||||||
|
|
||||||
echo "================"
|
echo "================"
|
||||||
echo "Congratulations\!"
|
echo "Congratulations!"
|
||||||
echo "================"
|
echo "================"
|
||||||
echo
|
echo
|
||||||
echo "You should start using Haskell like a pro now"
|
echo "You should start using Haskell like a pro now"
|
||||||
echo "You shouldn't use cabal sandbox except if you know what you are doing."
|
echo "You shouldn't use cabal sandbox except if you know what you are doing."
|
||||||
echo "So if you follow a tutorial that use cabal sandbox, don't use it."
|
echo "So if you follow a tutorial that use cabal sandbox, don't use it."
|
||||||
echo "Unless you don't mind killing some white bear and waiting a lot."
|
echo "Unless you don't mind killing some white bears and waiting a lot."
|
||||||
echo
|
echo
|
||||||
|
|
Loading…
Reference in a new issue