better safe then sorry. especially for rm
Signed-off-by: Jörg Thalheim <joerg@higgsboson.tk>
... | ... |
@@ -252,7 +252,7 @@ bundle() { |
252 | 252 |
bundlescript=$1 |
253 | 253 |
bundle=$(basename $bundlescript) |
254 | 254 |
echo "---> Making bundle: $bundle (in bundles/$VERSION/$bundle)" |
255 |
- mkdir -p bundles/$VERSION/$bundle |
|
255 |
+ mkdir -p "bundles/$VERSION/$bundle" |
|
256 | 256 |
source "$bundlescript" "$(pwd)/bundles/$VERSION/$bundle" |
257 | 257 |
} |
258 | 258 |
|
... | ... |
@@ -262,13 +262,13 @@ main() { |
262 | 262 |
mkdir -p bundles |
263 | 263 |
if [ -e "bundles/$VERSION" ]; then |
264 | 264 |
echo "bundles/$VERSION already exists. Removing." |
265 |
- rm -fr bundles/$VERSION && mkdir bundles/$VERSION || exit 1 |
|
265 |
+ rm -fr "bundles/$VERSION" && mkdir "bundles/$VERSION" || exit 1 |
|
266 | 266 |
echo |
267 | 267 |
fi |
268 | 268 |
|
269 | 269 |
if [ "$(go env GOHOSTOS)" != 'windows' ]; then |
270 | 270 |
# Windows and symlinks don't get along well |
271 |
- ln -sfT $VERSION bundles/latest |
|
271 |
+ ln -sfT "$VERSION" bundles/latest |
|
272 | 272 |
fi |
273 | 273 |
|
274 | 274 |
if [ $# -lt 1 ]; then |
... | ... |
@@ -277,7 +277,7 @@ main() { |
277 | 277 |
bundles=($@) |
278 | 278 |
fi |
279 | 279 |
for bundle in ${bundles[@]}; do |
280 |
- bundle $SCRIPTDIR/make/$bundle |
|
280 |
+ bundle "$SCRIPTDIR/make/$bundle" |
|
281 | 281 |
echo |
282 | 282 |
done |
283 | 283 |
} |
... | ... |
@@ -30,4 +30,4 @@ else |
30 | 30 |
fi |
31 | 31 |
|
32 | 32 |
# sha1 our new dockerinit to ensure separate docker and dockerinit always run in a perfect pair compiled for one another |
33 |
-export DOCKER_INITSHA1="$($sha1sum $DEST/dockerinit-$VERSION | cut -d' ' -f1)" |
|
33 |
+export DOCKER_INITSHA1=$($sha1sum "$DEST/dockerinit-$VERSION" | cut -d' ' -f1) |
... | ... |
@@ -27,4 +27,4 @@ else |
27 | 27 |
fi |
28 | 28 |
|
29 | 29 |
# sha1 our new dockerinit to ensure separate docker and dockerinit always run in a perfect pair compiled for one another |
30 |
-export DOCKER_INITSHA1="$($sha1sum $DEST/dockerinit-$VERSION | cut -d' ' -f1)" |
|
30 |
+export DOCKER_INITSHA1=$($sha1sum "$DEST/dockerinit-$VERSION" | cut -d' ' -f1) |
... | ... |
@@ -2,8 +2,8 @@ |
2 | 2 |
|
3 | 3 |
for pidFile in $(find "$DEST" -name docker.pid); do |
4 | 4 |
pid=$(set -x; cat "$pidFile") |
5 |
- ( set -x; kill $pid ) |
|
6 |
- if ! wait $pid; then |
|
5 |
+ ( set -x; kill "$pid" ) |
|
6 |
+ if ! wait "$pid"; then |
|
7 | 7 |
echo >&2 "warning: PID $pid from $pidFile had a nonzero exit code" |
8 | 8 |
fi |
9 | 9 |
done |
... | ... |
@@ -40,26 +40,26 @@ bundle_ubuntu() { |
40 | 40 |
DIR=$DEST/build |
41 | 41 |
|
42 | 42 |
# Include our udev rules |
43 |
- mkdir -p $DIR/etc/udev/rules.d |
|
44 |
- cp contrib/udev/80-docker.rules $DIR/etc/udev/rules.d/ |
|
43 |
+ mkdir -p "$DIR/etc/udev/rules.d" |
|
44 |
+ cp contrib/udev/80-docker.rules "$DIR/etc/udev/rules.d/" |
|
45 | 45 |
|
46 | 46 |
# Include our init scripts |
47 |
- mkdir -p $DIR/etc/init |
|
48 |
- cp contrib/init/upstart/docker.conf $DIR/etc/init/ |
|
49 |
- mkdir -p $DIR/etc/init.d |
|
50 |
- cp contrib/init/sysvinit-debian/docker $DIR/etc/init.d/ |
|
51 |
- mkdir -p $DIR/etc/default |
|
52 |
- cp contrib/init/sysvinit-debian/docker.default $DIR/etc/default/docker |
|
53 |
- mkdir -p $DIR/lib/systemd/system |
|
54 |
- cp contrib/init/systemd/docker.{service,socket} $DIR/lib/systemd/system/ |
|
47 |
+ mkdir -p "$DIR/etc/init" |
|
48 |
+ cp contrib/init/upstart/docker.conf "$DIR/etc/init/" |
|
49 |
+ mkdir -p "$DIR/etc/init.d" |
|
50 |
+ cp contrib/init/sysvinit-debian/docker "$DIR/etc/init.d/" |
|
51 |
+ mkdir -p "$DIR/etc/default" |
|
52 |
+ cp contrib/init/sysvinit-debian/docker.default "$DIR/etc/default/docker" |
|
53 |
+ mkdir -p "$DIR/lib/systemd/system" |
|
54 |
+ cp contrib/init/systemd/docker.{service,socket} "$DIR/lib/systemd/system/" |
|
55 | 55 |
|
56 | 56 |
# Include contributed completions |
57 |
- mkdir -p $DIR/etc/bash_completion.d |
|
58 |
- cp contrib/completion/bash/docker $DIR/etc/bash_completion.d/ |
|
59 |
- mkdir -p $DIR/usr/share/zsh/vendor-completions |
|
60 |
- cp contrib/completion/zsh/_docker $DIR/usr/share/zsh/vendor-completions/ |
|
61 |
- mkdir -p $DIR/etc/fish/completions |
|
62 |
- cp contrib/completion/fish/docker.fish $DIR/etc/fish/completions/ |
|
57 |
+ mkdir -p "$DIR/etc/bash_completion.d" |
|
58 |
+ cp contrib/completion/bash/docker "$DIR/etc/bash_completion.d/" |
|
59 |
+ mkdir -p "$DIR/usr/share/zsh/vendor-completions" |
|
60 |
+ cp contrib/completion/zsh/_docker "$DIR/usr/share/zsh/vendor-completions/" |
|
61 |
+ mkdir -p "$DIR/etc/fish/completions" |
|
62 |
+ cp contrib/completion/fish/docker.fish "$DIR/etc/fish/completions/" |
|
63 | 63 |
|
64 | 64 |
# Include contributed man pages |
65 | 65 |
docs/man/md2man-all.sh -q |
... | ... |
@@ -76,11 +76,11 @@ bundle_ubuntu() { |
76 | 76 |
|
77 | 77 |
# Copy the binary |
78 | 78 |
# This will fail if the binary bundle hasn't been built |
79 |
- mkdir -p $DIR/usr/bin |
|
80 |
- cp $DEST/../binary/docker-$VERSION $DIR/usr/bin/docker |
|
79 |
+ mkdir -p "$DIR/usr/bin" |
|
80 |
+ cp "$DEST/../binary/docker-$VERSION" "$DIR/usr/bin/docker" |
|
81 | 81 |
|
82 | 82 |
# Generate postinst/prerm/postrm scripts |
83 |
- cat > $DEST/postinst <<'EOF' |
|
83 |
+ cat > "$DEST/postinst" <<'EOF' |
|
84 | 84 |
#!/bin/sh |
85 | 85 |
set -e |
86 | 86 |
set -u |
... | ... |
@@ -104,7 +104,7 @@ service docker $_dh_action 2>/dev/null || true |
104 | 104 |
|
105 | 105 |
#DEBHELPER# |
106 | 106 |
EOF |
107 |
- cat > $DEST/prerm <<'EOF' |
|
107 |
+ cat > "$DEST/prerm" <<'EOF' |
|
108 | 108 |
#!/bin/sh |
109 | 109 |
set -e |
110 | 110 |
set -u |
... | ... |
@@ -113,7 +113,7 @@ service docker stop 2>/dev/null || true |
113 | 113 |
|
114 | 114 |
#DEBHELPER# |
115 | 115 |
EOF |
116 |
- cat > $DEST/postrm <<'EOF' |
|
116 |
+ cat > "$DEST/postrm" <<'EOF' |
|
117 | 117 |
#!/bin/sh |
118 | 118 |
set -e |
119 | 119 |
set -u |
... | ... |
@@ -131,18 +131,18 @@ fi |
131 | 131 |
#DEBHELPER# |
132 | 132 |
EOF |
133 | 133 |
# TODO swaths of these were borrowed from debhelper's auto-inserted stuff, because we're still using fpm - we need to use debhelper instead, and somehow reconcile Ubuntu that way |
134 |
- chmod +x $DEST/postinst $DEST/prerm $DEST/postrm |
|
134 |
+ chmod +x "$DEST/postinst" "$DEST/prerm" "$DEST/postrm" |
|
135 | 135 |
|
136 | 136 |
( |
137 | 137 |
# switch directories so we create *.deb in the right folder |
138 |
- cd $DEST |
|
138 |
+ cd "$DEST" |
|
139 | 139 |
|
140 | 140 |
# create lxc-docker-VERSION package |
141 |
- fpm -s dir -C $DIR \ |
|
142 |
- --name lxc-docker-$VERSION --version "$PKGVERSION" \ |
|
143 |
- --after-install $DEST/postinst \ |
|
144 |
- --before-remove $DEST/prerm \ |
|
145 |
- --after-remove $DEST/postrm \ |
|
141 |
+ fpm -s dir -C "$DIR" \ |
|
142 |
+ --name "lxc-docker-$VERSION" --version "$PKGVERSION" \ |
|
143 |
+ --after-install "$DEST/postinst" \ |
|
144 |
+ --before-remove "$DEST/prerm" \ |
|
145 |
+ --after-remove "$DEST/postrm" \ |
|
146 | 146 |
--architecture "$PACKAGE_ARCHITECTURE" \ |
147 | 147 |
--prefix / \ |
148 | 148 |
--depends iptables \ |
... | ... |
@@ -184,8 +184,8 @@ EOF |
184 | 184 |
) |
185 | 185 |
|
186 | 186 |
# clean up after ourselves so we have a clean output directory |
187 |
- rm $DEST/postinst $DEST/prerm $DEST/postrm |
|
188 |
- rm -r $DIR |
|
187 |
+ rm "$DEST/postinst" "$DEST/prerm" "$DEST/postrm" |
|
188 |
+ rm -r "$DIR" |
|
189 | 189 |
} |
190 | 190 |
|
191 | 191 |
bundle_ubuntu |
... | ... |
@@ -71,23 +71,23 @@ BUCKET=$AWS_S3_BUCKET |
71 | 71 |
|
72 | 72 |
setup_s3() { |
73 | 73 |
# Try creating the bucket. Ignore errors (it might already exist). |
74 |
- s3cmd mb s3://$BUCKET 2>/dev/null || true |
|
74 |
+ s3cmd mb "s3://$BUCKET" 2>/dev/null || true |
|
75 | 75 |
# Check access to the bucket. |
76 | 76 |
# s3cmd has no useful exit status, so we cannot check that. |
77 | 77 |
# Instead, we check if it outputs anything on standard output. |
78 | 78 |
# (When there are problems, it uses standard error instead.) |
79 |
- s3cmd info s3://$BUCKET | grep -q . |
|
79 |
+ s3cmd info "s3://$BUCKET" | grep -q . |
|
80 | 80 |
# Make the bucket accessible through website endpoints. |
81 |
- s3cmd ws-create --ws-index index --ws-error error s3://$BUCKET |
|
81 |
+ s3cmd ws-create --ws-index index --ws-error error "s3://$BUCKET" |
|
82 | 82 |
} |
83 | 83 |
|
84 | 84 |
# write_to_s3 uploads the contents of standard input to the specified S3 url. |
85 | 85 |
write_to_s3() { |
86 | 86 |
DEST=$1 |
87 | 87 |
F=`mktemp` |
88 |
- cat > $F |
|
89 |
- s3cmd --acl-public --mime-type='text/plain' put $F $DEST |
|
90 |
- rm -f $F |
|
88 |
+ cat > "$F" |
|
89 |
+ s3cmd --acl-public --mime-type='text/plain' put "$F" "$DEST" |
|
90 |
+ rm -f "$F" |
|
91 | 91 |
} |
92 | 92 |
|
93 | 93 |
s3_url() { |
... | ... |
@@ -246,20 +246,20 @@ release_build() { |
246 | 246 |
# 1. A full APT repository is published at $BUCKET/ubuntu/ |
247 | 247 |
# 2. Instructions for using the APT repository are uploaded at $BUCKET/ubuntu/index |
248 | 248 |
release_ubuntu() { |
249 |
- [ -e bundles/$VERSION/ubuntu ] || { |
|
249 |
+ [ -e "bundles/$VERSION/ubuntu" ] || { |
|
250 | 250 |
echo >&2 './hack/make.sh must be run before release_ubuntu' |
251 | 251 |
exit 1 |
252 | 252 |
} |
253 | 253 |
|
254 | 254 |
# Sign our packages |
255 | 255 |
dpkg-sig -g "--passphrase $GPG_PASSPHRASE" -k releasedocker \ |
256 |
- --sign builder bundles/$VERSION/ubuntu/*.deb |
|
256 |
+ --sign builder "bundles/$VERSION/ubuntu/"*.deb |
|
257 | 257 |
|
258 | 258 |
# Setup the APT repo |
259 | 259 |
APTDIR=bundles/$VERSION/ubuntu/apt |
260 |
- mkdir -p $APTDIR/conf $APTDIR/db |
|
261 |
- s3cmd sync s3://$BUCKET/ubuntu/db/ $APTDIR/db/ || true |
|
262 |
- cat > $APTDIR/conf/distributions <<EOF |
|
260 |
+ mkdir -p "$APTDIR/conf" "$APTDIR/db" |
|
261 |
+ s3cmd sync "s3://$BUCKET/ubuntu/db/" "$APTDIR/db/" || true |
|
262 |
+ cat > "$APTDIR/conf/distributions" <<EOF |
|
263 | 263 |
Codename: docker |
264 | 264 |
Components: main |
265 | 265 |
Architectures: amd64 i386 |
... | ... |
@@ -267,19 +267,19 @@ EOF |
267 | 267 |
|
268 | 268 |
# Add the DEB package to the APT repo |
269 | 269 |
DEBFILE=bundles/$VERSION/ubuntu/lxc-docker*.deb |
270 |
- reprepro -b $APTDIR includedeb docker $DEBFILE |
|
270 |
+ reprepro -b "$APTDIR" includedeb docker "$DEBFILE" |
|
271 | 271 |
|
272 | 272 |
# Sign |
273 | 273 |
for F in $(find $APTDIR -name Release); do |
274 |
- gpg -u releasedocker --passphrase $GPG_PASSPHRASE \ |
|
274 |
+ gpg -u releasedocker --passphrase "$GPG_PASSPHRASE" \ |
|
275 | 275 |
--armor --sign --detach-sign \ |
276 |
- --output $F.gpg $F |
|
276 |
+ --output "$F.gpg" "$F" |
|
277 | 277 |
done |
278 | 278 |
|
279 | 279 |
# Upload keys |
280 |
- s3cmd sync $HOME/.gnupg/ s3://$BUCKET/ubuntu/.gnupg/ |
|
281 |
- gpg --armor --export releasedocker > bundles/$VERSION/ubuntu/gpg |
|
282 |
- s3cmd --acl-public put bundles/$VERSION/ubuntu/gpg s3://$BUCKET/gpg |
|
280 |
+ s3cmd sync "$HOME/.gnupg/" "s3://$BUCKET/ubuntu/.gnupg/" |
|
281 |
+ gpg --armor --export releasedocker > "bundles/$VERSION/ubuntu/gpg" |
|
282 |
+ s3cmd --acl-public put "bundles/$VERSION/ubuntu/gpg" "s3://$BUCKET/gpg" |
|
283 | 283 |
|
284 | 284 |
local gpgFingerprint=36A1D7869245C8950F966E92D8576A8BA88D21E9 |
285 | 285 |
if [[ $BUCKET == test* ]]; then |
... | ... |
@@ -287,7 +287,7 @@ EOF |
287 | 287 |
fi |
288 | 288 |
|
289 | 289 |
# Upload repo |
290 |
- s3cmd --acl-public sync $APTDIR/ s3://$BUCKET/ubuntu/ |
|
290 |
+ s3cmd --acl-public sync "$APTDIR/" "s3://$BUCKET/ubuntu/" |
|
291 | 291 |
cat <<EOF | write_to_s3 s3://$BUCKET/ubuntu/index |
292 | 292 |
# Check that HTTPS transport is available to APT |
293 | 293 |
if [ ! -e /usr/lib/apt/methods/https ]; then |
... | ... |
@@ -312,14 +312,14 @@ EOF |
312 | 312 |
|
313 | 313 |
# Add redirect at /ubuntu/info for URL-backwards-compatibility |
314 | 314 |
rm -rf /tmp/emptyfile && touch /tmp/emptyfile |
315 |
- s3cmd --acl-public --add-header='x-amz-website-redirect-location:/ubuntu/' --mime-type='text/plain' put /tmp/emptyfile s3://$BUCKET/ubuntu/info |
|
315 |
+ s3cmd --acl-public --add-header='x-amz-website-redirect-location:/ubuntu/' --mime-type='text/plain' put /tmp/emptyfile "s3://$BUCKET/ubuntu/info" |
|
316 | 316 |
|
317 | 317 |
echo "APT repository uploaded. Instructions available at $(s3_url)/ubuntu" |
318 | 318 |
} |
319 | 319 |
|
320 | 320 |
# Upload binaries and tgz files to S3 |
321 | 321 |
release_binaries() { |
322 |
- [ -e bundles/$VERSION/cross/linux/amd64/docker-$VERSION ] || { |
|
322 |
+ [ -e "bundles/$VERSION/cross/linux/amd64/docker-$VERSION" ] || { |
|
323 | 323 |
echo >&2 './hack/make.sh must be run before release_binaries' |
324 | 324 |
exit 1 |
325 | 325 |
} |
... | ... |
@@ -341,29 +341,29 @@ EOF |
341 | 341 |
|
342 | 342 |
# Add redirect at /builds/info for URL-backwards-compatibility |
343 | 343 |
rm -rf /tmp/emptyfile && touch /tmp/emptyfile |
344 |
- s3cmd --acl-public --add-header='x-amz-website-redirect-location:/builds/' --mime-type='text/plain' put /tmp/emptyfile s3://$BUCKET/builds/info |
|
344 |
+ s3cmd --acl-public --add-header='x-amz-website-redirect-location:/builds/' --mime-type='text/plain' put /tmp/emptyfile "s3://$BUCKET/builds/info" |
|
345 | 345 |
|
346 | 346 |
if [ -z "$NOLATEST" ]; then |
347 | 347 |
echo "Advertising $VERSION on $BUCKET as most recent version" |
348 |
- echo $VERSION | write_to_s3 s3://$BUCKET/latest |
|
348 |
+ echo "$VERSION" | write_to_s3 "s3://$BUCKET/latest" |
|
349 | 349 |
fi |
350 | 350 |
} |
351 | 351 |
|
352 | 352 |
# Upload the index script |
353 | 353 |
release_index() { |
354 |
- sed "s,url='https://get.docker.com/',url='$(s3_url)/'," hack/install.sh | write_to_s3 s3://$BUCKET/index |
|
354 |
+ sed "s,url='https://get.docker.com/',url='$(s3_url)/'," hack/install.sh | write_to_s3 "s3://$BUCKET/index" |
|
355 | 355 |
} |
356 | 356 |
|
357 | 357 |
release_test() { |
358 | 358 |
if [ -e "bundles/$VERSION/test" ]; then |
359 |
- s3cmd --acl-public sync bundles/$VERSION/test/ s3://$BUCKET/test/ |
|
359 |
+ s3cmd --acl-public sync "bundles/$VERSION/test/" "s3://$BUCKET/test/" |
|
360 | 360 |
fi |
361 | 361 |
} |
362 | 362 |
|
363 | 363 |
setup_gpg() { |
364 | 364 |
# Make sure that we have our keys |
365 |
- mkdir -p $HOME/.gnupg/ |
|
366 |
- s3cmd sync s3://$BUCKET/ubuntu/.gnupg/ $HOME/.gnupg/ || true |
|
365 |
+ mkdir -p "$HOME/.gnupg/" |
|
366 |
+ s3cmd sync "s3://$BUCKET/ubuntu/.gnupg/" "$HOME/.gnupg/" || true |
|
367 | 367 |
gpg --list-keys releasedocker >/dev/null || { |
368 | 368 |
gpg --gen-key --batch <<EOF |
369 | 369 |
Key-Type: RSA |