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