Skip to content

Commit

Permalink
edgexfoundry-snapcraft.sh: use && instead of ; between cmds
Browse files Browse the repository at this point in the history
The previous behavior would not actually fail the build setup if for example the
SHA's didn't match, but now if the SHA's don't match, sha512sum will exit
non-zero and using && results in the whole command failing.

We also should delete the sha512 file as well, it is not needed during the
build.

Fixes: edgexfoundry#517

Signed-off-by: Ian Johnson <[email protected]>
  • Loading branch information
anonymouse64 committed Jul 13, 2020
1 parent 9f87549 commit ce19d6d
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions shell/edgexfoundry-snapcraft.sh
Original file line number Diff line number Diff line change
Expand Up @@ -128,20 +128,20 @@ ARG ARCH
# We do this because we can't easily run snapd (and thus snaps) inside a
# docker container without disabling important security protections enabled
# for docker containers.
# TODO: add a little bit of error checking for the curl calls in case we ever
# are on a proxy or something and we end up downloading a login page or
# or something like that
RUN apt-get update && \
apt-get dist-upgrade --yes && \
apt-get install --yes \
curl sudo jq squashfs-tools && \
for thesnap in core core18 snapcraft; do \
dlUrl=$(curl -s -H 'X-Ubuntu-Series: 16' -H "X-Ubuntu-Architecture: $ARCH" "https://api.snapcraft.io/api/v1/snaps/details/$thesnap" | jq '.download_url' -r); \
dlSHA=$(curl -s -H 'X-Ubuntu-Series: 16' -H "X-Ubuntu-Architecture: $ARCH" "https://api.snapcraft.io/api/v1/snaps/details/$thesnap" | jq '.download_sha512' -r); \
curl -s -L $dlUrl --output $thesnap.snap; \
echo "$dlSHA $thesnap.snap" > $thesnap.snap.sha512; \
sha512sum -c $thesnap.snap.sha512; \
mkdir -p /snap/$thesnap && unsquashfs -n -d /snap/$thesnap/current $thesnap.snap && rm $thesnap.snap; \
dlUrl=$(curl -s -H 'X-Ubuntu-Series: 16' -H "X-Ubuntu-Architecture: $ARCH" "https://api.snapcraft.io/api/v1/snaps/details/$thesnap" | jq '.download_url' -r) && \
dlSHA=$(curl -s -H 'X-Ubuntu-Series: 16' -H "X-Ubuntu-Architecture: $ARCH" "https://api.snapcraft.io/api/v1/snaps/details/$thesnap" | jq '.download_sha512' -r) && \
curl -s -L $dlUrl --output $thesnap.snap && \
echo "$dlSHA $thesnap.snap" > $thesnap.snap.sha512 && \
sha512sum -c $thesnap.snap.sha512 && \
mkdir -p /snap/$thesnap && \
unsquashfs -n -d /snap/$thesnap/current $thesnap.snap && \
rm $thesnap.snap.sha512 && \
rm $thesnap.snap; \
done && \
apt remove --yes --purge curl jq squashfs-tools && \
apt-get autoclean --yes && \
Expand Down

0 comments on commit ce19d6d

Please sign in to comment.