diff options
author | Jon Newson <jon_newson@ieee.org> | 2016-02-24 18:52:34 +1100 |
---|---|---|
committer | Jon Newson <jon_newson@ieee.org> | 2016-03-06 16:46:24 +1100 |
commit | fca026810e24e78c0c2661963a6f68351410f677 (patch) | |
tree | bd47486029bcbc98b808e68e11445896c2328f96 | |
parent | 9284db24513ff33c2c9c0cdc34c12fca91e42f36 (diff) |
Determine user's configured shell then set variable accordingly. #624
-rwxr-xr-x[-rw-r--r--] | osx_setup.sh | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/osx_setup.sh b/osx_setup.sh index a8a37833..22d68836 100644..100755 --- a/osx_setup.sh +++ b/osx_setup.sh @@ -1,5 +1,21 @@ -#!/bin/bash +#!/usr/bin/env bash -x +# Test to make sure we are OSX +if [ `/usr/bin/env | grep system_name | awk -F= '{print $2}'` != 'OSX' ] + then + exit $? +fi + +# Read the shell configured for the user and set the variable file accordingly +if [ `dscl . read ~ UserShell | grep -c bash` -eq 1 ] + then + usershellvars='~/.bash_profile' +elif [ `dscl . read ~ UserShell | grep -c zsh` -eq 1 ] + then + usershellvars='~/.zshrc' + +fi + function install_compass { rbenv install -s 2.2.3 eval "$(rbenv init -)" @@ -7,8 +23,8 @@ function install_compass { rbenv local 2.2.3 gem install compass export PATH=$PATH:~/.rbenv/versions/2.2.3/bin - echo "export PATH=$PATH:~/.rbenv/versions/2.2.3/bin" >> ~/.bash_profile - echo 'eval "$(rbenv init -)"' >> ~/.bash_profile + echo "export PATH=$PATH:~/.rbenv/versions/2.2.3/bin" >> $usershellvars + echo 'eval "$(rbenv init -)"' >> $usershellvars } function install_rbenv { @@ -30,10 +46,11 @@ function clone_repo { cd pixelated-user-agent fi } + #setup frontend -install_rbenv -install_compass -install_npm + install_rbenv + install_compass + install_npm #setup backend brew install python # force brew install even if python is already installed |