install.sh 1.53 KB
Newer Older
1 2 3 4 5 6 7 8
#!/bin/sh

#Select the correct shell configuration file
USER_HOME=$HOME
PROFILE="$USER_HOME/.bashrc" # default
if [ "$(uname)" = "Linux" ]; then

  #Linux case
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
  # Check which sheel the user is using
  # Trim the $SHELL variable to only have the shell name
  SHELL_NAME=`echo $SHELL | awk -F/ '{print $NF}'`

  case "$SHELL_NAME" in
    "sh" )
      PROFILE="$USER_HOME/.profile" ;;
    "bash" )
      PROFILE="$USER_HOME/.bashrc" ;;
    "zsh" )
      PROFILE="$USER_HOME/.zshrc" ;;
    "csh" )
      PROFILE="$USER_HOME/.cshrc" ;;
    "tcsh" )
      PROFILE="$USER_HOME/.tcshrc" ;;
    "ksh" )
      PROFILE="$USER_HOME/.kshrc" ;;
  esac
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45

else

  #OSX case
  if [ -f "$USER_HOME/.profile" ]; then
    PROFILE="$USER_HOME/.profile"
  else
    PROFILE="$USER_HOME/.bash_profile"
  fi

fi

#Do the installation
if [ "$1" = "local" ]; then
  echo "Installing easea 1.0.3 locally" 

  echo "Exporting and setting environment variables"
  export EZ_PATH="$PWD/"
  export PATH="$PATH:$PWD/bin"
46 47
  echo >> $PROFILE
  echo "# EASEA paths for compiler and library">> $PROFILE
48 49 50 51 52 53 54 55 56 57
  echo "export EZ_PATH=$EZ_PATH">>$PROFILE
  echo "export PATH=\$PATH:$PWD/bin" >>$PROFILE

else
  echo "Installing easea 1.0.3 in /usr/local/easea" 
  sudo make install > /dev/null

  echo "Exporting and setting environment variables"
  export EZ_PATH="/usr/local/easea/"
  export PATH="$PATH:/usr/local/easea/bin"
58 59
  echo >> $PROFILE
  echo "# EASEA paths for compiler and library">> $PROFILE
60 61 62 63 64
  echo "export EZ_PATH=$EZ_PATH">>$PROFILE
  echo "export PATH=\$PATH:/usr/local/easea/bin" >>$PROFILE

fi