Created
May 15, 2012 15:06
-
-
Save n8felton/2702477 to your computer and use it in GitHub Desktop.
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 | |
[ ! `id -u` = 0 ] && echo "Requires elevation. Please run as root or use \"sudo\" ($(id -u))" && exit 1 | |
SCRIPT_START=$(date +%s) | |
SCRIPT_PATH=$(dirname $0) | |
SCRIPT_NAME=$(basename $0 .sh) | |
LOG="/var/log/$SCRIPT_NAME.log" | |
REMOTE_REV=$(svn info http://instadmg.googlecode.com/svn/trunk | egrep '^Revision: .*$' | sed 's|^Revision: \(.*\)$|\1|') | |
LOCAL_REV=$(cat $SCRIPT_PATH/.svn/current_rev) | |
[ $REMOTE_REV -eq $LOCAL_REV ] && echo "$SCRIPT_NAME: Revisions match... exiting." && exit 2 | |
[ -f $LOG ] && mv $LOG "${LOG}-${LOCAL_REV}.log" | |
[ -t 1 ] && echo "$SCRIPT_NAME running... Output to $LOG" | |
exec > $LOG 2>&1 | |
exec < /dev/null 2<&1 | |
echo $(date) | |
echo "User ID: $(id -u)" | |
echo "Remote Revision: $REMOTE_REV" | |
echo "Local Revision: $LOCAL_REV" | |
svn update http://instadmg.googlecode.com/svn/trunk /instadmg | |
/instadmg/AddOns/InstaUp2Date/instaUp2Date.sh | |
[ $? = 0 ] && mv /instadmg/OutputFiles/10.6.8\ Vanilla.dmg \ | |
/DeployStudio/Masters/HFS/10.6.8_InstaDMG-$REMOTE_REV.hfs.dmg | |
[ $? = 0 ] && mv /instadmg/OutputFiles/10.7\ Vanilla.dmg \ | |
/DeployStudio/Masters/HFS/10.7_InstaDMG-$REMOTE_REV.hfs.dmg | |
[ $? = 0 ] && echo $REMOTE_REV > $SCRIPT_PATH/.svn/current_rev | |
SCRIPT_END=$(date +%s) | |
SCRIPT_ELAPSED=$(expr $SCRIPT_END - $SCRIPT_START) | |
echo "Elapsed Time: $(date -u -r $SCRIPT_ELAPSED +%H:%M:%S)" | |
uuencode $LOG $SCRIPT_NAME.log | mail -s "$SCRIPT_NAME Completed - Current Revision: $REMOTE_REV" nlfdss@rit.edu | |
[ $? = 0 ] && echo "Email Sent" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment