9
10
XPRE="" # production: set this to empty string for real
13
HOOK_COMMAND="" # set this to full path to a command to run
14
#HOOK_COMMAND="$(dirname $0)/image-modify"
16
FILTERS="release~(precise|trusty|utopic|vivid|devel) arch~(x86_64|amd64)"
13
18
[ "${TENV_SETUP:-0}" != "0" -o "${NO_TENV:-0}" != "0" ] || {
14
19
echo "expecting to be run from tenv (simplestreams/tools/tenv)";
25
local namepre="$1" cid="$2" url="$3" path=${4}
30
local namepre="$1" cid="$2" url="$3"
33
{ echo "skipping ${namepre}, MAX=0" 1>&2; return 0; }
26
34
sstream-mirror-glance -vv \
27
35
${MAX:+--max=${MAX}} ${REGION:+"--region=${REGION}"} \
28
36
"--cloud-name=${CLOUDNAME}" "--output-swift=${SWIFT_PATH}" \
29
37
"--name-prefix=${XPRE}${namepre%/}/" "--content-id=${CID_COMMON}:$cid" \
30
"--item-filter=arch=amd64" "--item-filter=release~(precise|trusty|utopic|vivid|devel)" \
31
"--item-filter=ftype~(disk1.img|disk.img)" --progress --keep \
32
"${url}" ${path:+"${path}"}
38
${HOOK_COMMAND:+"--modify-hook=${HOOK_COMMAND}"} \
39
"${url}" $FILTERS "$@"
34
41
fail() { [ $# -eq 0 ] || echo "$@" 1>&2; exit 2; }
36
43
## with cirros data
37
44
## add cirros signing key
38
# gpg-import-pubkey examples/keys/cirros.pub
45
# gpg-trust-pubkey ./simplestreams/examples/keys/cirros.pub
39
46
## get a local mirror (for quicker iterating)
40
# do-mirror -vv http://download.cirros-cloud.net/ ./cirros-mirror
41
#MAX=2; gmirror "cirros/" "cirros" ./cirros-mirror/
47
# sstream-mirror --progress --max=2 \
48
# http://download.cirros-cloud.net/ ./cirros-mirror \
49
# arch=x86_64 ftype=disk.img
50
#MAX=2; gmirror "cirros/" "cirros" ./cirros-mirror/ arch=x86_64 ftype=disk.img
44
export MAX=${MAX_RELEASED};
45
54
gmirror "ubuntu-released/" "ubuntu:released" \
46
55
http://cloud-images.ubuntu.com/releases/ ||
47
56
fail "failed gmirror for ubuntu-released"
50
export MAX=${MAX_DAILY};
51
60
gmirror "ubuntu-daily/" "ubuntu:daily" \
52
61
http://cloud-images.ubuntu.com/daily/ ||
53
62
fail "failed gmirror for ubuntu-daily"
56
export MAX=${MAX_DAILY};
64
## ubuntu-core/devel (snappy)
57
66
gmirror "ubuntu-core/devel/" "ubuntu:core:devel" \
58
http://cloud-images.ubuntu.com/snappy/ ||
59
fail "failed gmirror for ubuntu-snappy"
67
http://cloud-images.ubuntu.com/snappy/ ||
68
fail "failed gmirror for ubuntu-snappy"