Ubuntu Pastebin

Paste from smoser at Sun, 26 Apr 2015 19:58:39 +0000

Download as text
 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#!/bin/bash

## assumes you've already got OS_* environment set up.
set -x
set -f

CLOUDNAME="serverstack"
SWIFT_PATH="simplestreams/data/" # production: simplestreams/data/
CID_COMMON="com.canonical.serverstack.%(region)s"
REGION=""  # set to empty to push to all
XPRE="" # production: set this to empty string for real
MAX_DAILY=10
MAX_RELEASED=10
HOOK_COMMAND="" # set this to full path to a command to run
#HOOK_COMMAND="$(dirname $0)/image-modify"


BASIC_FILTERS="
  arch~(x86_64|amd64|i386|i686)
  ftype~(disk1.img|disk.img)
"
UBUNTU_FILTERS="
  release~(precise|trusty|utopic|vivid|devel)
  $BASIC_FILTERS
"

[ "${TENV_SETUP:-0}" != "0" -o "${NO_TENV:-0}" != "0" ] || {
   echo "expecting to be run from tenv (simplestreams/tools/tenv)";
   echo "do that or export NO_TENV=1";
   exit 2;
} 1>&2

[ -n "$OS_AUTH_URL" ] || {
   echo "You probably need to set up your openstack creds ('. novarc')"
   exit 2
} 1>&2

gmirror() {
   local namepre="$1" cid="$2" url="$3"
   shift 3
   [ "${MAX}" = "0" ] &&
      { echo "skipping ${namepre}, MAX=0" 1>&2; return 0; }
   sstream-mirror-glance -vv \
      ${MAX:+--max=${MAX}} ${REGION:+"--region=${REGION}"} \
      "--cloud-name=${CLOUDNAME}" "--output-swift=${SWIFT_PATH}" \
      "--name-prefix=${XPRE}${namepre%/}/" "--content-id=${CID_COMMON}:$cid" \
      ${HOOK_COMMAND:+"--modify-hook=${HOOK_COMMAND}"} \
      "${url}" $FILTERS "$@"
}
fail() { [ $# -eq 0 ] || echo "$@" 1>&2; exit 2; }

## with cirros data
## add cirros signing key
# gpg-trust-pubkey ./simplestreams/examples/keys/cirros.pub
## get a local mirror (for quicker iterating)
# sstream-mirror --progress --max=2 \
#    http://download.cirros-cloud.net/ ./cirros-mirror \
#    arch=x86_64 ftype=disk.img
#MAX=2; gmirror "cirros/" "cirros" ./cirros-mirror/ arch=x86_64 ftype=disk.img

FILTERS=$UBUNTU_FILTERS
## released
MAX=${MAX_RELEASED};
gmirror "ubuntu-released/" "ubuntu:released" \
    http://cloud-images.ubuntu.com/releases/ ||
    fail "failed gmirror for ubuntu-released"

## daily
MAX=${MAX_DAILY};
gmirror "ubuntu-daily/" "ubuntu:daily" \
    http://cloud-images.ubuntu.com/daily/ ||
    fail "failed gmirror for ubuntu-daily"

## ubuntu-core/devel (snappy)
MAX=2
gmirror "ubuntu-core/devel/" "ubuntu:core:devel" \
    http://cloud-images.ubuntu.com/snappy/ ||
    fail "failed gmirror for ubuntu-snappy"

MAX=2
FILTERS="$BASIC_FILTERS"
myd=$(dirname "$0")
"$myd/simplestreams/tools/gpg-trust-pubkey" ./simplestreams/examples/keys/cirros.pub
gmirror "cirros/" "cirros" http://download.cirros-cloud.net/ ||
    fail "failed cirros import"

FILTERS="$BASIC_FILTERS"
gmirror smoser-images/ smoser:images \
    http://smoser.brickies.net/image-streams/streams/v1/index.json ||
    fail "failed importing smoser images"
Download as text