Merge pull request #44 from jasonsyoung/master

Adding SUBPATH support
This commit is contained in:
Geofferey Eakins 2021-01-11 01:05:30 -08:00 committed by GitHub
commit c69eb3c2db
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 2 deletions

View file

@ -102,6 +102,8 @@ Specification of rclone parameters on a per remote basis can be created inside h
PROFILE=0
SUBPATH= ( root directory of share )
**NOTE:** _The above are defaults for all remotes without `.*.param` files containing opposing values.
- Custom remote params example #1
@ -118,6 +120,18 @@ Specification of rclone parameters on a per remote basis can be created inside h
**NOTE:** _There is no need to specify values you do not wish to change. Ensure a line break/carriage return exist after each specified param or they will not be parsed. For more information see [issue #2](https://github.com/Magisk-Modules-Repo/com.piyushgarg.rclone/issues/2)_
- Custom remote params example #2 (using SUBPATH)
_The following configuration will mount the remote subdirectory `Batman` as the root directory of the share `[Movies]`._
/sdcard/.rclone/.Movies.param
1| SDBINDPOINT=BatmanMovie
2| SUBPATH=Batman
3|
Now the mounted directory `/sdcard/BatmanMovie` is actually the remote directory `Movies/Batman`.
---
## Custom Globals

View file

@ -127,7 +127,7 @@ custom_params () {
else
PARAMS="DISABLE LOGFILE LOGLEVEL CACHEMODE CHUNKSIZE CHUNKTOTAL CACHEWORKERS CACHEINFOAGE DIRCACHETIME ATTRTIMEOUT BUFFERSIZE READAHEAD M_UID M_GID DIRPERMS FILEPERMS READONLY BINDSD SDBINDPOINT ADD_PARAMS REPLACE_PARAMS PROFILE ISOLATE SDSYNCDIRS SYNC_WIFI SYNC_BATTLVL SYNC_CHARGE"
PARAMS="DISABLE LOGFILE LOGLEVEL CACHEMODE CHUNKSIZE CHUNKTOTAL CACHEWORKERS CACHEINFOAGE DIRCACHETIME ATTRTIMEOUT BUFFERSIZE READAHEAD M_UID M_GID DIRPERMS FILEPERMS READONLY BINDSD SDBINDPOINT ADD_PARAMS REPLACE_PARAMS PROFILE ISOLATE SDSYNCDIRS SYNC_WIFI SYNC_BATTLVL SYNC_CHARGE SUBPATH"
fi
BAD_SYNTAX="(^\s*#|^\s*$|^\s*[a-z_][^[:space:]]*=[^;&\(\`]*$)"
@ -140,6 +140,7 @@ custom_params () {
echo "loading .${remote}.param"
# FIX: Unnecessary and very inefficient double loop
for PARAM in ${PARAMS[@]}; do
while read -r VAR; do
@ -150,6 +151,8 @@ custom_params () {
VALUE=\"${VALUE}\"
# Unnecessary echo in a subshell execution below? Why not just:
# eval "${PARAM}""=""${VALUE}"
eval $(echo "${PARAM}""=""${VALUE}")
fi
@ -353,6 +356,7 @@ reset_params () {
unset SYNCDIR
unset SDSYNCDIRS
unset PIDFILE
unset SUBPATH
LOGFILE=${USER_CONFDIR}/rclone.log
LOGLEVEL=NOTICE
CACHEMODE=off
@ -426,7 +430,7 @@ rclone_mount () {
mkdir -p ${CLOUDROOTMOUNTPOINT}/${remote}
su -M -p -c nice -n 19 ionice -c 2 -n 7 ${HOME}/rclone mount ${remote}: ${CLOUDROOTMOUNTPOINT}/${remote} --config ${CONFIGFILE} ${RCLONE_PARAMS} --daemon >> /dev/null 2>&1 &
su -M -p -c nice -n 19 ionice -c 2 -n 7 ${HOME}/rclone mount "${remote}:${SUBPATH}" ${CLOUDROOTMOUNTPOINT}/${remote} --config ${CONFIGFILE} ${RCLONE_PARAMS} --daemon >> /dev/null 2>&1 &
}