From ed99be0c848df6e1c25c0fe5a108c4641fc10de3 Mon Sep 17 00:00:00 2001 From: Paolo Asperti Date: Tue, 19 Jul 2022 12:04:13 +0200 Subject: [PATCH] added force signing --- run.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/run.sh b/run.sh index 61164e3..818138c 100755 --- a/run.sh +++ b/run.sh @@ -30,19 +30,19 @@ TMPDIR=$( mktemp -d ) UPLOADDIRNAME=$( head /dev/urandom | tr -dc A-Za-z0-9 | head -c 16 ) NETRC=$( mktemp ) -if [ -z "${HTTP_USER}" || -z "${HTTP_PASS}" ] ; then +if [ -z "${HTTP_USER}" ] || [ -z "${HTTP_PASS}" ] ; then AUTH="" else HOST=$(echo "$API_URL" | sed -E 's/^https?\:\/\/(.*)\/.*/\1/g' ) - echo "machine ${HOST} login ${HTTP_USER} password ${HTTP_PASS}" > $NETRC + echo "machine ${HOST} login ${HTTP_USER} password ${HTTP_PASS}" > "$NETRC" AUTH="--netrc-file ${NETRC}" fi # maybe do this better, it can lead to unwanted word splitting -cp -r $( echo "${FILES}" | sed 's/\([^\\]\)\,/\1 /g' ) "${TMPDIR}/" +cp -r $( echo "${FILES}" | sed 's/\([^\\]\)\,/\1 /g' ) "${TMPDIR}/" -cd "${TMPDIR}" -for file in *.deb ; do +cd "${TMPDIR}" || exit +for file in *.deb ; do echo "uploading '$file' to remote directory '${UPLOADDIRNAME}'" curl ${AUTH} -X POST -F "file=@${file}" "${API_URL}/files/${UPLOADDIRNAME}" done @@ -50,8 +50,8 @@ done echo "Adding files to ${REPO}" curl ${AUTH} -X POST "${API_URL}/repos/${REPO}/file/${UPLOADDIRNAME}" -if [ ! -z "${PASSPHRASE}" ] ; then +if [ -n "${PASSPHRASE}" ] ; then echo "Signing and publishing ${REPO}" - curl ${AUTH} -X PUT -H 'Content-Type: application/json' --data "{\"Signing\": {\"Passphrase\": \"${PASSPHRASE}\", \"Batch\":true}}" "${API_URL}/publish/:./${DISTRIBUTION}" + curl ${AUTH} -X PUT -H 'Content-Type: application/json' --data "{\"Signing\": {\"Passphrase\": \"${PASSPHRASE}\", \"Batch\":true}, \"ForceOverwrite\": true}" "${API_URL}/publish/:./${DISTRIBUTION}" fi