Created
August 23, 2015 14:36
-
-
Save lacek/8559e1608b84fdf11c66 to your computer and use it in GitHub Desktop.
Update Jenkins on Mac OS X
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
DEFAULT_URL=http://updates.jenkins-ci.org/current/latest/jenkins.war | |
TMP_PATH=/tmp/jenkins.war | |
APP_PATH=/Applications/Jenkins/jenkins.war | |
PLIST_PATH=/Library/LaunchDaemons/org.jenkins-ci.plist | |
url=${1-$DEFAULT_URL} | |
echo 'Downloading WAR package...' | |
curl -# $url > $TMP_PATH | |
if [ $? -ne 0 ]; then | |
echo 'Fail to download WAR package.' | |
exit 1 | |
fi | |
echo 'Applying update...' | |
sudo -s -- <<EOF | |
launchctl unload $PLIST_PATH | |
mv -f $APP_PATH $APP_PATH.bak | |
mv $TMP_PATH $APP_PATH | |
chown root:wheel $APP_PATH | |
launchctl load $PLIST_PATH | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment