1554
by Curtis Hovey
Added script to create test streams from local agents. |
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" |
|
1555
by Curtis Hovey
Added win2012r2. |
7 |
WIN_RELEASES="win2012hvr2 win2012r2" |
1554
by Curtis Hovey
Added script to create test streams from local agents. |
8 |
|
9 |
STREAM_DIR=$1 |
|
10 |
JUJUD=$2 |
|
1555
by Curtis Hovey
Added win2012r2. |
11 |
WIN_JUJUD=${3:-} |
1554
by Curtis Hovey
Added script to create test streams from local agents. |
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) |
|
1826
by Curtis Hovey
Fix version and arch detection in juju agent. [restored commit] |
25 |
version=$(echo $full_version | sed -r 's,(.*)-[^-]+-[^-]+,\1,') |
26 |
arch=$(echo $full_version | sed -r 's,.*-([^-]+),\1,') |
|
1554
by Curtis Hovey
Added script to create test streams from local agents. |
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>" |