From 455f98e85deb58093c38cc869edca7273dd78bd7 Mon Sep 17 00:00:00 2001 From: Date: Tue, 1 Aug 2017 21:25:42 +0200 Subject: [PATCH] Upgraded to Plexdrive 5.0.0 without mongodb --- README.md | 28 ++++++++++++---------------- config | 9 ++------- scripts/mount.remote | 13 +++++-------- setup.sh | 16 ++++++---------- 4 files changed, 25 insertions(+), 41 deletions(-) diff --git a/README.md b/README.md index b7e0dfe..161336d 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ These scripts are created to have your media synced between your cloud- and local store. All media is always encrypted before being uploaded. This also means if you loose your encryption keys you can't read your media. -**Plexdrive version 4.0.0 and Rclone version 1.36 is used.** +**Plexdrive version 5.0.0 and Rclone version 1.36 is used.** There is a setup file, `setup.sh`, to install the necessary stuff automatically. This has only been tested on Ubuntu 16.04+. @@ -36,19 +36,17 @@ _Good idea to backup your Rclone configuration and Plexdrive configuration and c ### Manually To install the necessary stuff manually do the following: -1. Install unionfs-fuse. -2. Install bc. -3. Install GNU screen. -4. Install [Rclone 1.36](https://downloads.rclone.org/rclone-current-linux-amd64.zip). -5. Install [Plexdrive 4.0.0](https://github.com/dweidenfeld/plexdrive/releases/download/4.0.0/plexdrive-linux-amd64). -6. Create the folders pointing, in the config file, to `local_decrypt_dir` and `plexdrive_temp_dir`. -7. Run rclone bin, installed in step 4, with the parameter `--config=RCLONE_CFG config` where `RCLONE_CFG` is the variable set in the config file. -8. Set up Google Drive remote, Crypt for Google Drive remove (rclone_cloud_endpoint) and crypt for local directory (rclone_local_endpoint). -9. Run plexdrive bin, installed in step 5, with the parameters `--config=PLEXDRIVE_DIR --mongo-database=MONGO_DATABASE --mongo-host=MONGO_HOST --mongo-user=MONGO_USER --mongo-password=MONGO_PASSWORD`. Remember to match the parameters with the variables in the config file. -10. Enter authorization to your Google Drive. -11. Cancel Plexdrive by pressing CTRL+C. -Run PlexDrive with GNU screen: `screen -dmS plexdrive PLEXDRIVE_BIN --config=PLEXDRIVE_DIR --mongo-database=MONGO_DATABASE --mongo-host=MONGO_HOST --mongo-user=MONGO_USER --mongo-password=MONGO_PASSWORD PLEXDRIVE_OPTIONS CLOUD_ENCRYPT_DIR`. -12. Exit screen session by pressing CTRL+A then D. +1. Install unionfs-fuse, bc, GNU screen. +2. Install [Rclone 1.36](https://github.com/ncw/rclone/releases/download/v1.36/rclone-v1.36-linux-amd64.zip). +3. Install [Plexdrive 5.0.0](https://github.com/dweidenfeld/plexdrive/releases/download/5.0.0/plexdrive-linux-amd64). +4. Create the folders pointing, in the config file, to `local_decrypt_dir` and `plexdrive_temp_dir`. +5. Run rclone bin, installed in step 4, with the parameter `--config=RCLONE_CFG config` where `RCLONE_CFG` is the variable set in the config file. +6. Set up Google Drive remote, Crypt for Google Drive remove (rclone_cloud_endpoint) and crypt for local directory (rclone_local_endpoint). +7. Run plexdrive bin, installed in step 5, with the parameters `mount --config=PLEXDRIVE_DIR --cache-file=${plexdrive_cache_file}`. Remember to match the parameters with the variables in the config file. +8. Enter authorization to your Google Drive. +9. Cancel Plexdrive by pressing CTRL+C. +Run PlexDrive with GNU screen: `screen -dmS plexdrive PLEXDRIVE_BIN mount --config=PLEXDRIVE_DIR --cache-file=${plexdrive_cache_file} CLOUD_ENCRYPT_DIR`. +10. Exit screen session by pressing CTRL+A then D. ## Cron My suggestions for cronjobs is in the file `cron`. @@ -88,8 +86,6 @@ Keep in mind that if it is written and read from `local_decrypt_dir` it will soo ## Plexdrive Plexdrive is used to mount Google Drive to a local folder (`cloud_encrypt_dir`). -Plexdrive version 4.0.0 requires a running MongoDB server. This is not included in the scripts but can either be installed from .deb packages or in a Docker container. - Plexdrive create two files: `config.json` and `token.json`. This is used to get access to Google Drive. These can either be set up via Plexdrive or by using the templates located in the [plexdrive directory](plexdrive/) (copy the files, name them `config.json` and `token.json` and insert your Google API details). ## Rclone diff --git a/config b/config index 89a7ad0..cee7602 100644 --- a/config +++ b/config @@ -30,13 +30,8 @@ ufs_options="-o cow,allow_other,direct_io,nonempty,auto_cache,sync_read" plexdrive_dir="${media_dir}/plexdrive" plexdrive_bin="${plexdrive_dir}/plexdrive-linux-amd64" -mongo_database="plexdrive" -mongo_host="localhost" -mongo_user="" -mongo_password="" - -plexdrive_temp_dir="${media_dir}/.local-decrypt/plexdrive" -plexdrive_options="--temp=${plexdrive_temp_dir} -o allow_other --clear-chunk-max-size=1000G --clear-chunk-age=24h --chunk-size=10M" +plexdrive_cache_file="${media_dir}/.local-decrypt/plexdrive/cache.bolt" +plexdrive_options="--cache-file=${plexdrive_cache_file} -o allow_other --clear-chunk-max-size=1000G --clear-chunk-age=24h --chunk-size=10M" ############################################################################### diff --git a/scripts/mount.remote b/scripts/mount.remote index 9f664fd..6601418 100644 --- a/scripts/mount.remote +++ b/scripts/mount.remote @@ -20,20 +20,17 @@ mount_gdrive () { mkdir -p "${cloud_encrypt_dir}" fi - # Make sure Plexdrive temp folder exists. - if [ ! -d "${plexdrive_temp_dir}" ]; then - mkdir -p "${plexdrive_temp_dir}" - fi - mongo="--mongo-database=${mongo_database} --mongo-host=${mongo_host}" - if [ ! -z "${mongo_user}" -a "${mongo_user}" != " " ]; then - mongo="${mongo} --mongo-user=${mongo_user} --mongo-password=${mongo_password}" + # Make sure Plexdrive cache folder exists. + plexdrive_cache_dir=$(dirname plexdrive_cache_file) + if [ ! -d "${plexdrive_cache_dir}" ]; then + mkdir -p "${dirname plexdrive_cache_dir}" fi # Mount GD if not already mounted. if ! mountpoint -q "$cloud_encrypt_dir" ; then echo "[ $(date ${date_format}) ] Mounting Google Drive mountpoint: ${cloud_encrypt_dir}" - screen -dmS plexdrive "$plexdrive_bin" --config="${plexdrive_dir}" $mongo $plexdrive_options "${cloud_encrypt_dir}" + screen -dmS plexdrive "$plexdrive_bin" mount --config="${plexdrive_dir}" $plexdrive_options "${cloud_encrypt_dir}" else echo "[ $(date ${date_format}) ] Google Drive mountpoint: ${cloud_encrypt_dir} already mounted." fi diff --git a/setup.sh b/setup.sh index 6430747..4174802 100644 --- a/setup.sh +++ b/setup.sh @@ -10,7 +10,7 @@ _rclone_zip="rclone-v1.36-linux-amd64.zip" _rclone_dir="rclone-v1.36-linux-amd64" # Plexdrive -_plexdrive_url="https://github.com/dweidenfeld/plexdrive/releases/download/4.0.0/plexdrive-linux-amd64" +_plexdrive_url="https://github.com/dweidenfeld/plexdrive/releases/download/5.0.0/plexdrive-linux-amd64" _plexdrive_bin="plexdrive-linux-amd64" ################################### @@ -42,8 +42,9 @@ if [ ! -d "${local_decrypt_dir}" ]; then mkdir -p "${local_decrypt_dir}" fi -if [ ! -d "${plexdrive_temp_dir}" ]; then - mkdir -p "${plexdrive_temp_dir}" +plexdrive_cache_dir=$(dirname plexdrive_cache_file) +if [ ! -d "${plexdrive_cache_dir}" ]; then + mkdir -p "${dirname plexdrive_cache_dir}" fi @@ -59,15 +60,10 @@ echo "\t- Crypt for your local directory ('${cloud_encrypt_dir}') named '${rclon echo "\n\n-------- SETUP PLEXDRIVE --------\n" -mongo="--mongo-database=${mongo_database} --mongo-host=${mongo_host}" -if [ ! -z "${mongo_user}" -a "${mongo_user}" != " " ]; then - mongo="${mongo} --mongo-user=${mongo_user} --mongo-password=${mongo_password}" -fi - echo "1. Now run plexdrive with the command:" -echo "\t${plexdrive_bin} --config=${plexdrive_dir} ${mongo} ${cloud_encrypt_dir}" +echo "\t${plexdrive_bin} mount --config=${plexdrive_dir} ${plexdrive_options} ${cloud_encrypt_dir}" echo "2. Enter authorization" echo "3. Cancel plexdrive by pressing CTRL+C" echo "4. Run plexdrive with screen by running the following command:" -echo "\tscreen -dmS plexdrive ${plexdrive_bin} --config=${plexdrive_dir} ${mongo} ${plexdrive_options} ${cloud_encrypt_dir}" +echo "\tscreen -dmS plexdrive ${plexdrive_bin} mount --config=${plexdrive_dir} ${plexdrive_options} ${cloud_encrypt_dir}" echo "Exit screen session by pressing CTRL+A then D"