enhance(scripts): Add support for CURL_ADDITIONAL_OPTIONS in aptly_api functions

This commit is contained in:
agnostic-apollo 2022-06-18 17:39:12 +05:00
parent 5163365609
commit 3b76d37dce
1 changed files with 7 additions and 4 deletions

View File

@ -11,6 +11,9 @@ CURL_COMMON_OPTIONS=(
--write-out "|%{http_code}"
--resolve "packages.termux.dev:443:216.18.208.170"
)
CURL_ADDITIONAL_OPTIONS=()
# Function for deleting temporary directory with uploaded files from
# the server.
aptly_delete_dir() {
@ -18,7 +21,7 @@ aptly_delete_dir() {
curl_response=$(
curl \
"${CURL_COMMON_OPTIONS[@]}" \
"${CURL_COMMON_OPTIONS[@]}" "${CURL_ADDITIONAL_OPTIONS[@]}" \
--request DELETE \
${REPOSITORY_URL}/files/${REPOSITORY_NAME}-${GITHUB_SHA}
)
@ -33,7 +36,7 @@ aptly_delete_dir() {
aptly_upload_file() {
local filename="$1"
curl_response=$(curl \
"${CURL_COMMON_OPTIONS[@]}" \
"${CURL_COMMON_OPTIONS[@]}" "${CURL_ADDITIONAL_OPTIONS[@]}" \
--request POST \
--form file=@${filename} \
${REPOSITORY_URL}/files/${REPOSITORY_NAME}-${GITHUB_SHA} || true
@ -62,7 +65,7 @@ aptly_add_to_repo() {
echo "[$(date +%H:%M:%S)] Adding packages to repository '$REPOSITORY_NAME'..."
curl_response=$(
curl \
"${CURL_COMMON_OPTIONS[@]}" \
"${CURL_COMMON_OPTIONS[@]}" "${CURL_ADDITIONAL_OPTIONS[@]}" \
--max-time 300 \
--request POST \
${REPOSITORY_URL}/repos/${REPOSITORY_NAME}/file/${REPOSITORY_NAME}-${GITHUB_SHA} || true
@ -95,7 +98,7 @@ aptly_publish_repo() {
echo "[$(date +%H:%M:%S)] Publishing repository changes..."
curl_response=$(
curl \
"${CURL_COMMON_OPTIONS[@]}" \
"${CURL_COMMON_OPTIONS[@]}" "${CURL_ADDITIONAL_OPTIONS[@]}" \
--max-time 300 \
--header 'Content-Type: application/json' \
--request PUT \