Skip to content

Instantly share code, notes, and snippets.

@u8sand
Last active August 6, 2022 15:52
Show Gist options
  • Save u8sand/704ae0b0fe2312ab92869139d6ecda3a to your computer and use it in GitHub Desktop.
Save u8sand/704ae0b0fe2312ab92869139d6ecda3a to your computer and use it in GitHub Desktop.
A simple script for serving one store with all rclone remotes as directories. I use this as a daemon which can be accessed with dolphin :)
#!/bin/bash
# `rclone serve -h` for other remotes / arguments
PROTOCOL="webdav"
ARGS="--vfs-cache-mode writes"
# we construct an inline combined upstream with all remotes using the remote name as the directory
rclone listremotes \
| awk -F':' -v ARGS="${ARGS}" -v PROTOCOL="${PROTOCOL}" "
BEGIN {
printf \"rclone serve \"ARGS\" \"PROTOCOL\" ':combine,upstreams=\\\"\"
} {
printf \" \"\$1\"=\"\$0
}
END {
printf \"\\\":'\"
}" \
| sh -
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment