Browse code

Update release script to move https://get.docker.io/ubuntu/info to https://get.docker.io/ubuntu/ and provide a backwards-compatibility redirect (same for /builds/info)

Tianon Gravi authored on 2013/11/09 07:45:18
Showing 1 changed files
... ...
@@ -114,7 +114,7 @@ s3_url() {
114 114
 
115 115
 # Upload the 'ubuntu' bundle to S3:
116 116
 # 1. A full APT repository is published at $BUCKET/ubuntu/
117
-# 2. Instructions for using the APT repository are uploaded at $BUCKET/ubuntu/info
117
+# 2. Instructions for using the APT repository are uploaded at $BUCKET/ubuntu/index
118 118
 release_ubuntu() {
119 119
 	[ -e bundles/$VERSION/ubuntu ] || {
120 120
 		echo >&2 './hack/make.sh must be run before release_ubuntu'
... ...
@@ -168,7 +168,7 @@ EOF
168 168
 
169 169
 	# Upload repo
170 170
 	s3cmd --acl-public sync $APTDIR/ s3://$BUCKET/ubuntu/
171
-	cat <<EOF | write_to_s3 s3://$BUCKET/ubuntu/info
171
+	cat <<EOF | write_to_s3 s3://$BUCKET/ubuntu/index
172 172
 # Add the repository to your APT sources
173 173
 echo deb $(s3_url)/ubuntu docker main > /etc/apt/sources.list.d/docker.list
174 174
 # Then import the repository key
... ...
@@ -180,7 +180,12 @@ apt-get update ; apt-get install -y lxc-docker
180 180
 # Alternatively, just use the curl-able install.sh script provided at $(s3_url)
181 181
 #
182 182
 EOF
183
-	echo "APT repository uploaded. Instructions available at $(s3_url)/ubuntu/info"
183
+
184
+	# Add redirect at /ubuntu/info for URL-backwards-compatibility
185
+	rm -rf /tmp/emptyfile && touch /tmp/emptyfile
186
+	s3cmd --acl-public --add-header='x-amz-website-redirect-location:/ubuntu/' --mime-type='text/plain' put /tmp/emptyfile s3://$BUCKET/ubuntu/info
187
+
188
+	echo "APT repository uploaded. Instructions available at $(s3_url)/ubuntu"
184 189
 }
185 190
 
186 191
 # Upload a static binary to S3
... ...
@@ -189,14 +194,20 @@ release_binary() {
189 189
 		echo >&2 './hack/make.sh must be run before release_binary'
190 190
 		exit 1
191 191
 	}
192
+
192 193
 	S3DIR=s3://$BUCKET/builds/Linux/x86_64
193 194
 	s3cmd --acl-public put bundles/$VERSION/binary/docker-$VERSION $S3DIR/docker-$VERSION
194
-	cat <<EOF | write_to_s3 s3://$BUCKET/builds/info
195
+	cat <<EOF | write_to_s3 s3://$BUCKET/builds/index
195 196
 # To install, run the following command as root:
196 197
 curl -O $(s3_url)/builds/Linux/x86_64/docker-$VERSION && chmod +x docker-$VERSION && sudo mv docker-$VERSION /usr/local/bin/docker
197 198
 # Then start docker in daemon mode:
198 199
 sudo /usr/local/bin/docker -d
199 200
 EOF
201
+
202
+	# Add redirect at /builds/info for URL-backwards-compatibility
203
+	rm -rf /tmp/emptyfile && touch /tmp/emptyfile
204
+	s3cmd --acl-public --add-header='x-amz-website-redirect-location:/builds/' --mime-type='text/plain' put /tmp/emptyfile s3://$BUCKET/builds/info
205
+
200 206
 	if [ -z "$NOLATEST" ]; then
201 207
 		echo "Copying docker-$VERSION to docker-latest"
202 208
 		s3cmd --acl-public cp $S3DIR/docker-$VERSION $S3DIR/docker-latest