~andrewjbeach/juju-ci-tools/make-local-patcher

« back to all changes in this revision

Viewing changes to streams-from-local.bash

  • Committer: Curtis Hovey
  • Date: 2016-04-10 15:23:18 UTC
  • Revision ID: curtis@canonical.com-20160410152318-ntfymsv9eiw63vt2
Addedd daily streams to get_amy.py get_ami.py tests/test_get_ami.py

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/bin/bash
2
 
# ./streams-from-local.bash ./streams /usr/bin/jujud
3
 
set -eu
4
 
 
5
 
# GO (and Juju) compile by OS and arch. All Linux releases are the same!
6
 
RELEASES="precise trusty xenial centos7"
7
 
WIN_RELEASES="win2012hvr2 win2012r2"
8
 
 
9
 
STREAM_DIR=$1
10
 
JUJUD=$2
11
 
WIN_JUJUD=${3:-}
12
 
 
13
 
 
14
 
if [[ ! -d $STREAM_DIR ]]; then
15
 
    echo "Provide a path to a dir to hold the streams."
16
 
    exit 1
17
 
fi
18
 
 
19
 
if [[ ! -f $JUJUD ]]; then
20
 
    echo "Provide a path to a dir to hold the streams."
21
 
    exit 1
22
 
fi
23
 
 
24
 
full_version=$($JUJUD version)
25
 
version=$(echo $full_version | cut -d '-' -f 1)
26
 
arch=$(echo $full_version | cut -d '-' -f 3)
27
 
 
28
 
# Juju wont permit devel versions to be in released streams.
29
 
if [[ $version =~ (alpha|beta) ]]; then
30
 
    agent_dir="devel"
31
 
else
32
 
    agent_dir="released"
33
 
fi
34
 
 
35
 
mkdir -p $STREAM_DIR/tools/$agent_dir
36
 
mkdir -p $STREAM_DIR/tools/streams/v1
37
 
 
38
 
change_dir=$(dirname $JUJUD)
39
 
base_agent="agent.tgz"
40
 
tar cvfz $base_agent -C $change_dir jujud
41
 
for series in $RELEASES; do
42
 
    agent="juju-$version-$series-$arch.tgz"
43
 
    cp $base_agent $STREAM_DIR/tools/$agent_dir/$agent
44
 
done
45
 
rm $base_agent
46
 
 
47
 
if [[ -n $WIN_JUJUD ]]; then
48
 
    change_dir=$(dirname $WIN_JUJUD)
49
 
    base_agent="agent.tgz"
50
 
    tar cvfz $base_agent -C $change_dir jujud.exe
51
 
    for series in $WIN_RELEASES; do
52
 
        agent="juju-$version-$series-$arch.tgz"
53
 
        cp $base_agent $STREAM_DIR/tools/$agent_dir/$agent
54
 
    done
55
 
    rm $base_agent
56
 
fi
57
 
 
58
 
juju metadata generate-tools -d $STREAM_DIR --stream $agent_dir
59
 
 
60
 
echo "You can boostrap using these local streams like so:"
61
 
echo "juju bootstrap --metadata-source $STREAM_DIR"
62
 
echo ""
63
 
 
64
 
echo "or"
65
 
echo "Publish the $STREAM_DIR tree to a website or maybe your localhost."
66
 
echo "cd $STREAM_DIR"
67
 
echo "python -m SimpleHTTPServer"
68
 
echo "set agent-metadata-url: <HOST/path/tools>"