... | ... |
@@ -35,10 +35,10 @@ else |
35 | 35 |
fi |
36 | 36 |
fi |
37 | 37 |
|
38 |
-echo "Downloading docker binary and uncompressing into /usr/local/bin..." |
|
39 |
-curl -s https://get.docker.io/builds/$(uname -s)/$(uname -m)/docker-latest.tgz | |
|
40 |
-tar -C /usr/local/bin --strip-components=1 -zxf- \ |
|
41 |
-docker-latest/docker |
|
38 |
+echo "Downloading docker binary to /usr/local/bin..." |
|
39 |
+curl -s https://get.docker.io/builds/$(uname -s)/$(uname -m)/docker-latest \ |
|
40 |
+ > /usr/local/bin/docker |
|
41 |
+chmod +x /usr/local/bin/docker |
|
42 | 42 |
|
43 | 43 |
if [ -f /etc/init/dockerd.conf ] |
44 | 44 |
then |
... | ... |
@@ -50,7 +50,7 @@ description "Docker daemon" |
50 | 50 |
start on filesystem or runlevel [2345] |
51 | 51 |
stop on runlevel [!2345] |
52 | 52 |
respawn |
53 |
-exec env LANG="en_US.UTF-8" /usr/local/bin/docker -d |
|
53 |
+exec /usr/local/bin/docker -d |
|
54 | 54 |
EOF |
55 | 55 |
fi |
56 | 56 |
|
... | ... |
@@ -51,6 +51,16 @@ Docker is a great building block for automating distributed systems: |
51 | 51 |
large-scale web deployments, database clusters, continuous deployment systems, |
52 | 52 |
private PaaS, service-oriented architectures, etc." |
53 | 53 |
|
54 |
+UPSTART_SCRIPT='description "Docker daemon" |
|
55 |
+ |
|
56 |
+start on filesystem or runlevel [2345] |
|
57 |
+stop on runlevel [!2345] |
|
58 |
+ |
|
59 |
+respawn |
|
60 |
+ |
|
61 |
+exec docker -d |
|
62 |
+' |
|
63 |
+ |
|
54 | 64 |
# Each "bundle" is a different type of build artefact: static binary, Ubuntu |
55 | 65 |
# package, etc. |
56 | 66 |
|
... | ... |
@@ -86,16 +96,7 @@ bundle_ubuntu() { |
86 | 86 |
|
87 | 87 |
# Generate an upstart config file (ubuntu-specific) |
88 | 88 |
mkdir -p $DIR/etc/init |
89 |
- cat > $DIR/etc/init/docker.conf <<EOF |
|
90 |
-description "Run docker" |
|
91 |
- |
|
92 |
-start on filesystem or runlevel [2345] |
|
93 |
-stop on runlevel [!2345] |
|
94 |
- |
|
95 |
-respawn |
|
96 |
- |
|
97 |
-exec docker -d |
|
98 |
-EOF |
|
89 |
+ echo "$UPSTART_SCRIPT" > $DIR/etc/init/docker.conf |
|
99 | 90 |
|
100 | 91 |
# Copy the binary |
101 | 92 |
mkdir -p $DIR/usr/bin |
... | ... |
@@ -48,12 +48,14 @@ BUCKET=$AWS_S3_BUCKET |
48 | 48 |
|
49 | 49 |
setup_s3() { |
50 | 50 |
# Try creating the bucket. Ignore errors (it might already exist). |
51 |
- s3cmd --acl-public mb s3://$BUCKET 2>/dev/null || true |
|
51 |
+ s3cmd mb s3://$BUCKET 2>/dev/null || true |
|
52 | 52 |
# Check access to the bucket. |
53 | 53 |
# s3cmd has no useful exit status, so we cannot check that. |
54 | 54 |
# Instead, we check if it outputs anything on standard output. |
55 | 55 |
# (When there are problems, it uses standard error instead.) |
56 | 56 |
s3cmd info s3://$BUCKET | grep -q . |
57 |
+ # Make the bucket accessible through website endpoints. |
|
58 |
+ s3cmd ws-create --ws-index index --ws-error error s3://$BUCKET |
|
57 | 59 |
} |
58 | 60 |
|
59 | 61 |
# write_to_s3 uploads the contents of standard input to the specified S3 url. |
... | ... |
@@ -152,10 +154,23 @@ EOF |
152 | 152 |
fi |
153 | 153 |
} |
154 | 154 |
|
155 |
+# Upload the index script |
|
156 |
+release_index() { |
|
157 |
+ ( |
|
158 |
+ if [ "$BUCKET" != "get.docker.io" ] |
|
159 |
+ then |
|
160 |
+ sed s,https://get.docker.io/,http://$BUCKET.s3.amazonaws.com/, contrib/install.sh |
|
161 |
+ else |
|
162 |
+ cat contrib/install.sh |
|
163 |
+ fi |
|
164 |
+ ) | write_to_s3 s3://$BUCKET/index |
|
165 |
+} |
|
166 |
+ |
|
155 | 167 |
main() { |
156 | 168 |
setup_s3 |
157 | 169 |
release_binary |
158 | 170 |
release_ubuntu |
171 |
+ release_index |
|
159 | 172 |
} |
160 | 173 |
|
161 | 174 |
main |