binhex / arch-rclone

Docker build script for Arch Linux base with rclone
GNU General Public License v3.0
9 stars 4 forks source link

Add a bucket parameter #3

Closed mertzjames closed 3 years ago

mertzjames commented 3 years ago

It would be nice to use this for backblaze b2 uploads which require assigning a bucket. The syntax for this would be remote:bucket/path/to/backup. Having an env variable BUCKET could be used to add this to the remote syntax. For example:

function set_run_sync_flags(){

    if [[ "${RCLONE_DIRECTION}" == 'localtoremote' || "${RCLONE_DIRECTION}" == 'both' ]]; then

        if [[ "${ENABLE_WEBUI}" == 'yes' ]]; then

            sync_direction="srcFs=${rclone_media_shares_item} dstFs=${rclone_remote_name_item}:${RCLONE_BUCKET}${rclone_media_shares_item}"

        else

            sync_direction="${rclone_media_shares_item} ${rclone_remote_name_item}:${RCLONE_BUCKET}${rclone_media_shares_item}"

        fi

        echo "[info] Running rclone ${RCLONE_OPERATION} for local media share '${rclone_media_shares_item}' to remote '${rclone_remote_name_item}'..."
        run_rclone
        echo "[info] rclone ${RCLONE_OPERATION} finished"

    fi
binhex commented 3 years ago

i think its easier than that, i simply need to exclude the bucket name from the media share when testing whether the media share exists, im assuming you were getting tripped up with error message in supervisord.log file:- [warn] Media share 'mybucket/media/foo' does not exist, skipping

if that is correct then simply stripping off the bucket will allow the test to pass and then rclone can execute with the bucket and media share name right?.

mertzjames commented 3 years ago

shoot. Just saw this. I'm new to unraid, do you have a write up of how to pull down that image?

binhex commented 3 years ago

change of plan on this, the bucket now needs to be defined as a suffix to the remote name, using a : to differentiate between remote name and bucket, e.g.:-

RCLONE_REMOTE_NAME=myremotename:mybucketname

to have a play with this see Q5, setting the tag name to test:- https://github.com/binhex/documentation/blob/master/docker/faq/unraid.md

binhex commented 3 years ago

@mertzjames did you manage to test the image and if so did it work as expected?

binhex commented 3 years ago

Created new image tagged as latest, assuming this is working as intended, closing.