From 47df3a86d7cf412d766f8a1fdd1e9b9fe15bfb45 Mon Sep 17 00:00:00 2001 From: Jon Newson Date: Wed, 24 Feb 2016 18:52:34 +1100 Subject: Determine user's configured shell then set variable accordingly. #624 --- osx_setup.sh | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) mode change 100644 => 100755 osx_setup.sh (limited to 'osx_setup.sh') diff --git a/osx_setup.sh b/osx_setup.sh old mode 100644 new mode 100755 index a8a37833..22d68836 --- 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 -- cgit v1.2.3 From 52467b9aef76c9aac2f250478befd3afb7b6aabd Mon Sep 17 00:00:00 2001 From: Jon Newson Date: Thu, 25 Feb 2016 07:45:06 +1100 Subject: Remove shell switch from testing. --- osx_setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'osx_setup.sh') diff --git a/osx_setup.sh b/osx_setup.sh index 22d68836..e90ae5f8 100755 --- a/osx_setup.sh +++ b/osx_setup.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash -x +#!/usr/bin/env bash # Test to make sure we are OSX if [ `/usr/bin/env | grep system_name | awk -F= '{print $2}'` != 'OSX' ] -- cgit v1.2.3 From 2662e78497ce527467556a15c3cc9b20f84929ba Mon Sep 17 00:00:00 2001 From: Jon Newson Date: Mon, 29 Feb 2016 10:29:33 +1100 Subject: Update osx_setup.sh Address issue #624 and apply suggested coding style. --- osx_setup.sh | 42 ++++++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 18 deletions(-) (limited to 'osx_setup.sh') diff --git a/osx_setup.sh b/osx_setup.sh index e90ae5f8..2103d765 100755 --- a/osx_setup.sh +++ b/osx_setup.sh @@ -1,21 +1,27 @@ -#!/usr/bin/env bash +#!/bin/bash # Test to make sure we are OSX -if [ `/usr/bin/env | grep system_name | awk -F= '{print $2}'` != 'OSX' ] - then - exit $? +if [ $(uname) != 'Darwin' ] +then + echo "This script should run only on an OSX system!" + exit 1 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' +function current_shell { + case $SHELL in + *bash) + echo ~/.bash_profile + ;; + + *zsh) + echo ~/.zshrc + ;; + + #Other shells can go here + esac +} -fi - function install_compass { rbenv install -s 2.2.3 eval "$(rbenv init -)" @@ -23,8 +29,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" >> $usershellvars - echo 'eval "$(rbenv init -)"' >> $usershellvars + echo "export PATH=$PATH:~/.rbenv/versions/2.2.3/bin" >> $(current_shell) + echo 'eval "$(rbenv init -)"' >> $(current_shell) } function install_rbenv { @@ -48,12 +54,12 @@ function clone_repo { } #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 +brew install python # force brew install even if python is already install export LDFLAGS=-L/usr/local/opt/openssl/lib export LDFLAGS=-L/usr/local/opt/openssl/lib pip install virtualenv -- cgit v1.2.3 From 275f564efe0168d50135e1d6d7d26b916b936b12 Mon Sep 17 00:00:00 2001 From: Jon Newson Date: Fri, 4 Mar 2016 10:59:07 +1100 Subject: Determine user's configured shell then set variable accordingly. #624 --- osx_setup.sh | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'osx_setup.sh') diff --git a/osx_setup.sh b/osx_setup.sh index 2103d765..c58270c7 100755 --- a/osx_setup.sh +++ b/osx_setup.sh @@ -3,23 +3,28 @@ # Test to make sure we are OSX if [ $(uname) != 'Darwin' ] then - echo "This script should run only on an OSX system!" - exit 1 + echo "This script should run only on an OSX system!" + exit 1 fi # Read the shell configured for the user and set the variable file accordingly function current_shell { - case $SHELL in - *bash) - echo ~/.bash_profile - ;; + case $SHELL in + *bash) + echo ~/.bash_profile + ;; - *zsh) - echo ~/.zshrc - ;; + *zsh) + echo ~/.zprofile + ;; + + /bin/sh + echo ~/.profile + ;; + #Other shells can go here - esac + esac } function install_compass { -- cgit v1.2.3 From 5dfe6202e34974c120a240822b57ed020933a640 Mon Sep 17 00:00:00 2001 From: Jon Newson Date: Fri, 4 Mar 2016 13:45:04 +1100 Subject: Issue #624 --- osx_setup.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'osx_setup.sh') diff --git a/osx_setup.sh b/osx_setup.sh index c58270c7..ad330f18 100755 --- a/osx_setup.sh +++ b/osx_setup.sh @@ -17,15 +17,15 @@ function current_shell { *zsh) echo ~/.zprofile ;; - + /bin/sh echo ~/.profile ;; - - #Other shells can go here + + #Other shells can go here esac -} +} function install_compass { rbenv install -s 2.2.3 -- cgit v1.2.3