Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ejb1123/5942222 to your computer and use it in GitHub Desktop.
Save ejb1123/5942222 to your computer and use it in GitHub Desktop.
#!/bin/bash
## Nodejs custom version installer
##
## Ronaldo Barbachano April 2013
## Based on the openshift/nodejscustom-version-openshift repo
##
## Supply with path to existing openshift repo, or move script into
## repo root.
##
## Probably less headaches if this is run immediately after
## application creation.
function exitStatus {
## used to end program flow if specific tasks (commands) fail
if [ "$1" != 0 ]; then
exit
fi
}
arg1=$1
if [ "$arg1" == "" ]; then
openshift_path=
while [ -z $openshift_path ]
do
echo -n 'Path to openshift repo relative to script?
**Hint move script if youre lazy and leave blank
'
read openshift_path
done
else
openshift_path=$1
fi
if [ "$openshift_path" != "" ]; then
cd "$openshift_path"
fi
node_version=
while [ -z $node_version ]
do
echo -n 'Please enter a valid version of node (0.10.3)
'
read node_version
done
## probably change this branch name to something other than 'upstream'
git remote add upstream -m master git://github.com/openshift/nodejs-custom-version-openshift.git
exitStatus $?
git pull -s recursive -X theirs upstream master
exitStatus $?
echo "$node_version" >> .openshift/markers/NODEJS_VERSION
exitStatus $?
git add .openshift/markers/NODEJS_VERSION
exitStatus $?
git commit -m 'use custom Node version '"$node_version"
exitStatus $?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment