Browse code

Add several of the small make.sh fixes from #1920, and make the output more consistent and contributor-friendly, since release instructions already exist in release.sh

Tianon Gravi authored on 2013/09/24 03:19:28
Showing 2 changed files
... ...
@@ -16,8 +16,8 @@
16 16
 #   DO NOT CALL THIS SCRIPT DIRECTLY.
17 17
 # - The right way to call this script is to invoke "docker build ." from
18 18
 #   your checkout of the Docker repository, and then
19
-#   "docker run hack/make.sh" in the resulting container image. 
20
-# 
19
+#   "docker run hack/make.sh" in the resulting container image.
20
+#
21 21
 
22 22
 set -e
23 23
 
... ...
@@ -25,9 +25,9 @@ set -e
25 25
 # but really, they shouldn't. We want to be in a container!
26 26
 RESOLVCONF=$(readlink --canonicalize /etc/resolv.conf)
27 27
 grep -q "$RESOLVCONF" /proc/mounts || {
28
-	echo "# WARNING! I don't seem to be running in a docker container.
28
+	echo "# WARNING! I don't seem to be running in a docker container."
29 29
 	echo "# The result of this command might be an incorrect build, and will not be officially supported."
30
-	echo "# Try this: 'docker build -t docker . && docker run docker ./hack/make.sh'
30
+	echo "# Try this: 'docker build -t docker . && docker run docker ./hack/make.sh'"
31 31
 }
32 32
 
33 33
 # List of bundles to create when no argument is passed
... ...
@@ -39,8 +39,7 @@ DEFAULT_BUNDLES=(
39 39
 
40 40
 VERSION=$(cat ./VERSION)
41 41
 GITCOMMIT=$(git rev-parse --short HEAD)
42
-if test -n "$(git status --porcelain)"
43
-then
42
+if [ -n "$(git status --porcelain)" ]; then
44 43
 	GITCOMMIT="$GITCOMMIT-dirty"
45 44
 fi
46 45
 
... ...
@@ -51,19 +50,19 @@ LDFLAGS="-X main.GITCOMMIT $GITCOMMIT -X main.VERSION $VERSION -d -w"
51 51
 bundle() {
52 52
 	bundlescript=$1
53 53
 	bundle=$(basename $bundlescript)
54
-	echo "---> Making bundle: $bundle"
54
+	echo "---> Making bundle: $bundle (in bundles/$VERSION/$bundle)"
55 55
 	mkdir -p bundles/$VERSION/$bundle
56 56
 	source $bundlescript $(pwd)/bundles/$VERSION/$bundle
57 57
 }
58 58
 
59 59
 main() {
60
-
61
-	# We want this to fail if the bundles already exist.
60
+	# We want this to fail if the bundles already exist and cannot be removed.
62 61
 	# This is to avoid mixing bundles from different versions of the code.
63 62
 	mkdir -p bundles
64 63
 	if [ -e "bundles/$VERSION" ]; then
65 64
 		echo "bundles/$VERSION already exists. Removing."
66 65
 		rm -fr bundles/$VERSION && mkdir bundles/$VERSION || exit 1
66
+		echo
67 67
 	fi
68 68
 	SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
69 69
 	if [ $# -lt 1 ]; then
... ...
@@ -73,19 +72,8 @@ main() {
73 73
 	fi
74 74
 	for bundle in ${bundles[@]}; do
75 75
 		bundle $SCRIPTDIR/make/$bundle
76
+		echo
76 77
 	done
77
-	cat <<EOF
78
-###############################################################################
79
-Now run the resulting image, making sure that you set AWS_S3_BUCKET,
80
-AWS_ACCESS_KEY, and AWS_SECRET_KEY environment variables:
81
-
82
-docker run -e AWS_S3_BUCKET=get-staging.docker.io \\
83
-              AWS_ACCESS_KEY=AKI1234... \\
84
-              AWS_SECRET_KEY=sEs3mE... \\
85
-              GPG_PASSPHRASE=sesame... \\
86
-              image_id_or_name
87
-###############################################################################
88
-EOF
89 78
 }
90 79
 
91 80
 main "$@"
... ...
@@ -1,4 +1,7 @@
1
+#!/bin/sh
1 2
 
2 3
 DEST=$1
3 4
 
4 5
 go build -o $DEST/docker-$VERSION -ldflags "$LDFLAGS" ./docker
6
+
7
+echo "Created binary: $DEST/docker-$VERSION"