Skip to content

Instantly share code, notes, and snippets.

@jrarseneau
Last active August 26, 2019 19:03
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jrarseneau/5884de1fe2b839252c288c87abc2f5b2 to your computer and use it in GitHub Desktop.
Save jrarseneau/5884de1fe2b839252c288c87abc2f5b2 to your computer and use it in GitHub Desktop.
#!/bin/bash
/usr/bin/screen -dmS local2acd /usr/bin/rclone move --verbose ~/.media/local/ acdeMedia: --transfers 50 --no-traverse --exclude="/.unionfs-fuse/**"
#!/bin/bash
# mountpoint for unified local+cloud view
UNION="~/media"
# additional unionfs options;
UNIONFS_OPTIONS="-o statfs_omit_ro -o allow_other -o uid=1000,gid=1001"
# rclone additional options;
RCLONE_OPTIONS="--verbose --allow-other --max-read-ahead 10G --read-only --log-file ~/.rclone.acd.log"
# path to exiting local media
LOCALDIR="~/.media/local"
# mountpoint for rclone
RCLONE_DECRYPTED="~/.media/acd-decrypted"
# whatever you configured your rclone remote to
RCLONE_REMOTE="acdeMedia:"
# any valid directory that appears only when rclone is mounted
RCLONE_DECRYPTED_CHECKPATH="$RCLONE_DECRYPTED/tvshows"
######## NOW TO BUSINESS
# use `screen -r acd` if you ever need to see what's going on; use ^A D to detach cleanly
screen -dmS acd rclone mount "$RCLONE_REMOTE" "$RCLONE_DECRYPTED" $RCLONE_OPTIONS
echo -n 'waiting for rclone to mount...'
while ! [ -d $RCLONE_DECRYPTED_CHECKPATH ];
do
echo -n "."
sleep 1
done
echo -n " done"; echo
# Mount UnionFS mount point.
echo "mounting unionfs"
unionfs-fuse $UNIONFS_OPTIONS -o cow "$LOCALDIR=rw:$RCLONE_DECRYPTED=ro" "$UNION"
#!/bin/bash
# mountpoint for unified local+cloud view
UNION="~/media"
RCLONE_DECRYPTED="~/.media/acd-decrypted"
# unmount unionfs first
fusermount -uz "$UNION"
# kill rclone before unmounting
screen -S acd -X quit
fusermount -uz "$RCLONE_DECRYPTED"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment