Skip to content

Commit

Permalink
Merge pull request #3142 from thomasjacquin/Make-upload.sh-easier-to-…
Browse files Browse the repository at this point in the history
…read

Update upload.sh: Add blank lines to make easier to read
  • Loading branch information
EricClaeys authored Nov 20, 2023
2 parents 76aac9c + 0f90d23 commit c9db4c7
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions scripts/upload.sh
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ if [[ ${PROTOCOL} == "s3" ]] ; then
AWS_CLI_DIR="$( settings ".${PREFIX}_AWS_CLI_DIR" "${ALLSKY_ENV}" )"
S3_BUCKET="$( settings ".${PREFIX}_S3_BUCKET" "${ALLSKY_ENV}" )"
S3_ACL="$( settings ".${PREFIX}_S3_ACL" "${ALLSKY_ENV}" )"

DEST="s3://${S3_BUCKET}${DIRECTORY}/${DESTINATION_NAME}"
if [[ ${SILENT} == "false" && ${ALLSKY_DEBUG_LEVEL} -ge 3 ]]; then
echo "${ME}: Uploading ${FILE_TO_UPLOAD} to ${DEST}"
Expand All @@ -206,6 +207,7 @@ elif [[ "${PROTOCOL}" == "scp" ]] ; then
REMOTE_HOST="$( settings ".${PREFIX}_HOST" "${ALLSKY_ENV}" )"
REMOTE_PORT="$( settings ".${PREFIX}_PORT" "${ALLSKY_ENV}" )"
SSH_KEY_FILE="$( settings ".${PREFIX}_SSH_KEY_FILE" "${ALLSKY_ENV}" )"

DEST="${REMOTE_USER}@${REMOTE_HOST}:${DIRECTORY}/${DESTINATION_NAME}"
if [[ ${SILENT} == "false" && ${ALLSKY_DEBUG_LEVEL} -ge 3 ]]; then
echo "${ME}: Copying ${FILE_TO_UPLOAD} to ${DEST}"
Expand All @@ -219,9 +221,8 @@ elif [[ "${PROTOCOL}" == "scp" ]] ; then
elif [[ ${PROTOCOL} == "gcs" ]] ; then
GCS_BUCKET="$( settings ".${PREFIX}_GCS_BUCKET" "${ALLSKY_ENV}" )"
GCS_ACL="$( settings ".${PREFIX}_GCS_ACL" "${ALLSKY_ENV}" )"
type gsutil >/dev/null 2>&1
RET=$?
if [[ ${RET} -eq 0 ]]; then

if type gsutil >/dev/null 2>&1 ; then
DEST="gs://${GCS_BUCKET}${DIRECTORY}/${DESTINATION_NAME}"
if [[ ${SILENT} == "false" && ${ALLSKY_DEBUG_LEVEL} -ge 3 ]]; then
echo "${ME}: Uploading ${FILE_TO_UPLOAD} to ${DEST}"
Expand All @@ -233,6 +234,7 @@ elif [[ ${PROTOCOL} == "gcs" ]] ; then
OUTPUT="${OUTPUT}\nIt should be in one of these directories: $PATH"
"${ALLSKY_SCRIPTS}/addMessage.sh" "error" "${OUTPUT}"
OUTPUT="${RED}*** ${OUTPUT}${NC}"
RET=1
fi


Expand Down Expand Up @@ -301,7 +303,7 @@ else # sftp/ftp/ftps
PW="--env-password"
fi

(
{
LFTP_COMMANDS="$( settings ".${PREFIX}_LFTP_COMMANDS" "${ALLSKY_ENV}" )"
[[ -n ${LFTP_COMMANDS} ]] && echo "${LFTP_COMMANDS}"

Expand Down Expand Up @@ -362,7 +364,7 @@ else # sftp/ftp/ftps
|| exit 4"

echo exit 0
) > "${LFTP_CMDS}"
} > "${LFTP_CMDS}"
if [[ $? -ne 0 ]]; then
echo -e "${RED}"
echo -e "*** ERROR: Unable to create '${LFTP_CMDS}'."
Expand Down

0 comments on commit c9db4c7

Please sign in to comment.