This commit is contained in:
parent
72af48d017
commit
ed99be0c84
10
run.sh
10
run.sh
@ -30,18 +30,18 @@ TMPDIR=$( mktemp -d )
|
|||||||
UPLOADDIRNAME=$( head /dev/urandom | tr -dc A-Za-z0-9 | head -c 16 )
|
UPLOADDIRNAME=$( head /dev/urandom | tr -dc A-Za-z0-9 | head -c 16 )
|
||||||
NETRC=$( mktemp )
|
NETRC=$( mktemp )
|
||||||
|
|
||||||
if [ -z "${HTTP_USER}" || -z "${HTTP_PASS}" ] ; then
|
if [ -z "${HTTP_USER}" ] || [ -z "${HTTP_PASS}" ] ; then
|
||||||
AUTH=""
|
AUTH=""
|
||||||
else
|
else
|
||||||
HOST=$(echo "$API_URL" | sed -E 's/^https?\:\/\/(.*)\/.*/\1/g' )
|
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}"
|
AUTH="--netrc-file ${NETRC}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# maybe do this better, it can lead to unwanted word splitting
|
# 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}"
|
cd "${TMPDIR}" || exit
|
||||||
for file in *.deb ; do
|
for file in *.deb ; do
|
||||||
echo "uploading '$file' to remote directory '${UPLOADDIRNAME}'"
|
echo "uploading '$file' to remote directory '${UPLOADDIRNAME}'"
|
||||||
curl ${AUTH} -X POST -F "file=@${file}" "${API_URL}/files/${UPLOADDIRNAME}"
|
curl ${AUTH} -X POST -F "file=@${file}" "${API_URL}/files/${UPLOADDIRNAME}"
|
||||||
@ -50,8 +50,8 @@ done
|
|||||||
echo "Adding files to ${REPO}"
|
echo "Adding files to ${REPO}"
|
||||||
curl ${AUTH} -X POST "${API_URL}/repos/${REPO}/file/${UPLOADDIRNAME}"
|
curl ${AUTH} -X POST "${API_URL}/repos/${REPO}/file/${UPLOADDIRNAME}"
|
||||||
|
|
||||||
if [ ! -z "${PASSPHRASE}" ] ; then
|
if [ -n "${PASSPHRASE}" ] ; then
|
||||||
echo "Signing and publishing ${REPO}"
|
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
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user