-
-
Save j796160836/99f2b48c6a77e7d2b62c8afba6a6c97c to your computer and use it in GitHub Desktop.
Update Jenkins on Mac OS X
This file contains hidden or 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 -# -L $url > $TMP_PATH | |
if [ $? -ne 0 ]; then | |
echo 'Fail to download WAR package.' | |
exit 1 | |
fi | |
echo 'Stopping jenkins service...' | |
launchctl unload $PLIST_PATH | |
echo 'Applying update...' | |
sudo -s -- <<EOF | |
mv -f $APP_PATH $APP_PATH.bak | |
mv $TMP_PATH $APP_PATH | |
chown root:wheel $APP_PATH | |
EOF | |
echo 'Starting jenkins service...' | |
launchctl load $PLIST_PATH | |
echo 'Done.' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment