~nskaggs/juju-ci-tools/add-essential-operations

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/bash

#  inc-juju.bash
#  
#
#  Created by Curtis on 12/11/13.

set -eux

GIT_USER="sinzui"

URI=$1
TARBALL=$(basename $URI)
VERSION=$(basename $TARBALL .tar.gz | cut -d _ -f 2)
cd ~/Downloads
curl -L -o ~/Downloads/$TARBALL $URI
SHASUM=$(shasum ~/Downloads/$TARBALL | cut -d ' ' -f 1)
echo "$TARBALL is $SHASUM"

cd /usr/local/Library/Formula
git checkout master
brew update
brew uninstall juju
git rebase origin/master
git checkout -b juju-$VERSION
FORMULA=$(sed -e "s,url '.*juju-core.*.tar.gz',url '$URI',; s,sha1 '.*',sha1 '$SHASUM',;" juju.rb)
echo "$FORMULA" > juju.rb
git commit -m "Update juju $VERSION." juju.rb
brew install juju
juju --version
echo "You can push this to github."
echo "git push https://$GIT_USER@github.com/$GIT_USER/homebrew.git HEAD:juju-$VERSION"