Skip to content

Instantly share code, notes, and snippets.

@lacek
Created August 23, 2015 14:36
Show Gist options
  • Save lacek/8559e1608b84fdf11c66 to your computer and use it in GitHub Desktop.
Save lacek/8559e1608b84fdf11c66 to your computer and use it in GitHub Desktop.
Update Jenkins on Mac OS X
#!/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