Last active
March 21, 2019 16:00
-
-
Save kernel-sanders/61be0a92dce20116abc5 to your computer and use it in GitHub Desktop.
ACD UnionFS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mkdir -p \ | |
$HOME/.cache/Amazon-Cloud-Drive/local.encrypted \ | |
$HOME/.cache/Amazon-Cloud-Drive/local.plaintext \ | |
$HOME/.cache/Amazon-Cloud-Drive/cloud.encrypted \ | |
$HOME/.cache/Amazon-Cloud-Drive/cloud.plaintext | |
ENCFS6_CONFIG=$HOME/.cache/encfs6.xml encfs -o allow_other $HOME/.cache/Amazon-Cloud-Drive/local.encrypted $HOME/.cache/Amazon-Cloud-Drive/local.plaintext | |
acd_cli mount --modules="subdir,subdir=/Encrypted" $HOME/.cache/Amazon-Cloud-Drive/cloud.encrypted | |
ENCFS6_CONFIG=$HOME/.cache/encfs6.xml encfs -o allow_other $HOME/.cache/Amazon-Cloud-Drive/cloud.encrypted $HOME/.cache/Amazon-Cloud-Drive/cloud.plaintext | |
unionfs-fuse -o cow $HOME/.cache/Amazon-Cloud-Drive/local.plaintext=RW:$HOME/.cache/Amazon-Cloud-Drive/cloud.plaintext=RO:/RAID=RO $HOME/Cloud | |
acd_cli sync | |
acd_cli upload -x 8 --exclude-ending encfs6.xml $HOME/.cache/Amazon-Cloud-Drive/local.encrypted/* /Encrypted/ | |
sudo fusermount -u $HOME/Cloud/ | |
sudo fusermount -u $HOME/.cache/Amazon-Cloud-Drive/cloud.plaintext | |
sudo fusermount -u $HOME/.cache/Amazon-Cloud-Drive/cloud.encrypted | |
sudo fusermount -u $HOME/.cache/Amazon-Cloud-Drive/local.plaintext | |
#=================== | |
# as root | |
mkdir -p \ | |
/mnt/acd \ | |
/mnt/.RAID \ | |
/mnt/acd-RAID | |
acd_cli mount --modules="subdir,subdir=/RAID" /mnt/acd/ | |
# first run only | |
encfs --reverse /RAID /mnt/.RAID | |
mv /RAID/.encfs6.xml $HOME/.cache/encfs6.xml | |
fusermount -u /mnt/.RAID | |
mkdir $HOME/backup-scripts | |
echo "PASSWORD_HERE" > $HOME/backup-scripts/enc-passwd | |
chmod 500 $HOME/backup-scripts/enc-passwd | |
# End first run only section | |
ENCFS6_CONFIG=$HOME/.cache/encfs6.xml encfs --reverse /RAID /mnt/.RAID | |
cat $HOME/backup-scripts/enc-passwd | ENCFS6_CONFIG=$HOME/.cache/encfs6.xml encfs -S --reverse /RAID /mnt/.RAID | |
cat $HOME/backup-scripts/enc-passwd | ENCFS6_CONFIG=$HOME/.cache/encfs6.xml encfs -S /mnt/acd/ /mnt/acd-RAID | |
# now run the backup script | |
#======================== | |
#!/bin/bash | |
# This script will upload all files in $local_location to Amazon Cloud Drive using acd_cli to $remote_location | |
# It will skip already uploaded files by comparing hashes | |
# Original https://github.com/dcplaya/acd_cli-BackupScripts/blob/master/Movies_Upload.sh from David Carpenter | |
# Updated for python3.4 | |
#Set to true if you want to run acd_cli with verbose | |
verbose=true | |
#Set local location of files to upload. Everything in this folder will be uploaded but no the folder itself | |
local_location=/mnt/.RAID/ | |
#Set remote location on ACD | |
remote_location=/RAID | |
#Set location of where to store log file as well as the name | |
log_location=/root/backup-scripts/RAID-upload.log | |
# Start of actual code! | |
################################################################################################################################################ | |
#Sync to make sure we have the most up to date file structure | |
acd_sync | |
if [ "$verbose" == true ] | |
then | |
echo "Verbose enabled!" | |
acd_cli -v sync # Syncs with ACD before uploading to make sure we have the most up to date info | |
acd_cli -v upload -xp /mnt/.RAID/dz4djkzUsxPYv-Jq5C3UDkGK -x 8 "$local_location"* "$remote_location" 2> >(tee "$log_location" >&2) # Starts uploading with the locations set at the top of this script | |
else | |
acd_cli -v sync # Syncs with ACD before uploading to make sure we have the most up to date info | |
acd_cli -v upload -xp /mnt/.RAID/dz4djkzUsxPYv-Jq5C3UDkGK -x 8 "$local_location"* "$remote_location" # Starts uploading with the locations set at the top of this script | |
fi | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Cool script, very useful and a nice example of how to properly mount acd into an existing filesystem!
But I wonder, where does the folder
/RAID
come from? I don't have this folder on my system and don't see why I would need that for the rest to work.Also this line
acd_cli upload -x 8 --exclude-ending encfs6.xml $HOME/.cache/Amazon-Cloud-Drive/local.encrypted/* /Encrypted/
is giving me[ERROR] [acd_cli] - Path "/home/pi/.cache/Amazon-Cloud-Drive/local.encrypted/*" does not exist.
.