diff options
author | Pavlos Ratis <dastergon@gentoo.org> | 2014-07-07 12:23:22 +0300 |
---|---|---|
committer | Pavlos Ratis <dastergon@gentoo.org> | 2014-07-07 12:23:22 +0300 |
commit | 0cb2e39c46468d9640248fa8af7b12024fc161fa (patch) | |
tree | 52480075506bb84806eed0c3d8f1da7826abd284 | |
parent | add a sane and temporarily conservative gitignore (diff) | |
download | docker-images-0cb2e39c46468d9640248fa8af7b12024fc161fa.tar.gz docker-images-0cb2e39c46468d9640248fa8af7b12024fc161fa.tar.bz2 docker-images-0cb2e39c46468d9640248fa8af7b12024fc161fa.zip |
minor improvements
1) stderr 2 stdout
2) shorter if statement
3) minor changes in strings
-rw-r--r-- | amd64/build.sh | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/amd64/build.sh b/amd64/build.sh index 2246406..73ae7f8 100644 --- a/amd64/build.sh +++ b/amd64/build.sh @@ -1,34 +1,26 @@ #!/bin/bash -die() -{ - echo "$1" - exit 1 -} +die(){ echo "$@" 1>&2; exit 1; } base_url="http://distfiles.gentoo.org/releases/amd64/autobuilds" latest_stage3=$(curl "${base_url}/latest-stage3-amd64.txt" 2>/dev/null | grep -v '#') stage3=$(basename "${latest_stage3}") -if [ ! -f "${stage3}" ]; then - xz=true -else - xz=false -fi +[ ! -f "${stage3}" ] && xz=true || xz=false -wget -nc "${base_url}/${latest_stage3}" || die "couldn't download stage3" -wget -nc "${base_url}/${latest_stage3}.DIGESTS.asc" || die "couldn't download digests" -wget -nc "${base_url}/${latest_stage3}.CONTENTS" || die "couldn't download contents" +wget -nc "${base_url}/${latest_stage3}" || die "Could not download stage3" +wget -nc "${base_url}/${latest_stage3}.DIGESTS.asc" || die "Could not download digests" +wget -nc "${base_url}/${latest_stage3}.CONTENTS" || die "Could not download contents" sha512_digests=$(grep -A1 SHA512 "${stage3}.DIGESTS.asc" | grep -v '^--') -gpg --verify "${stage3}.DIGESTS.asc" || die "insecure digests" -echo "${sha512_digests}" | sha512sum -c || die "checksum validation failed" +gpg --verify "${stage3}.DIGESTS.asc" || die "Insecure digests" +echo "${sha512_digests}" | sha512sum -c || die "Checksum validation failed" if [ ${xz} == true ] || [ ! -f stage3-amd64.tar.xz ]; then - echo "I'm transforming the bz2 tarball to xz (golang bug). This will take some time..." - bunzip2 -c "${stage3}" | xz -z > stage3-amd64.tar.xz || die "failed to recompress to xz" + echo "Transforming bz2 tarball to xz (golang bug). This will take some time..." + bunzip2 -c "${stage3}" | xz -z > stage3-amd64.tar.xz || die "Failed to recompress to xz" fi echo "I'm done with the stage3." echo "Building docker Gentoo image now..." -docker build -t gentoo .
\ No newline at end of file +docker build -t gentoo . |