bugfix: __consul fails if consul is already running #633

This commit is contained in:
Darko Poljak 2018-02-25 09:51:51 +01:00
parent 7cbdc55a8c
commit b870b6e43a
1 changed files with 5 additions and 3 deletions

View File

@ -44,15 +44,17 @@ cksum_should=$(cat "$version_dir/cksum" | cut -d' ' -f1,2)
cat << eof
tmpdir=\$(mktemp -d --tmpdir="/tmp" "${__type##*/}.XXXXXXXXXX")
curl -s -L "$source" > "\$tmpdir/$source_file_name"
unzip -p "\$tmpdir/$source_file_name" > "$destination"
unzip -p "\$tmpdir/$source_file_name" > "${destination}.tmp"
rm -rf "\$tmpdir"
cksum_is=\$(cksum "$destination" | cut -d' ' -f1,2)
cksum_is=\$(cksum "${destination}.tmp" | cut -d' ' -f1,2)
if [ "\$cksum_is" = "$cksum_should" ]; then
rm -f "${destination}"
mv "${destination}.tmp" "${destination}"
chown root:root "$destination"
chmod 755 "$destination"
else
rm -f "$destination"
rm -f "${destination}.tmp"
echo "Failed to verify checksum for $__object_name" >&2
exit 1
fi