Prechádzať zdrojové kódy

Release script also takes care of index file (if the S3 bucket is WS-enabled)

Jérôme Petazzoni 12 rokov pred
rodič
commit
0469e47674
3 zmenil súbory, kde vykonal 32 pridanie a 16 odobranie
  1. 5 5
      contrib/install.sh
  2. 11 10
      make.sh
  3. 16 1
      release.sh

+ 5 - 5
contrib/install.sh

@@ -35,10 +35,10 @@ else
     fi
 fi
 
-echo "Downloading docker binary and uncompressing into /usr/local/bin..."
-curl -s https://get.docker.io/builds/$(uname -s)/$(uname -m)/docker-latest.tgz |
-tar -C /usr/local/bin --strip-components=1 -zxf- \
-docker-latest/docker
+echo "Downloading docker binary to /usr/local/bin..."
+curl -s https://get.docker.io/builds/$(uname -s)/$(uname -m)/docker-latest \
+    > /usr/local/bin/docker
+chmod +x /usr/local/bin/docker
 
 if [ -f /etc/init/dockerd.conf ]
 then
@@ -50,7 +50,7 @@ description "Docker daemon"
 start on filesystem or runlevel [2345]
 stop on runlevel [!2345]
 respawn
-exec env LANG="en_US.UTF-8" /usr/local/bin/docker -d
+exec /usr/local/bin/docker -d
 EOF
 fi
 

+ 11 - 10
make.sh

@@ -51,6 +51,16 @@ Docker is a great building block for automating distributed systems:
 large-scale web deployments, database clusters, continuous deployment systems,
 private PaaS, service-oriented architectures, etc."
 
+UPSTART_SCRIPT='description     "Docker daemon"
+
+start on filesystem or runlevel [2345]
+stop on runlevel [!2345]
+
+respawn
+
+exec docker -d
+'
+
 # Each "bundle" is a different type of build artefact: static binary, Ubuntu
 # package, etc.
 
@@ -86,16 +96,7 @@ bundle_ubuntu() {
 
 	# Generate an upstart config file (ubuntu-specific)
 	mkdir -p $DIR/etc/init
-	cat > $DIR/etc/init/docker.conf <<EOF
-description     "Run docker"
-
-start on filesystem or runlevel [2345]
-stop on runlevel [!2345]
-
-respawn
-
-exec docker -d
-EOF
+	echo "$UPSTART_SCRIPT" > $DIR/etc/init/docker.conf
 
 	# Copy the binary
 	mkdir -p $DIR/usr/bin

+ 16 - 1
release.sh

@@ -48,12 +48,14 @@ BUCKET=$AWS_S3_BUCKET
 
 setup_s3() {
 	# Try creating the bucket. Ignore errors (it might already exist).
-	s3cmd --acl-public mb s3://$BUCKET 2>/dev/null || true
+	s3cmd mb s3://$BUCKET 2>/dev/null || true
 	# Check access to the bucket.
 	# s3cmd has no useful exit status, so we cannot check that.
 	# Instead, we check if it outputs anything on standard output.
 	# (When there are problems, it uses standard error instead.)
 	s3cmd info s3://$BUCKET | grep -q .
+	# Make the bucket accessible through website endpoints.
+	s3cmd ws-create --ws-index index --ws-error error s3://$BUCKET
 }
 
 # write_to_s3 uploads the contents of standard input to the specified S3 url.
@@ -152,10 +154,23 @@ EOF
 	fi
 }
 
+# Upload the index script
+release_index() {
+	(
+	if [ "$BUCKET" != "get.docker.io" ]
+	then
+		sed s,https://get.docker.io/,http://$BUCKET.s3.amazonaws.com/, contrib/install.sh
+	else
+		cat contrib/install.sh
+	fi
+	) | write_to_s3 s3://$BUCKET/index
+}
+
 main() {
 	setup_s3
 	release_binary
 	release_ubuntu
+	release_index
 }
 
 main