diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2020-07-13 13:32:44 -0400 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2020-07-13 13:32:44 -0400 |
commit | a2586e952bb9e5e70a2d62c55337574d7086b9a0 (patch) | |
tree | 4317e729c6ceca8a9a65d7ba68f69f2ada0619b2 /interface.d | |
parent | b8a0d1285c8263bfd94ddc0715b585ce0e1f5cd1 (diff) | |
download | nexus_bash-master.tar.gz |
Diffstat (limited to 'interface.d')
-rw-r--r-- | interface.d/nexus_raw.sh | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/interface.d/nexus_raw.sh b/interface.d/nexus_raw.sh index 5d6a559..c0448c1 100644 --- a/interface.d/nexus_raw.sh +++ b/interface.d/nexus_raw.sh @@ -35,6 +35,7 @@ nexus_raw_download() { local url local filename local dest + local retval url="${NEXUS_URL}/$1" if [[ -z $url ]]; then @@ -55,9 +56,20 @@ nexus_raw_download() { mkdir -p "${dest}" fi - if ! curl -L "$url" > "${dest}/${filename}"; then - echo "Could not download data" >&2 - return 1 + if (( NEXUS_BASH_VERBOSE )); then + /bin/echo -n "Fetching '$url' => '$dest' ... " >&2 + fi + + if ! curl -s -L "$url" > "${dest}/${filename}"; then + retval=$? + if (( NEXUS_BATH_VERBOSE )); then + echo "failed ($retval)" >&2 + fi + return $retval + fi + + if (( NEXUS_BASH_VERBOSE )); then + echo "done" >&2 fi echo "$dest/$filename" @@ -81,11 +93,12 @@ nexus_raw_upload() { fi if (( NEXUS_BASH_VERBOSE )); then - /bin/echo -n "Uploading '$filename' => '${2}'... " + /bin/echo -n "Uploading '$filename' => '${2}' ... " fi + if ! curl -s --user "${NEXUS_AUTH}" --upload-file "${filename}" "${url}/${filename}"; then if (( NEXUS_BASH_VERBOSE )); then - echo "Failed" >&2 + echo "failed" >&2 fi return 1 fi |