Updated to v1.14
Read CHANGELOG.md for details. Co-authored-by: Zackptg5 <5107713+Zackptg5@users.noreply.github.com>
This commit is contained in:
parent
c69eb3c2db
commit
2d61038266
42 changed files with 770 additions and 1273 deletions
86
CHANGELOG.md
Normal file
86
CHANGELOG.md
Normal file
|
@ -0,0 +1,86 @@
|
||||||
|
## Changelog (forked)
|
||||||
|
|
||||||
|
### v1.14
|
||||||
|
* Used @Zackptg5's MMT-EX module template.
|
||||||
|
* Cleaned all install & wrapper scripts.
|
||||||
|
* Fixed bugs related to `rclone` command not working (proper wrapper script placement).
|
||||||
|
* All the webservers (SFTP/FTP/HTTP) work fine now.
|
||||||
|
* Bring back x86 and x86_64 support.
|
||||||
|
* Updated all binaries (extracted from Termux builds).
|
||||||
|
- `libandroid-support` (28)
|
||||||
|
- `rclone` (1.55.0)
|
||||||
|
- `fusermount` (2.9.9)
|
||||||
|
- `inotifywait` (3.20.11.0)
|
||||||
|
|
||||||
|
## Changelog (source)
|
||||||
|
|
||||||
|
### v1.13
|
||||||
|
* Add arm/arm64 1.53 binaries downloaded from https://beta.rclone.org/v1.53.0/testbuilds/rclone-android-16-arm.gz
|
||||||
|
|
||||||
|
### v1.12
|
||||||
|
* Fixed restart problems.
|
||||||
|
|
||||||
|
### v1.11
|
||||||
|
* Add arm/arm64 1.52 bins downloaded from https://beta.rclone.org/v1.52.0/testbuilds/rclone-android-16-arm.gz
|
||||||
|
* Fixed service.sh paths
|
||||||
|
|
||||||
|
### v1.10
|
||||||
|
* fixed fusermount wrapper
|
||||||
|
|
||||||
|
### v1.9
|
||||||
|
* Add arm/arm64 1.51 bins downloaded from https://beta.rclone.org/
|
||||||
|
* Commented fusermount wrapper
|
||||||
|
|
||||||
|
### v1.8
|
||||||
|
* Support for Work Profiles `PROFILE=`
|
||||||
|
* Isolate to Work Profiles `ISOLATE=1`
|
||||||
|
* Support syncing from SD to remote
|
||||||
|
|
||||||
|
### v1.7
|
||||||
|
* Add ability to disable HTTP/FTP
|
||||||
|
* Link rest of default params to custom vars
|
||||||
|
* Exclude some custom params from globals
|
||||||
|
* Make some globals exclusive
|
||||||
|
* Change `BINDPOINT=` to `SDBINDPOINT=`
|
||||||
|
* Fix bug with custom params
|
||||||
|
* Set `PATH=` to change priority of used bins
|
||||||
|
|
||||||
|
### v1.6
|
||||||
|
* Simplify custom global parameters
|
||||||
|
* Fix & improve binding to SD
|
||||||
|
* Specify additional rclone ops with `ADD_PARAMS=`
|
||||||
|
* Replace `rclone mount` ops via `REPLACE_PARAMS=`
|
||||||
|
|
||||||
|
### v1.5
|
||||||
|
* Replace arm/arm64 `rclone` 1.48 bins built with Termux
|
||||||
|
* Replace arm/arm64 `fusermount` built with Termux
|
||||||
|
* Add arm/arm64 `libandroid-support.so` from Termux
|
||||||
|
* Support for mounting to SD
|
||||||
|
* Squash missing rclone.conf install bug
|
||||||
|
* Tune default parameters
|
||||||
|
* Include a wrap for `rclone config`
|
||||||
|
* Include `fusermount-wrapper.sh`
|
||||||
|
* General Improvements
|
||||||
|
|
||||||
|
### v1.4
|
||||||
|
* Add ability to disable a remote
|
||||||
|
* Add a wrapper script for rclone
|
||||||
|
* Access remotes via http & ftp
|
||||||
|
* Use without rebooting device
|
||||||
|
* Add wrapper cmds to `rclone help`
|
||||||
|
* Make remount possible via `su -M -c`
|
||||||
|
|
||||||
|
### v1.3
|
||||||
|
* Move user rclone.conf & related to `/sdcard/.rclone/`
|
||||||
|
* Control global `--vfs-cache-mode` via simple files placed in `/sdcard/.rclone/`
|
||||||
|
* Specify custom params for individual remotes via `/sdcard/.rclone/.REMOTENAME.params`
|
||||||
|
|
||||||
|
### v1.2
|
||||||
|
* Change install process
|
||||||
|
* Changes for full systemless
|
||||||
|
* Improve mount reliability
|
||||||
|
* Symlink mountpoint to `/storage/`
|
||||||
|
|
||||||
|
### v1.1
|
||||||
|
* Initial release
|
||||||
|
* rclone mount
|
|
@ -1,47 +1,79 @@
|
||||||
#!/sbin/sh
|
#!/sbin/sh
|
||||||
|
|
||||||
TMPDIR=/dev/tmp
|
#################
|
||||||
MOUNTPATH=/dev/magisk_img
|
# Initialization
|
||||||
|
#################
|
||||||
|
|
||||||
# Default permissions
|
|
||||||
umask 022
|
umask 022
|
||||||
|
|
||||||
# Initial cleanup
|
|
||||||
rm -rf $TMPDIR 2>/dev/null
|
|
||||||
mkdir -p $TMPDIR
|
|
||||||
|
|
||||||
# echo before loading util_functions
|
# echo before loading util_functions
|
||||||
ui_print() { echo "$1"; }
|
ui_print() { echo "$1"; }
|
||||||
|
|
||||||
require_new_magisk() {
|
require_new_magisk() {
|
||||||
ui_print "***********************************"
|
ui_print "*******************************"
|
||||||
ui_print " Please install the latest Magisk! "
|
ui_print " Please install Magisk v20.0+! "
|
||||||
ui_print "***********************************"
|
ui_print "*******************************"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
imageless_magisk() {
|
#########################
|
||||||
[ $MAGISK_VER_CODE -gt 18100 ]
|
# Load util_functions.sh
|
||||||
return $?
|
#########################
|
||||||
}
|
|
||||||
|
|
||||||
##########################################################################################
|
|
||||||
# Environment
|
|
||||||
##########################################################################################
|
|
||||||
|
|
||||||
OUTFD=$2
|
OUTFD=$2
|
||||||
ZIPFILE=$3
|
ZIPFILE=$3
|
||||||
|
|
||||||
mount /data 2>/dev/null
|
mount /data 2>/dev/null
|
||||||
|
|
||||||
# Load utility functions
|
[ -f /data/adb/magisk/util_functions.sh ] || require_new_magisk
|
||||||
if [ -f /data/adb/magisk/util_functions.sh ]; then
|
. /data/adb/magisk/util_functions.sh
|
||||||
. /data/adb/magisk/util_functions.sh
|
[ $MAGISK_VER_CODE -lt 20000 ] && require_new_magisk
|
||||||
NVBASE=/data/adb
|
|
||||||
else
|
if [ $MAGISK_VER_CODE -ge 20400 ]; then
|
||||||
require_new_magisk
|
# New Magisk have complete installation logic within util_functions.sh
|
||||||
|
install_module
|
||||||
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
#################
|
||||||
|
# Legacy Support
|
||||||
|
#################
|
||||||
|
|
||||||
|
TMPDIR=/dev/tmp
|
||||||
|
PERSISTDIR=/sbin/.magisk/mirror/persist
|
||||||
|
|
||||||
|
is_legacy_script() {
|
||||||
|
unzip -l "$ZIPFILE" install.sh | grep -q install.sh
|
||||||
|
return $?
|
||||||
|
}
|
||||||
|
|
||||||
|
print_modname() {
|
||||||
|
local authlen len namelen pounds
|
||||||
|
namelen=`echo -n $MODNAME | wc -c`
|
||||||
|
authlen=$((`echo -n $MODAUTH | wc -c` + 3))
|
||||||
|
[ $namelen -gt $authlen ] && len=$namelen || len=$authlen
|
||||||
|
len=$((len + 2))
|
||||||
|
pounds=$(printf "%${len}s" | tr ' ' '*')
|
||||||
|
ui_print ""
|
||||||
|
ui_print "$pounds"
|
||||||
|
ui_print " $MODNAME "
|
||||||
|
ui_print " by $MODAUTH "
|
||||||
|
ui_print "$pounds"
|
||||||
|
ui_print ""
|
||||||
|
}
|
||||||
|
|
||||||
|
# Override abort as old scripts have some issues
|
||||||
|
abort() {
|
||||||
|
ui_print "$1"
|
||||||
|
$BOOTMODE || recovery_cleanup
|
||||||
|
[ -n $MODPATH ] && rm -rf $MODPATH
|
||||||
|
rm -rf $TMPDIR
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
rm -rf $TMPDIR 2>/dev/null
|
||||||
|
mkdir -p $TMPDIR
|
||||||
|
|
||||||
# Preperation for flashable zips
|
# Preperation for flashable zips
|
||||||
setup_flashable
|
setup_flashable
|
||||||
|
|
||||||
|
@ -54,98 +86,110 @@ api_level_arch_detect
|
||||||
# Setup busybox and binaries
|
# Setup busybox and binaries
|
||||||
$BOOTMODE && boot_actions || recovery_actions
|
$BOOTMODE && boot_actions || recovery_actions
|
||||||
|
|
||||||
##########################################################################################
|
##############
|
||||||
# Preparation
|
# Preparation
|
||||||
##########################################################################################
|
##############
|
||||||
|
|
||||||
# Extract common files
|
# Extract prop file
|
||||||
unzip -oj "$ZIPFILE" module.prop install.sh uninstall.sh 'common/*' -d $TMPDIR >&2
|
unzip -o "$ZIPFILE" module.prop -d $TMPDIR >&2
|
||||||
|
[ ! -f $TMPDIR/module.prop ] && abort "! Unable to extract zip file!"
|
||||||
[ ! -f $TMPDIR/install.sh ] && abort "! Unable to extract zip file!"
|
|
||||||
# Load install script
|
|
||||||
. $TMPDIR/install.sh
|
|
||||||
|
|
||||||
if imageless_magisk; then
|
|
||||||
$BOOTMODE && MODDIRNAME=modules_update || MODDIRNAME=modules
|
|
||||||
MODULEROOT=$NVBASE/$MODDIRNAME
|
|
||||||
else
|
|
||||||
$BOOTMODE && IMGNAME=magisk_merge.img || IMGNAME=magisk.img
|
|
||||||
IMG=$NVBASE/$IMGNAME
|
|
||||||
request_zip_size_check "$ZIPFILE"
|
|
||||||
mount_magisk_img
|
|
||||||
MODULEROOT=$MOUNTPATH
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
$BOOTMODE && MODDIRNAME=modules_update || MODDIRNAME=modules
|
||||||
|
MODULEROOT=$NVBASE/$MODDIRNAME
|
||||||
MODID=`grep_prop id $TMPDIR/module.prop`
|
MODID=`grep_prop id $TMPDIR/module.prop`
|
||||||
|
MODNAME=`grep_prop name $TMPDIR/module.prop`
|
||||||
|
MODAUTH=`grep_prop author $TMPDIR/module.prop`
|
||||||
MODPATH=$MODULEROOT/$MODID
|
MODPATH=$MODULEROOT/$MODID
|
||||||
|
|
||||||
print_modname
|
|
||||||
|
|
||||||
ui_print "******************************"
|
|
||||||
ui_print "Powered by Magisk (@topjohnwu)"
|
|
||||||
ui_print "******************************"
|
|
||||||
|
|
||||||
##########################################################################################
|
|
||||||
# Install
|
|
||||||
##########################################################################################
|
|
||||||
|
|
||||||
# Create mod paths
|
# Create mod paths
|
||||||
rm -rf $MODPATH 2>/dev/null
|
rm -rf $MODPATH 2>/dev/null
|
||||||
mkdir -p $MODPATH
|
mkdir -p $MODPATH
|
||||||
|
|
||||||
on_install
|
##########
|
||||||
|
# Install
|
||||||
|
##########
|
||||||
|
|
||||||
# Remove placeholder
|
if is_legacy_script; then
|
||||||
rm -f $MODPATH/system/placeholder 2>/dev/null
|
unzip -oj "$ZIPFILE" module.prop install.sh uninstall.sh 'common/*' -d $TMPDIR >&2
|
||||||
|
|
||||||
# Custom uninstaller
|
# Load install script
|
||||||
[ -f $TMPDIR/uninstall.sh ] && cp -af $TMPDIR/uninstall.sh $MODPATH/uninstall.sh
|
. $TMPDIR/install.sh
|
||||||
|
|
||||||
# Auto Mount
|
# Callbacks
|
||||||
if imageless_magisk; then
|
print_modname
|
||||||
$SKIPMOUNT && touch $MODPATH/skip_mount
|
on_install
|
||||||
|
|
||||||
|
# Custom uninstaller
|
||||||
|
[ -f $TMPDIR/uninstall.sh ] && cp -af $TMPDIR/uninstall.sh $MODPATH/uninstall.sh
|
||||||
|
|
||||||
|
# Skip mount
|
||||||
|
$SKIPMOUNT && touch $MODPATH/skip_mount
|
||||||
|
|
||||||
|
# prop file
|
||||||
|
$PROPFILE && cp -af $TMPDIR/system.prop $MODPATH/system.prop
|
||||||
|
|
||||||
|
# Module info
|
||||||
|
cp -af $TMPDIR/module.prop $MODPATH/module.prop
|
||||||
|
|
||||||
|
# post-fs-data scripts
|
||||||
|
$POSTFSDATA && cp -af $TMPDIR/post-fs-data.sh $MODPATH/post-fs-data.sh
|
||||||
|
|
||||||
|
# service scripts
|
||||||
|
$LATESTARTSERVICE && cp -af $TMPDIR/service.sh $MODPATH/service.sh
|
||||||
|
|
||||||
|
ui_print "- Setting permissions"
|
||||||
|
set_permissions
|
||||||
else
|
else
|
||||||
$SKIPMOUNT || touch $MODPATH/auto_mount
|
print_modname
|
||||||
|
|
||||||
|
unzip -o "$ZIPFILE" customize.sh -d $MODPATH >&2
|
||||||
|
|
||||||
|
if ! grep -q '^SKIPUNZIP=1$' $MODPATH/customize.sh 2>/dev/null; then
|
||||||
|
ui_print "- Extracting module files"
|
||||||
|
unzip -o "$ZIPFILE" -x 'META-INF/*' -d $MODPATH >&2
|
||||||
|
|
||||||
|
# Default permissions
|
||||||
|
set_perm_recursive $MODPATH 0 0 0755 0644
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Load customization script
|
||||||
|
[ -f $MODPATH/customize.sh ] && . $MODPATH/customize.sh
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# prop files
|
|
||||||
$PROPFILE && cp -af $TMPDIR/system.prop $MODPATH/system.prop
|
|
||||||
|
|
||||||
# Module info
|
|
||||||
cp -af $TMPDIR/module.prop $MODPATH/module.prop
|
|
||||||
if $BOOTMODE; then
|
|
||||||
# Update info for Magisk Manager
|
|
||||||
if imageless_magisk; then
|
|
||||||
mktouch $NVBASE/modules/$MODID/update
|
|
||||||
cp -af $TMPDIR/module.prop $NVBASE/modules/$MODID/module.prop
|
|
||||||
else
|
|
||||||
mktouch /sbin/.magisk/img/$MODID/update
|
|
||||||
cp -af $TMPDIR/module.prop /sbin/.magisk/img/$MODID/module.prop
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# post-fs-data mode scripts
|
|
||||||
$POSTFSDATA && cp -af $TMPDIR/post-fs-data.sh $MODPATH/post-fs-data.sh
|
|
||||||
|
|
||||||
# service mode scripts
|
|
||||||
$LATESTARTSERVICE && cp -af $TMPDIR/service.sh $MODPATH/service.sh
|
|
||||||
|
|
||||||
# Handle replace folders
|
# Handle replace folders
|
||||||
for TARGET in $REPLACE; do
|
for TARGET in $REPLACE; do
|
||||||
mktouch $MODPATH$TARGET/.replace
|
ui_print "- Replace target: $TARGET"
|
||||||
|
mktouch $MODPATH$TARGET/.replace
|
||||||
done
|
done
|
||||||
|
|
||||||
ui_print "- Setting permissions"
|
if $BOOTMODE; then
|
||||||
set_permissions
|
# Update info for Magisk Manager
|
||||||
|
mktouch $NVBASE/modules/$MODID/update
|
||||||
|
cp -af $MODPATH/module.prop $NVBASE/modules/$MODID/module.prop
|
||||||
|
fi
|
||||||
|
|
||||||
##########################################################################################
|
# Copy over custom sepolicy rules
|
||||||
|
if [ -f $MODPATH/sepolicy.rule -a -e $PERSISTDIR ]; then
|
||||||
|
ui_print "- Installing custom sepolicy patch"
|
||||||
|
# Remove old recovery logs (which may be filling partition) to make room
|
||||||
|
rm -f $PERSISTDIR/cache/recovery/*
|
||||||
|
PERSISTMOD=$PERSISTDIR/magisk/$MODID
|
||||||
|
mkdir -p $PERSISTMOD
|
||||||
|
cp -af $MODPATH/sepolicy.rule $PERSISTMOD/sepolicy.rule || abort "! Insufficient partition size"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Remove stuffs that don't belong to modules
|
||||||
|
rm -rf \
|
||||||
|
$MODPATH/system/placeholder $MODPATH/customize.sh \
|
||||||
|
$MODPATH/README.md $MODPATH/.git* 2>/dev/null
|
||||||
|
|
||||||
|
#############
|
||||||
# Finalizing
|
# Finalizing
|
||||||
##########################################################################################
|
#############
|
||||||
|
|
||||||
cd /
|
cd /
|
||||||
imageless_magisk || unmount_magisk_img
|
|
||||||
$BOOTMODE || recovery_cleanup
|
$BOOTMODE || recovery_cleanup
|
||||||
rm -rf $TMPDIR $MOUNTPATH
|
rm -rf $TMPDIR
|
||||||
|
|
||||||
ui_print "- Done"
|
ui_print "- Done"
|
||||||
exit 0
|
exit 0
|
||||||
|
|
0
META-INF/com/google/android/updater-script
Normal file → Executable file
0
META-INF/com/google/android/updater-script
Normal file → Executable file
367
README.md
Normal file → Executable file
367
README.md
Normal file → Executable file
|
@ -1,341 +1,78 @@
|
||||||
## Rclone Remount v1.8
|
<h1 align="center">Cloud Storage Mounter for Magisk (prev: rclone-mount)</h1>
|
||||||
---
|
|
||||||
|
|
||||||
Remount cloud storage locally during boot via rclone & fusermount directly on your Android powered smart device.
|
<div align="center">
|
||||||
|
<!-- Version -->
|
||||||
|
<img src="https://img.shields.io/badge/Version-v1.14-blue.svg?longCache=true&style=for-the-badge"
|
||||||
|
alt="Version" />
|
||||||
|
<!-- Last Updated -->
|
||||||
|
<img src="https://img.shields.io/badge/Updated-April 22, 2021-green.svg?longCache=true&style=for-the-badge"
|
||||||
|
alt="_time_stamp_" />
|
||||||
|
<!-- Min Magisk -->
|
||||||
|
<img src="https://img.shields.io/badge/Magisk-20.0%2B-red.svg?longCache=true&style=for-the-badge"
|
||||||
|
alt="_time_stamp_" /></div>
|
||||||
|
|
||||||
Virtually limitless storage expansion with support for dozens of cloud providers including Dropbox, GDrive, OneDrive, SFTP & many more. Extremely useful for devices without physical storage expansion capabilities. Also great for streaming large media files without need for full caching. Binaries compiled using Termux.
|
<div align="center">
|
||||||
|
<strong>This is the spiritual successor of <a href="https://github.com/Magisk-Modules-Repo/com.piyushgarg.rclone">rclone-mount</a> with bug fixes and newer binaries included. More details in the
|
||||||
|
<a href="https://github.com/AvinashReddy3108/rclone-mount-magisk/wiki">wiki</a>.
|
||||||
|
</div>
|
||||||
|
|
||||||
We are constantly striving to improve this project & make it the best. If you experience any issues or have suggestions please file them [HERE](https://github.com/Magisk-Modules-Repo/com.piyushgarg.rclone/issues). Contributions to this project are welcomed.
|
<div align="center">
|
||||||
|
<h3>
|
||||||
## Features
|
<a href="https://github.com/AvinashReddy3108/rclone-mount-magisk">
|
||||||
|
Source Code
|
||||||
- Support for arm, arm64, ~~& x86~~
|
</a>
|
||||||
|
<span> | </span>
|
||||||
- Huge list of supported cloud storage providers
|
<a href="https://github.com/Magisk-Modules-Repo/com.piyushgarg.rclone">
|
||||||
|
Original Module Repository
|
||||||
- Apps with ability to specify paths can access `/mnt/cloud/`
|
</a>
|
||||||
|
<span> | </span>
|
||||||
- Most file explorers work just fine ([issue #9](https://github.com/Magisk-Modules-Repo/com.piyushgarg.rclone/issues/9))
|
<a href="https://github.com/AvinashReddy3108/rclone-mount-magisk/issues">
|
||||||
|
Issues
|
||||||
|
</a>
|
||||||
|
</h3>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
### Features
|
||||||
|
- Support for arm, arm64, ~~& x86~~ (will be back soon)
|
||||||
|
- Huge list of [supported cloud storage providers](https://rclone.org/#providers)
|
||||||
|
- Apps with ability to specify paths can access the remotes at `/mnt/cloud/`.
|
||||||
|
- Most file explorers work just fine ([read more on this](https://github.com/Magisk-Modules-Repo/com.piyushgarg.rclone/issues/9)).
|
||||||
- Mount points use names of remote(s) in rclone.conf
|
- Mount points use names of remote(s) in rclone.conf
|
||||||
|
|
||||||
- Specify custom rclone params for each remote via `/sdcard/.rclone/.REMOTE.param`
|
- Specify custom rclone params for each remote via `/sdcard/.rclone/.REMOTE.param`
|
||||||
|
- Access remotes via HTTP or (S)FTP clients, or bind the remotes to `/sdcard/Cloud/REMOTE` (recommended to [read this](https://github.com/Magisk-Modules-Repo/com.piyushgarg.rclone/issues/5)).
|
||||||
|
- Support for Work Profiles.
|
||||||
|
|
||||||
- Access remotes via [http://127.0.0.1:38762](http://127.0.0.1:38762)
|
### Configuration
|
||||||
|
1. Copy your `rclone.conf` file (if you have one already) to `/sdcard/.rclone/rclone.conf` (can always be generated later.)
|
||||||
- Access remotes via [ftp://127.0.0.1:38763](ftp://127.0.0.1:38763)
|
2. Add custom params at `/sdcard/.rclone/.[global/REMOTE].param` (if needed)
|
||||||
|
|
||||||
- Mount bind to `/sdcard/` (see [ issue #5](https://github.com/Magisk-Modules-Repo/com.piyushgarg.rclone/issues/5))
|
|
||||||
|
|
||||||
- Support for Work Profiles
|
|
||||||
|
|
||||||
---
|
|
||||||
## Configuration (pre-installing)
|
|
||||||
|
|
||||||
1. Copy your `rclone.conf` file to `/sdcard/.rclone/rclone.conf` (not required)
|
|
||||||
|
|
||||||
2. Add custom params at `/sdcard/.rclone/.*.param` (if needed)
|
|
||||||
|
|
||||||
3. Install the module via Magisk Manager
|
3. Install the module via Magisk Manager
|
||||||
|
4. Run `rclone config` via term if additional setup required
|
||||||
4. Run `rclone config` via term if additional setup required
|
|
||||||
|
|
||||||
4. All your rclone mount points will show up under `/mnt/cloud/` & `/storage/cloud/` or `/sdcard/cloud/`
|
4. All your rclone mount points will show up under `/mnt/cloud/` & `/storage/cloud/` or `/sdcard/cloud/`
|
||||||
|
|
||||||
For more detailed configuration of rclone please refer to [official documentation](https://rclone.org)
|
For more detailed configuration of rclone please refer to [official documentation](https://rclone.org)
|
||||||
|
|
||||||
---
|
### Known Issues
|
||||||
## Custom Params
|
- VLC takes a long time to load media as it opens file in write mode when using it's internal browser.
|
||||||
Custom params have been created as a means for users to adjust this modules default parameters which are set for all remotes inside your rclone.conf.
|
|
||||||
|
|
||||||
Specification of rclone parameters on a per remote basis can be created inside hidden files ending with the `.param` extension
|
a. Create remote type alias for media dirs in rclone.conf and
|
||||||
|
|
||||||
/sdcard/.rclone/.*.param
|
|
||||||
|
|
||||||
Where `*` is replaced with the name of remote
|
|
||||||
|
|
||||||
- Custom parameters, their default values & rclone params they represent in `( )`
|
|
||||||
|
|
||||||
LOGFILE=/sdcard/.rclone/rclone.log ( --log-file )
|
|
||||||
|
|
||||||
LOGLEVEL=NOTICE ( --log-level )
|
|
||||||
|
|
||||||
CACHEMODE=off ( --vfs-cache-mode )
|
|
||||||
|
|
||||||
CHUNKSIZE=1M ( --cache-chunk-size )
|
|
||||||
|
|
||||||
CHUNKTOTAL=1G ( --cache-chunk-total-size )
|
|
||||||
|
|
||||||
READCHUNKSIZE=1M ( --vfs-read-chunk-size )
|
|
||||||
|
|
||||||
CACHEWORKERS=1 ( --cache-workers )
|
|
||||||
|
|
||||||
CACHEINFOAGE=1h0m0s ( --cache-info-age )
|
|
||||||
|
|
||||||
DIRCACHETIME=30m0s ( --dir-cache-time )
|
|
||||||
|
|
||||||
ATTRTIMEOUT=30s ( --attr-timeout)
|
|
||||||
|
|
||||||
BUFFERSIZE=0 ( --buffer-size )
|
|
||||||
|
|
||||||
READAHEAD=128k ( --max-read-ahead )
|
|
||||||
|
|
||||||
M_UID=0 ( --uid )
|
|
||||||
|
|
||||||
M_GID=1015 ( --gid )
|
|
||||||
|
|
||||||
DIRPERMS=0775 ( --dir-perms )
|
|
||||||
|
|
||||||
FILEPERMS=0644 ( --file-perms )
|
|
||||||
|
|
||||||
UMASK=002 ( --umask )
|
|
||||||
|
|
||||||
BINDSD=0 ( default binds remote to /sdcard/Cloud/* )
|
|
||||||
|
|
||||||
SDBINDPOINT= ( relative to /storage/emulated/0)
|
|
||||||
|
|
||||||
SDSYNCDIRS= (relative to /storage/emulated/0)
|
|
||||||
|
|
||||||
ADD_PARAMS=0
|
|
||||||
|
|
||||||
REPLACE_PARAMS=0
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
_The following configuration will disable caching for remote `[Movies]`, bind to `/sdcard/Movies` & add the `-fast-list`/`--allow-non-empty` flags to it's mounting command._
|
|
||||||
|
|
||||||
/sdcard/.rclone/.Movies.param
|
|
||||||
|
|
||||||
1| CACHEMODE=off
|
|
||||||
2| BINDSD=1
|
|
||||||
3| SDBINDPOINT=Movies
|
|
||||||
4| ADD_PARAMS=--fast-list --allow-non-empty
|
|
||||||
5|
|
|
||||||
|
|
||||||
**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
|
|
||||||
|
|
||||||
Specification of global rclone parameters can be created in
|
|
||||||
|
|
||||||
/sdcard/.rclone/.global.param
|
|
||||||
|
|
||||||
- Global Specific Parameters
|
|
||||||
|
|
||||||
NETCHK=1
|
|
||||||
|
|
||||||
NETCHK_ADDR=google.com
|
|
||||||
|
|
||||||
NETCHK_IF=
|
|
||||||
|
|
||||||
HTTP=1
|
|
||||||
|
|
||||||
HTTP_ADDR=127.0.0.1:38762
|
|
||||||
|
|
||||||
FTP=1
|
|
||||||
|
|
||||||
FTP_ADDR=127.0.0.1:38763
|
|
||||||
|
|
||||||
- Excluded Parameters
|
|
||||||
|
|
||||||
SDBINDPOINT=
|
|
||||||
SDSYNCDIRS=
|
|
||||||
|
|
||||||
- Custom globals params example #1
|
|
||||||
|
|
||||||
_The following configuration will enable minimal caching for all remotes, bind to `/sdcard/Cloud/*`, disable HTTP/FTP & add the `--fast-list`/`--allow-non-empty` flags to their mounting command(s)._
|
|
||||||
|
|
||||||
/sdcard/.rclone/.global.param
|
|
||||||
|
|
||||||
1| CACHEMODE=minimal
|
|
||||||
2| BINDSD=1
|
|
||||||
3| ADD_PARAMS=--fast-list --allow-non-empty
|
|
||||||
4| HTTP=0
|
|
||||||
5| FTP=0
|
|
||||||
6|
|
|
||||||
|
|
||||||
**NOTE:** _Global parameters effect all remotes without `.*.parm` files containing opposing values. Some parameters are specific to globals while others have been excluded._
|
|
||||||
|
|
||||||
---
|
|
||||||
## Replacing & Adding Params
|
|
||||||
|
|
||||||
In order for users to appropriately utilize `ADD_PARAMS=` or `REPLACE_PARAMS=` they will need a little background on the parameters that are set by default.
|
|
||||||
|
|
||||||
- Currently specified params shown here ↓
|
|
||||||
|
|
||||||
(directly from service.sh):
|
|
||||||
|
|
||||||
`RCLONE_PARAMS=" --log-file ${LOGFILE} --log-level ${LOGLEVEL} --vfs-cache-mode ${CACHEMODE} --cache-dir ${CACHE} --cache-chunk-path ${CACHE_BACKEND} --cache-db-path ${CACHE_BACKEND} --cache-tmp-upload-path ${CACHE} --vfs-read-chunk-size ${READCHUNKSIZE} --vfs-cache-max-size ${CACHEMAXSIZE} --cache-chunk-size ${CHUNKSIZE} --cache-chunk-total-size ${CHUNKTOTAL} --cache-workers ${CACHEWORKERS} --cache-info-age ${CACHEINFOAGE} --dir-cache-time ${DIRCACHETIME} --attr-timeout ${ATTRTIMEOUT} --cache-chunk-no-memory --use-mmap --buffer-size ${BUFFERSIZE} --max-read-ahead ${READAHEAD} --no-modtime --no-checksum --uid ${M_UID} --gid ${M_GID} --allow-other --dir-perms ${DIRPERMS} --file-perms ${FILEPERMS} --umask ${UMASK} ${READONLY} ${ADD_PARAMS} "`
|
|
||||||
|
|
||||||
^
|
|
||||||
|
|
||||||
**NOTE:** _When using the `ADD_PARAMS=` it will append any additonal params you wish to specify at the point of `${ADD_PARAMS}` (above) in a fill in the blank manner._
|
|
||||||
|
|
||||||
- The script then takes `RCLONE_PARAMS=` and fills in blank at `${RCLONE_PARAMS}`
|
|
||||||
|
|
||||||
`rclone mount ${remote}: ${CLOUDROOTMOUNTPOINT}/${remote} --config ${CONFIGFILE} ${RCLONE_PARAMS} --daemon &`
|
|
||||||
|
|
||||||
**NOTE:** _Everything before and after `${RCLONE_PARAMS}` cannot not be replaced even with `REPLACE_PARAMS=` specified._
|
|
||||||
|
|
||||||
- When using `REPLACE_PARAMS=` `RCLONE_PARAMS=` becomes `RCLONE_PARAMS=" ${REPLACE_PARAMS} "`
|
|
||||||
|
|
||||||
---
|
|
||||||
## Work Profiles & Users
|
|
||||||
|
|
||||||
As of `v1.8` support for isolating & binding to work profiles or additional users has been included which may provide for some interesting use cases.
|
|
||||||
|
|
||||||
When adding work profiles through sandboxing apps such as [Island](https://play.google.com/store/apps/details?id=com.oasisfeng.island) or [Shelter](https://play.google.com/store/apps/details?id=net.typeblog.shelter) it will create a virtual SD for your sandboxed apps. This virtual SD can now be used with rclone remount.
|
|
||||||
|
|
||||||
- Work profile example #1 (Cloud Camera w/ Shelter)
|
|
||||||
|
|
||||||
open Shelter > find camera > clone to work profile
|
|
||||||
|
|
||||||
/sdcard/.rclone/.cloud-DCIM.param
|
|
||||||
|
|
||||||
1| BINDSD=1
|
|
||||||
2| SDBINDPOINT=DCIM
|
|
||||||
3| PROFILE=10
|
|
||||||
4| ISOLATE=1
|
|
||||||
5| CACHEMODE=writes
|
|
||||||
6|
|
|
||||||
|
|
||||||
**NOTE:** _Virtual SDs for work profiles & or additional users start at `/storage/emulated/`**10**. Additional profiles increase the ending directory integer (e.g. `/storage/emulated/`**11**). This integer is used with `PROFILE=`_
|
|
||||||
---
|
|
||||||
## SD Sync & Remotes
|
|
||||||
|
|
||||||
- SD sync example # 1
|
|
||||||
|
|
||||||
/sdcard/.rclone/.Backup.param
|
|
||||||
|
|
||||||
1| SDSYNCDIRS=DCIM/Camera:Photos:My Projects
|
|
||||||
2| CACHEMODE=writes
|
|
||||||
3| CACHEINFOAGE=11s
|
|
||||||
4| DIRCACHETIME=10s
|
|
||||||
5| ATTRTIMEOUT=10s
|
|
||||||
6|
|
|
||||||
|
|
||||||
**NOTE:** _`SDSYNCDIRS=` paths are relative to /storage/emulated/`PROFILE=0`. Paths are to be separated using a `: `. This variable is should be whitespace friendly._
|
|
||||||
---
|
|
||||||
## Known Issues
|
|
||||||
|
|
||||||
- VLC takes a long time to load media as it opens file in write mode when using it's internal browser.
|
|
||||||
|
|
||||||
a. Create remote type alias for media dirs in rclone.conf and
|
|
||||||
specify `CACHEMODE=off` in `/sdcard/.rclone/.ALIASNAME.param`
|
specify `CACHEMODE=off` in `/sdcard/.rclone/.ALIASNAME.param`
|
||||||
|
|
||||||
- Encrypted devices can not mount until unlock
|
- Encrypted devices can not mount until unlock
|
||||||
|
|
||||||
- Encrypted `rclone.conf` causes reboots
|
- Encrypted `rclone.conf` causes reboots
|
||||||
|
|
||||||
- High cpu/mem in some apps with storage perms ([issue #9](https://github.com/Magisk-Modules-Repo/com.piyushgarg.rclone/issues/9))
|
- High cpu/mem in some apps with storage perms ([issue #9](https://github.com/Magisk-Modules-Repo/com.piyushgarg.rclone/issues/9))
|
||||||
- The `fusermount` bin may not be compatible on all devices (see [thread](https://www.google.com/amp/s/forum.xda-developers.com/android/development/fusermount-android-rclone-mount-t3866652/amp/))
|
- The `fusermount` bin may not be compatible on all devices (see [thread](https://www.google.com/amp/s/forum.xda-developers.com/android/development/fusermount-android-rclone-mount-t3866652/amp/))
|
||||||
|
|
||||||
---
|
|
||||||
## Disclaimer
|
## Disclaimer
|
||||||
|
- Neither the author nor devs will be held responsible for any damage/data loss that may occur during use of this module.
|
||||||
|
- While we have done our best to make sure no harm will come about, no guarantees can be made.
|
||||||
|
- Keep in mind the binaries included in this project are BETA quality (at best), which may cause unforseen issues.
|
||||||
|
|
||||||
Neither the author nor developer's will be held responsible for any damage/data loss that may occur during use of this module. While we have done our best to make sure no harm will come about, no guarantees can be made. Keep in mind the binaries included in this project were originally intended to be ran on PCs which may cause unforseen issues. Always check this document before updating to new releases as significant changes may occur.
|
Always check this document before updating to new releases as significant changes may occur.
|
||||||
|
|
||||||
---
|
|
||||||
## Credits
|
## Credits
|
||||||
|
|
||||||
- rclone devs
|
- rclone devs
|
||||||
- pmj_pedro[@xda](https://forum.xda-developers.com/showpost.php?p=78147335&postcount=1)
|
- pmj_pedro[@xda](https://forum.xda-developers.com/showpost.php?p=78147335&postcount=1)
|
||||||
- agnostic-apollo[@xda](https://forum.xda-developers.com/showpost.php?p=79929083&postcount=12)
|
- agnostic-apollo[@xda](https://forum.xda-developers.com/showpost.php?p=79929083&postcount=12)
|
||||||
- rclone binaries from [rclone.org](https://rclone.org/downloads)
|
- Termux for building and hosting binaries for [rclone](https://10.via0.com/ipns/k51qzi5uqu5dg9vawh923wejqffxiu9bhqlze5f508msk0h7ylpac27fdgaskx/pool/main/r/rclone), [fusermount](https://grimler.se/termux-root-packages-24/pool/stable/libf/libfuse2/), [inotifywait](https://10.via0.com/ipns/k51qzi5uqu5dg9vawh923wejqffxiu9bhqlze5f508msk0h7ylpac27fdgaskx/pool/main/i/inotify-tools), [libandroid-support.so](https://10.via0.com/ipns/k51qzi5uqu5dg9vawh923wejqffxiu9bhqlze5f508msk0h7ylpac27fdgaskx/pool/main/liba/libandroid-support).
|
||||||
- fusermount binaries from [xda-devs](https://forum.xda-developers.com/android/development/fusermount-android-rclone-mount-t3866652)
|
- improvements by geofferey@github
|
||||||
- improvements geofferey@github
|
- @Zackptg5 for MMT-EX Module template.
|
||||||
|
|
||||||
---
|
|
||||||
## Changelog
|
|
||||||
|
|
||||||
## v1.13
|
|
||||||
* Add arm/arm64 1.53 binaries downloaded from https://beta.rclone.org/v1.53.0/testbuilds/rclone-android-16-arm.gz
|
|
||||||
|
|
||||||
## v1.12
|
|
||||||
* Fixed restart problems.
|
|
||||||
|
|
||||||
## v1.11
|
|
||||||
* Add arm/arm64 1.52 bins downloaded from https://beta.rclone.org/v1.52.0/testbuilds/rclone-android-16-arm.gz
|
|
||||||
* Fixed service.sh paths
|
|
||||||
|
|
||||||
## v1.10
|
|
||||||
* fixed fusermount wrapper
|
|
||||||
|
|
||||||
## v1.9
|
|
||||||
* Add arm/arm64 1.51 bins downloaded from https://beta.rclone.org/
|
|
||||||
* Commented fusermount wrapper
|
|
||||||
|
|
||||||
### v1.8
|
|
||||||
* Support for Work Profiles `PROFILE=`
|
|
||||||
* Isolate to Work Profiles `ISOLATE=1`
|
|
||||||
* Support syncing from SD to remote
|
|
||||||
|
|
||||||
### v1.7
|
|
||||||
* Add ability to disable HTTP/FTP
|
|
||||||
* Link rest of default params to custom vars
|
|
||||||
* Exclude some custom params from globals
|
|
||||||
* Make some globals exclusive
|
|
||||||
* Change `BINDPOINT=` to `SDBINDPOINT=`
|
|
||||||
* Fix bug with custom params
|
|
||||||
* Set `PATH=` to change priority of used bins
|
|
||||||
|
|
||||||
### v1.6
|
|
||||||
* Simplify custom global parameters
|
|
||||||
* Fix & improve binding to SD
|
|
||||||
* Specify additional rclone ops with `ADD_PARAMS=`
|
|
||||||
* Replace `rclone mount` ops via `REPLACE_PARAMS=`
|
|
||||||
|
|
||||||
### v1.5
|
|
||||||
* Replace arm/arm64 `rclone` 1.48 bins built with Termux
|
|
||||||
* Replace arm/arm64 `fusermount` built with Termux
|
|
||||||
* Add arm/arm64 `libandroid-support.so` from Termux
|
|
||||||
* Support for mounting to SD
|
|
||||||
* Squash missing rclone.conf install bug
|
|
||||||
* Tune default parameters
|
|
||||||
* Include a wrap for `rclone config`
|
|
||||||
* Include `fusermount-wrapper.sh`
|
|
||||||
* General Improvements
|
|
||||||
|
|
||||||
### v1.4
|
|
||||||
* Add ability to disable a remote
|
|
||||||
* Add a wrapper script for rclone
|
|
||||||
* Access remotes via http & ftp
|
|
||||||
* Use without rebooting device
|
|
||||||
* Add wrapper cmds to `rclone help`
|
|
||||||
* Make remount possible via `su -M -c`
|
|
||||||
|
|
||||||
### v1.3
|
|
||||||
* Move user rclone.conf & related to `/sdcard/.rclone/`
|
|
||||||
* Control global `--vfs-cache-mode` via simple files placed in `/sdcard/.rclone/`
|
|
||||||
* Specify custom params for individual remotes via `/sdcard/.rclone/.REMOTENAME.params`
|
|
||||||
|
|
||||||
### v1.2
|
|
||||||
* Change install process
|
|
||||||
* Changes for full systemless
|
|
||||||
* Improve mount reliability
|
|
||||||
* Symlink mountpoint to `/storage/`
|
|
||||||
|
|
||||||
### v1.1
|
|
||||||
* Initial release
|
|
||||||
* rclone mount
|
|
||||||
|
|
||||||
[](http://hits.dwyl.io/Magisk-Modules-Repo/compiyushgargrclone)
|
|
||||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -1,23 +0,0 @@
|
||||||
#!/system/bin/sh
|
|
||||||
|
|
||||||
MODDIR=${0%/*}
|
|
||||||
|
|
||||||
IMGDIR=/sbin/.core/img
|
|
||||||
UPDDIR=/data/adb/modules_update
|
|
||||||
id=com.piyushgarg.rclone
|
|
||||||
|
|
||||||
if [ -d ${UPDDIR}/${id} ]; then
|
|
||||||
|
|
||||||
HOME=${UPDDIR}/${id}
|
|
||||||
|
|
||||||
elif [ -e ${IMGDIR}/${id} ]; then
|
|
||||||
|
|
||||||
HOME=${IMGDIR}/${id}
|
|
||||||
|
|
||||||
else
|
|
||||||
|
|
||||||
HOME=${MODDIR}
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
LD_LIBRARY_PATH=$HOME $HOME/fusermount $*
|
|
Binary file not shown.
32
changelog.md
32
changelog.md
|
@ -1,32 +0,0 @@
|
||||||
# Changelog
|
|
||||||
## v1.9
|
|
||||||
* Add arm/arm64 1.51 bins downloaded from https://beta.rclone.org/
|
|
||||||
* Commented fusermount wrapper
|
|
||||||
|
|
||||||
## v1.5
|
|
||||||
* Add arm/arm64 1.48 bins compiled using Termux
|
|
||||||
* Add static arm64 `fusermount`
|
|
||||||
* Support for mounting to SD
|
|
||||||
* Squash missing rclone.conf install bug
|
|
||||||
* Tune default parameters
|
|
||||||
* Include a wrap for `rclone config`
|
|
||||||
|
|
||||||
## v1.4
|
|
||||||
* Add ability to disable a remote
|
|
||||||
* Add a wrapper script for rclone
|
|
||||||
* Make remount possible via `su --mount-master`
|
|
||||||
|
|
||||||
## v1.3
|
|
||||||
* Move user rclone.conf & related to /sdcard/.rclone/
|
|
||||||
* Control global --vfs-cache-mode via simple files placed in /sdcard/.rclone/
|
|
||||||
* Specify custom params for individual remotes via /sdcard/.rclone/.REMOTENAME.params
|
|
||||||
|
|
||||||
## v1.2
|
|
||||||
* Change install process
|
|
||||||
* Changes for full systemless
|
|
||||||
* Improve mount reliability
|
|
||||||
* Link to /storage/
|
|
||||||
|
|
||||||
## v1.1
|
|
||||||
* Initial release
|
|
||||||
* rclone mount
|
|
0
common/addon/placeholder
Executable file
0
common/addon/placeholder
Executable file
BIN
common/binary/arm/fusermount
Executable file
BIN
common/binary/arm/fusermount
Executable file
Binary file not shown.
BIN
common/binary/arm/inotifywait
Executable file
BIN
common/binary/arm/inotifywait
Executable file
Binary file not shown.
BIN
common/binary/arm/rclone
Executable file
BIN
common/binary/arm/rclone
Executable file
Binary file not shown.
BIN
common/binary/arm64/fusermount
Executable file
BIN
common/binary/arm64/fusermount
Executable file
Binary file not shown.
BIN
common/binary/arm64/inotifywait
Executable file
BIN
common/binary/arm64/inotifywait
Executable file
Binary file not shown.
BIN
common/binary/arm64/rclone
Executable file
BIN
common/binary/arm64/rclone
Executable file
Binary file not shown.
BIN
common/binary/x86/fusermount
Executable file
BIN
common/binary/x86/fusermount
Executable file
Binary file not shown.
BIN
common/binary/x86/inotifywait
Executable file
BIN
common/binary/x86/inotifywait
Executable file
Binary file not shown.
BIN
common/binary/x86/rclone
Executable file
BIN
common/binary/x86/rclone
Executable file
Binary file not shown.
BIN
common/binary/x86_64/fusermount
Executable file
BIN
common/binary/x86_64/fusermount
Executable file
Binary file not shown.
BIN
common/binary/x86_64/inotifywait
Executable file
BIN
common/binary/x86_64/inotifywait
Executable file
Binary file not shown.
BIN
binary/rclone-arm → common/binary/x86_64/rclone
Normal file → Executable file
BIN
binary/rclone-arm → common/binary/x86_64/rclone
Normal file → Executable file
Binary file not shown.
|
@ -1,24 +0,0 @@
|
||||||
#!/system/bin/sh
|
|
||||||
# Do NOT assume where your module will be located.
|
|
||||||
# ALWAYS use $MODDIR if you need to know where this script
|
|
||||||
# and module is placed.
|
|
||||||
# This will make sure your module will still work
|
|
||||||
# if Magisk change its mount point in the future
|
|
||||||
MODDIR=${0%/*}
|
|
||||||
MODDIR=""
|
|
||||||
#sleep 120
|
|
||||||
echo "UNmounting remotes..."
|
|
||||||
CONFIGFILE=/sdcard/rclone.conf
|
|
||||||
HOME=/mnt
|
|
||||||
CLOUDROOTMOUNTPOINT=$HOME/cloud/
|
|
||||||
mkdir -p $CLOUDROOTMOUNTPOINT
|
|
||||||
|
|
||||||
$MODDIR/rclone listremotes --config ${CONFIGFILE}|cut -f1 -d: |
|
|
||||||
while read line; do
|
|
||||||
echo "UNmounting... $line"
|
|
||||||
umount -f ${CLOUDROOTMOUNTPOINT}/${line}
|
|
||||||
sleep 1
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "...done"
|
|
||||||
|
|
236
common/functions.sh
Executable file
236
common/functions.sh
Executable file
|
@ -0,0 +1,236 @@
|
||||||
|
##########################################################################################
|
||||||
|
#
|
||||||
|
# MMT Extended Utility Functions
|
||||||
|
#
|
||||||
|
##########################################################################################
|
||||||
|
|
||||||
|
abort() {
|
||||||
|
ui_print "$1"
|
||||||
|
rm -rf $MODPATH 2>/dev/null
|
||||||
|
cleanup
|
||||||
|
rm -rf $TMPDIR 2>/dev/null
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
cleanup() {
|
||||||
|
rm -rf $MODPATH/common 2>/dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
device_check() {
|
||||||
|
local opt=`getopt -o dm -- "$@"` type=device
|
||||||
|
eval set -- "$opt"
|
||||||
|
while true; do
|
||||||
|
case "$1" in
|
||||||
|
-d) local type=device; shift ;;
|
||||||
|
-m) local type=manufacturer; shift ;;
|
||||||
|
--) shift; break ;;
|
||||||
|
*) abort "Invalid device_check argument $1! Aborting!" ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
local prop=$(echo "$1" | tr '[:upper:]' '[:lower:]')
|
||||||
|
for i in /system /vendor /odm /product; do
|
||||||
|
if [ -f $i/build.prop ]; then
|
||||||
|
for j in "ro.product.$type" "ro.build.$type" "ro.product.vendor.$type" "ro.vendor.product.$type"; do
|
||||||
|
[ "$(sed -n "s/^$j=//p" $i/build.prop 2>/dev/null | head -n 1 | tr '[:upper:]' '[:lower:]')" == "$prop" ] && return 0
|
||||||
|
done
|
||||||
|
[ "$type" == "device" ] && [ "$(sed -n "s/^"ro.build.product"=//p" $i/build.prop 2>/dev/null | head -n 1 | tr '[:upper:]' '[:lower:]')" == "$prop" ] && return 0
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
cp_ch() {
|
||||||
|
local opt=`getopt -o nr -- "$@"` BAK=true UBAK=true FOL=false
|
||||||
|
eval set -- "$opt"
|
||||||
|
while true; do
|
||||||
|
case "$1" in
|
||||||
|
-n) UBAK=false; shift ;;
|
||||||
|
-r) FOL=true; shift ;;
|
||||||
|
--) shift; break ;;
|
||||||
|
*) abort "Invalid cp_ch argument $1! Aborting!" ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
local SRC="$1" DEST="$2" OFILES="$1"
|
||||||
|
$FOL && local OFILES=$(find $SRC -type f 2>/dev/null)
|
||||||
|
[ -z $3 ] && PERM=0644 || PERM=$3
|
||||||
|
case "$DEST" in
|
||||||
|
$TMPDIR/*|$MODULEROOT/*|$NVBASE/modules/$MODID/*) BAK=false ;;
|
||||||
|
esac
|
||||||
|
for OFILE in ${OFILES}; do
|
||||||
|
if $FOL; then
|
||||||
|
if [ "$(basename $SRC)" == "$(basename $DEST)" ]; then
|
||||||
|
local FILE=$(echo $OFILE | sed "s|$SRC|$DEST|")
|
||||||
|
else
|
||||||
|
local FILE=$(echo $OFILE | sed "s|$SRC|$DEST/$(basename $SRC)|")
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
[ -d "$DEST" ] && local FILE="$DEST/$(basename $SRC)" || local FILE="$DEST"
|
||||||
|
fi
|
||||||
|
if $BAK && $UBAK; then
|
||||||
|
[ ! "$(grep "$FILE$" $INFO 2>/dev/null)" ] && echo "$FILE" >> $INFO
|
||||||
|
[ -f "$FILE" -a ! -f "$FILE~" ] && { mv -f $FILE $FILE~; echo "$FILE~" >> $INFO; }
|
||||||
|
elif $BAK; then
|
||||||
|
[ ! "$(grep "$FILE$" $INFO 2>/dev/null)" ] && echo "$FILE" >> $INFO
|
||||||
|
fi
|
||||||
|
install -D -m $PERM "$OFILE" "$FILE"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
install_script() {
|
||||||
|
case "$1" in
|
||||||
|
-l) shift; local INPATH=$NVBASE/service.d ;;
|
||||||
|
-p) shift; local INPATH=$NVBASE/post-fs-data.d ;;
|
||||||
|
*) local INPATH=$NVBASE/service.d ;;
|
||||||
|
esac
|
||||||
|
[ "$(grep "#!/system/bin/sh" $1)" ] || sed -i "1i #!/system/bin/sh" $1
|
||||||
|
local i; for i in "MODPATH" "LIBDIR" "MODID" "INFO" "MODDIR"; do
|
||||||
|
case $i in
|
||||||
|
"MODPATH") sed -i "1a $i=$NVBASE/modules/$MODID" $1;;
|
||||||
|
"MODDIR") sed -i "1a $i=\${0%/*}" $1;;
|
||||||
|
*) sed -i "1a $i=$(eval echo \$$i)" $1;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
[ "$1" == "$MODPATH/uninstall.sh" ] && return 0
|
||||||
|
case $(basename $1) in
|
||||||
|
post-fs-data.sh|service.sh) ;;
|
||||||
|
*) cp_ch -n $1 $INPATH/$(basename $1) 0755;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
prop_process() {
|
||||||
|
sed -i -e "/^#/d" -e "/^ *$/d" $1
|
||||||
|
[ -f $MODPATH/system.prop ] || mktouch $MODPATH/system.prop
|
||||||
|
while read LINE; do
|
||||||
|
echo "$LINE" >> $MODPATH/system.prop
|
||||||
|
done < $1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Check for min/max api version
|
||||||
|
[ -z $MINAPI ] || { [ $API -lt $MINAPI ] && abort "! Your system API of $API is less than the minimum api of $MINAPI! Aborting!"; }
|
||||||
|
[ -z $MAXAPI ] || { [ $API -gt $MAXAPI ] && abort "! Your system API of $API is greater than the maximum api of $MAXAPI! Aborting!"; }
|
||||||
|
|
||||||
|
# Set variables
|
||||||
|
[ $API -lt 26 ] && DYNLIB=false
|
||||||
|
[ -z $DYNLIB ] && DYNLIB=false
|
||||||
|
[ -z $DEBUG ] && DEBUG=false
|
||||||
|
INFO=$NVBASE/modules/.$MODID-files
|
||||||
|
ORIGDIR="$MAGISKTMP/mirror"
|
||||||
|
if $DYNLIB; then
|
||||||
|
LIBPATCH="\/vendor"
|
||||||
|
LIBDIR=/system/vendor
|
||||||
|
else
|
||||||
|
LIBPATCH="\/system"
|
||||||
|
LIBDIR=/system
|
||||||
|
fi
|
||||||
|
if ! $BOOTMODE; then
|
||||||
|
ui_print "- Only uninstall is supported in recovery"
|
||||||
|
ui_print " Uninstalling!"
|
||||||
|
touch $MODPATH/remove
|
||||||
|
[ -s $INFO ] && install_script $MODPATH/uninstall.sh || rm -f $INFO $MODPATH/uninstall.sh
|
||||||
|
recovery_cleanup
|
||||||
|
cleanup
|
||||||
|
rm -rf $NVBASE/modules_update/$MODID $TMPDIR 2>/dev/null
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Debug
|
||||||
|
if $DEBUG; then
|
||||||
|
ui_print "- Debug mode"
|
||||||
|
ui_print " Module install log will include debug info"
|
||||||
|
ui_print " Be sure to save it after module install"
|
||||||
|
set -x
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Extract files
|
||||||
|
ui_print "- Extracting module files"
|
||||||
|
unzip -o "$ZIPFILE" -x 'META-INF/*' 'common/functions.sh' -d $MODPATH >&2
|
||||||
|
[ -f "$MODPATH/common/addon.tar.xz" ] && tar -xf $MODPATH/common/addon.tar.xz -C $MODPATH/common 2>/dev/null
|
||||||
|
|
||||||
|
# Run addons
|
||||||
|
if [ "$(ls -A $MODPATH/common/addon/*/install.sh 2>/dev/null)" ]; then
|
||||||
|
ui_print " "; ui_print "- Running Addons -"
|
||||||
|
for i in $MODPATH/common/addon/*/install.sh; do
|
||||||
|
ui_print " Running $(echo $i | sed -r "s|$MODPATH/common/addon/(.*)/install.sh|\1|")..."
|
||||||
|
. $i
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Remove files outside of module directory
|
||||||
|
ui_print "- Removing old files"
|
||||||
|
|
||||||
|
if [ -f $INFO ]; then
|
||||||
|
while read LINE; do
|
||||||
|
if [ "$(echo -n $LINE | tail -c 1)" == "~" ]; then
|
||||||
|
continue
|
||||||
|
elif [ -f "$LINE~" ]; then
|
||||||
|
mv -f $LINE~ $LINE
|
||||||
|
else
|
||||||
|
rm -f $LINE
|
||||||
|
while true; do
|
||||||
|
LINE=$(dirname $LINE)
|
||||||
|
[ "$(ls -A $LINE 2>/dev/null)" ] && break 1 || rm -rf $LINE
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
done < $INFO
|
||||||
|
rm -f $INFO
|
||||||
|
fi
|
||||||
|
|
||||||
|
### Install
|
||||||
|
ui_print "- Installing"
|
||||||
|
|
||||||
|
[ -f "$MODPATH/common/install.sh" ] && . $MODPATH/common/install.sh
|
||||||
|
|
||||||
|
ui_print " Installing for $ARCH SDK $API device..."
|
||||||
|
# Remove comments from files and place them, add blank line to end if not already present
|
||||||
|
for i in $(find $MODPATH -type f -name "*.sh" -o -name "*.prop" -o -name "*.rule"); do
|
||||||
|
[ -f $i ] && { sed -i -e "/^#/d" -e "/^ *$/d" $i; [ "$(tail -1 $i)" ] && echo "" >> $i; } || continue
|
||||||
|
case $i in
|
||||||
|
"$MODPATH/service.sh") install_script -l $i;;
|
||||||
|
"$MODPATH/post-fs-data.sh") install_script -p $i;;
|
||||||
|
"$MODPATH/uninstall.sh") if [ -s $INFO ] || [ "$(head -n1 $MODPATH/uninstall.sh)" != "# Don't modify anything after this" ]; then
|
||||||
|
install_script $MODPATH/uninstall.sh
|
||||||
|
else
|
||||||
|
rm -f $INFO $MODPATH/uninstall.sh
|
||||||
|
fi;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
$IS64BIT || for i in $(find $MODPATH/system -type d -name "lib64"); do rm -rf $i 2>/dev/null; done
|
||||||
|
[ -d "/system/priv-app" ] || mv -f $MODPATH/system/priv-app $MODPATH/system/app 2>/dev/null
|
||||||
|
[ -d "/system/xbin" ] || mv -f $MODPATH/system/xbin $MODPATH/system/bin 2>/dev/null
|
||||||
|
if $DYNLIB; then
|
||||||
|
for FILE in $(find $MODPATH/system/lib* -type f 2>/dev/null | sed "s|$MODPATH/system/||"); do
|
||||||
|
[ -s $MODPATH/system/$FILE ] || continue
|
||||||
|
case $FILE in
|
||||||
|
lib*/modules/*) continue;;
|
||||||
|
esac
|
||||||
|
mkdir -p $(dirname $MODPATH/system/vendor/$FILE)
|
||||||
|
mv -f $MODPATH/system/$FILE $MODPATH/system/vendor/$FILE
|
||||||
|
[ "$(ls -A `dirname $MODPATH/system/$FILE`)" ] || rm -rf `dirname $MODPATH/system/$FILE`
|
||||||
|
done
|
||||||
|
# Delete empty lib folders (busybox find doesn't have this capability)
|
||||||
|
toybox find $MODPATH/system/lib* -type d -empty -delete >/dev/null 2>&1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Set permissions
|
||||||
|
ui_print " "
|
||||||
|
ui_print "- Setting Permissions"
|
||||||
|
set_perm_recursive $MODPATH 0 0 0755 0644
|
||||||
|
if [ -d $MODPATH/system/vendor ]; then
|
||||||
|
set_perm_recursive $MODPATH/system/vendor 0 0 0755 0644 u:object_r:vendor_file:s0
|
||||||
|
[ -d $MODPATH/system/vendor/app ] && set_perm_recursive $MODPATH/system/vendor/app 0 0 0755 0644 u:object_r:vendor_app_file:s0
|
||||||
|
[ -d $MODPATH/system/vendor/etc ] && set_perm_recursive $MODPATH/system/vendor/etc 0 0 0755 0644 u:object_r:vendor_configs_file:s0
|
||||||
|
[ -d $MODPATH/system/vendor/overlay ] && set_perm_recursive $MODPATH/system/vendor/overlay 0 0 0755 0644 u:object_r:vendor_overlay_file:s0
|
||||||
|
for FILE in $(find $MODPATH/system/vendor -type f -name *".apk"); do
|
||||||
|
[ -f $FILE ] && chcon u:object_r:vendor_app_file:s0 $FILE
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
set_permissions
|
||||||
|
|
||||||
|
# Complete install
|
||||||
|
cleanup
|
||||||
|
|
||||||
|
# Credits
|
||||||
|
ui_print "**************************************"
|
||||||
|
ui_print "* MMT Extended by Zackptg5 @ XDA *"
|
||||||
|
ui_print "**************************************"
|
31
common/install.sh
Executable file
31
common/install.sh
Executable file
|
@ -0,0 +1,31 @@
|
||||||
|
# Install script
|
||||||
|
|
||||||
|
ui_print "+ Extracting rclone to $MODPATH/rclone"
|
||||||
|
cp -af $MODPATH/common/binary/$ARCH/rclone $MODPATH/rclone
|
||||||
|
|
||||||
|
ui_print "+ Extracting fusermount to $MODPATH/system/bin/fusermount"
|
||||||
|
cp -af $MODPATH/common/binary/$ARCH/fusermount $MODPATH/system/bin/fusermount
|
||||||
|
|
||||||
|
ui_print "+ Extracting syncd.sh script to $MODPATH/syncd.sh"
|
||||||
|
cp -af $MODPATH/common/binary/syncd.sh $MODPATH/syncd.sh
|
||||||
|
|
||||||
|
ui_print "+ Extracting inotifywait to $MODPATH/inotifywait"
|
||||||
|
cp -af $MODPATH/common/binary/$ARCH/inotifywait $MODPATH/inotifywait
|
||||||
|
|
||||||
|
case $ARCH32 in
|
||||||
|
arm)
|
||||||
|
ui_print "+ Extracting libandroid-support.so to $MODPATH/system/lib/libandroid-support.so"
|
||||||
|
cp -af $MODPATH/common/lib/arm/libandroid-support.so $MODPATH/system/lib/libandroid-support.so
|
||||||
|
if [ "$IS64BIT" = true ]; then
|
||||||
|
ui_print "+ Extracting libandroid-support.so (arm64) to $MODPATH/system/lib64/libandroid-support.so"
|
||||||
|
cp -af $MODPATH/common/lib/arm64/libandroid-support.so $MODPATH/system/lib64/libandroid-support.so
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
x86)
|
||||||
|
cp -af $MODPATH/common/lib/x86/libandroid-support.so $MODPATH/system/lib/libandroid-support.so
|
||||||
|
if [ "$IS64BIT" = true ]; then
|
||||||
|
ui_print "+ Extracting libandroid-support.so (x86_64) to $MODPATH/system/lib64/libandroid-support.so"
|
||||||
|
cp -af $MODPATH/common/lib/x86_64/libandroid-support.so $MODPATH/system/lib64/libandroid-support.so
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
BIN
common/lib/arm/libandroid-support.so
Normal file
BIN
common/lib/arm/libandroid-support.so
Normal file
Binary file not shown.
BIN
common/lib/arm64/libandroid-support.so
Normal file
BIN
common/lib/arm64/libandroid-support.so
Normal file
Binary file not shown.
BIN
common/lib/x86/libandroid-support.so
Normal file
BIN
common/lib/x86/libandroid-support.so
Normal file
Binary file not shown.
BIN
common/lib/x86_64/libandroid-support.so
Normal file
BIN
common/lib/x86_64/libandroid-support.so
Normal file
Binary file not shown.
|
@ -1,79 +0,0 @@
|
||||||
#!/system/bin/sh
|
|
||||||
# Do NOT assume where your module will be located.
|
|
||||||
# ALWAYS use $MODDIR if you need to know where this script
|
|
||||||
# and module is placed.
|
|
||||||
# This will make sure your module will still work
|
|
||||||
# if Magisk change its mount point in the future
|
|
||||||
|
|
||||||
MODDIR=${0%/*}
|
|
||||||
|
|
||||||
. $MODDIR/module.prop
|
|
||||||
|
|
||||||
IMGDIR=/sbin/.core/img
|
|
||||||
|
|
||||||
if [ -d $IMGDIR/$id ]; then
|
|
||||||
|
|
||||||
ln -sf $IMGDIR/$id/rclone /sbin/rclone
|
|
||||||
ln -sf $IMGDIR/$id/fusermount /sbin/fusermount
|
|
||||||
|
|
||||||
else
|
|
||||||
|
|
||||||
ln -sf $MODDIR/rclone /sbin/rclone
|
|
||||||
ln -sf $MODDIR/fusermount /sbin/fusermount
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
#RCLONE PARAMETERS
|
|
||||||
BUFFERSIZE=8M
|
|
||||||
CACHEMAXSIZE=256M
|
|
||||||
DIRCACHETIME=24h
|
|
||||||
READAHEAD=128k
|
|
||||||
|
|
||||||
USER_CONF=/sdcard/rclone.conf
|
|
||||||
CONFIGFILE=$MODDIR/rclone.conf
|
|
||||||
LOGFILE=/sdcard/rclone.log
|
|
||||||
HOME=/mnt
|
|
||||||
CLOUDROOTMOUNTPOINT=$HOME/cloud
|
|
||||||
CACHE=/mnt/runtime/default/rclone-cache
|
|
||||||
CACHE_BACKEND=/mnt/runtime/default/rc-cache-backend
|
|
||||||
|
|
||||||
if [[ ! -d $CLOUDROOTMOUNTPOINT ]]; then
|
|
||||||
|
|
||||||
mkdir -p $CLOUDROOTMOUNTPOINT
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ ! -d $CACHE ]]; then
|
|
||||||
|
|
||||||
mkdir -p $CACHE
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ ! -d $CACHE_BACKEND ]]; then
|
|
||||||
|
|
||||||
mkdir -p $CACHE_BACKEND
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
ln -sf $CLOUDROOTMOUNTPOINT /mnt/runtime/read/cloud
|
|
||||||
ln -sf $CLOUDROOTMOUNTPOINT /mnt/runtime/write/cloud
|
|
||||||
|
|
||||||
if [[ -e $USER_CONFIG ]]; then
|
|
||||||
|
|
||||||
cp $USER_CONFIG $CONFIGFILE
|
|
||||||
chmod 0600 $CONFIGFILE
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
#sh -c "$MODDIR/system/bin/rclone mount piyushDOTgarg_shopDOTmega: ${CLOUDROOTMOUNTPOINT}/piyushDOTgarg_shopDOTmega -vv --config ${CONFIGFILE} --attr-timeout 10m --cache-dir=/storage/cache --vfs-cache-mode writes --vfs-cache-max-age 168h0m0s --log-file /sdcard/dns.log --allow-other --gid 1015" &
|
|
||||||
|
|
||||||
$MODDIR/rclone listremotes --config ${CONFIGFILE}|cut -f1 -d: |
|
|
||||||
while read line; do
|
|
||||||
echo "mounting... $line"
|
|
||||||
mkdir -p ${CLOUDROOTMOUNTPOINT}/${line}
|
|
||||||
$MODDIR/rclone mount ${line}: ${CLOUDROOTMOUNTPOINT}/${line} --config ${CONFIGFILE} --max-read-ahead ${READAHEAD} --buffer-size ${BUFFERSIZE} --dir-cache-time ${DIRCACHETIME} --poll-interval 5m --attr-timeout ${DIRCACHETIME} --vfs-cache-mode writes --vfs-read-chunk-size 2M --vfs-read-chunk-size-limit 10M --vfs-cache-max-age 168h0m0s --vfs-cache-max-size ${CACHEMAXSIZE} --cache-dir=/storage/cache --cache-chunk-path /storage/cache-backend/ --cache-chunk-clean-interval 10m0s --log-file ${LOGFILE} --allow-other --gid 1015 --daemon
|
|
||||||
sleep 5
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "...done"
|
|
||||||
|
|
|
@ -1,9 +0,0 @@
|
||||||
#!/system/bin/sh
|
|
||||||
# Do NOT assume where your module will be located.
|
|
||||||
# ALWAYS use $MODDIR if you need to know where this script
|
|
||||||
# and module is placed.
|
|
||||||
# This will make sure your module will still work
|
|
||||||
# if Magisk change its mount point in the future
|
|
||||||
MODDIR=${0%/*}
|
|
||||||
|
|
||||||
# This script will be executed in post-fs-data mode
|
|
|
@ -1,3 +0,0 @@
|
||||||
# This file will be read by resetprop
|
|
||||||
# Example: Change dpi
|
|
||||||
# ro.sf.lcd_density=320
|
|
100
customize.sh
Executable file
100
customize.sh
Executable file
|
@ -0,0 +1,100 @@
|
||||||
|
##########################################################################################
|
||||||
|
#
|
||||||
|
# MMT Extended Config Script
|
||||||
|
#
|
||||||
|
##########################################################################################
|
||||||
|
|
||||||
|
##########################################################################################
|
||||||
|
# Config Flags
|
||||||
|
##########################################################################################
|
||||||
|
|
||||||
|
# Uncomment and change 'MINAPI' and 'MAXAPI' to the minimum and maximum android version for your mod
|
||||||
|
# Uncomment DYNLIB if you want libs installed to vendor for oreo+ and system for anything older
|
||||||
|
# Uncomment DEBUG if you want full debug logs (saved to /sdcard)
|
||||||
|
#MINAPI=21
|
||||||
|
#MAXAPI=25
|
||||||
|
#DYNLIB=true
|
||||||
|
|
||||||
|
##########################################################################################
|
||||||
|
# Replace list
|
||||||
|
##########################################################################################
|
||||||
|
|
||||||
|
# List all directories you want to directly replace in the system
|
||||||
|
# Check the documentations for more info why you would need this
|
||||||
|
|
||||||
|
# Construct your list in the following format
|
||||||
|
# This is an example
|
||||||
|
REPLACE_EXAMPLE="
|
||||||
|
/system/app/Youtube
|
||||||
|
/system/priv-app/SystemUI
|
||||||
|
/system/priv-app/Settings
|
||||||
|
/system/framework
|
||||||
|
"
|
||||||
|
|
||||||
|
# Construct your own list here
|
||||||
|
REPLACE="
|
||||||
|
"
|
||||||
|
|
||||||
|
##########################################################################################
|
||||||
|
# Permissions
|
||||||
|
##########################################################################################
|
||||||
|
|
||||||
|
set_permissions() {
|
||||||
|
set_perm $MODPATH/rclone 0 0 0755
|
||||||
|
set_perm $MODPATH/system/bin/fusermount 0 0 0755
|
||||||
|
set_perm $MODPATH/service.sh 0 0 0755
|
||||||
|
set_perm $MODPATH/system/bin/rclone 0 0 0755
|
||||||
|
set_perm $MODPATH/syncd.sh 0 0 0755
|
||||||
|
set_perm $MODPATH/inotifywait 0 0 0555
|
||||||
|
|
||||||
|
if [[ ! -e /system/bin/fusermount ]]; then
|
||||||
|
cp -af $MODPATH/system/bin/fusermount /system/bin/fusermount
|
||||||
|
set_perm /system/bin/fusermount 0 0 0755
|
||||||
|
fi
|
||||||
|
|
||||||
|
case $ARCH32 in
|
||||||
|
arm)
|
||||||
|
cp -af $MODPATH/system/lib/libandroid-support.so /system/lib/libandroid-support.so
|
||||||
|
set_perm /system/lib/libandroid-support.so 0 0 0755
|
||||||
|
if [ "$IS64BIT" = true ]; then
|
||||||
|
cp -af $MODPATH/system/lib64/libandroid-support.so /system/lib64/libandroid-support.so
|
||||||
|
set_perm /system/lib64/libandroid-support.so 0 0 0755
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
x86)
|
||||||
|
cp -af $MODPATH/system/lib/libandroid-support.so /system/lib/libandroid-support.so
|
||||||
|
set_perm /system/lib/libandroid-support.so 0 0 0755
|
||||||
|
if [ "$IS64BIT" = true ]; then
|
||||||
|
cp -af $MODPATH/system/lib64/libandroid-support.so $MODPATH/system/lib64/libandroid-support.so
|
||||||
|
set_perm /system/lib64/libandroid-support.so 0 0 0755
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [[ -e /sdcard/.rclone/rclone.conf ]]; then
|
||||||
|
export INTERACTIVE=1
|
||||||
|
ui_print "+ Attempting to mount your [Remotes]:"
|
||||||
|
ui_print "+ please wait..."
|
||||||
|
ui_print ""
|
||||||
|
MODDIR=$MODPATH $MODPATH/system/bin/rclone remount
|
||||||
|
else
|
||||||
|
ui_print "'/sdcard/.rclone/rclone.conf' not found!"
|
||||||
|
ui_print
|
||||||
|
ui_print "Additional setup required..."
|
||||||
|
ui_print "------------------------------------"
|
||||||
|
ui_print " Instructions: "
|
||||||
|
ui_print " - Open Terminal "
|
||||||
|
ui_print " - Type 'su' & tap enter "
|
||||||
|
ui_print " - Type 'rclone config' & tap enter "
|
||||||
|
ui_print " - Follow on screen options. "
|
||||||
|
ui_print "------------------------------------"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
##########################################################################################
|
||||||
|
# MMT Extended Logic - Don't modify anything after this
|
||||||
|
##########################################################################################
|
||||||
|
|
||||||
|
SKIPUNZIP=1
|
||||||
|
unzip -qjo "$ZIPFILE" 'common/functions.sh' -d $TMPDIR >&2
|
||||||
|
. $TMPDIR/functions.sh
|
218
install.sh
218
install.sh
|
@ -1,218 +0,0 @@
|
||||||
##########################################################################################
|
|
||||||
#
|
|
||||||
# Magisk Module Installer Script
|
|
||||||
#
|
|
||||||
##########################################################################################
|
|
||||||
##########################################################################################
|
|
||||||
#
|
|
||||||
# Instructions:
|
|
||||||
#
|
|
||||||
# 1. Place your files into system folder (delete the placeholder file)
|
|
||||||
# 2. Fill in your module's info into module.prop
|
|
||||||
# 3. Configure and implement callbacks in this file
|
|
||||||
# 4. If you need boot scripts, add them into common/post-fs-data.sh or common/service.sh
|
|
||||||
# 5. Add your additional or modified system properties into common/system.prop
|
|
||||||
#
|
|
||||||
##########################################################################################
|
|
||||||
|
|
||||||
##########################################################################################
|
|
||||||
# Config Flags
|
|
||||||
##########################################################################################
|
|
||||||
|
|
||||||
# Set to true if you do *NOT* want Magisk to mount
|
|
||||||
# any files for you. Most modules would NOT want
|
|
||||||
# to set this flag to true
|
|
||||||
SKIPMOUNT=true
|
|
||||||
|
|
||||||
# Set to true if you need to load system.prop
|
|
||||||
PROPFILE=false
|
|
||||||
|
|
||||||
# Set to true if you need post-fs-data script
|
|
||||||
POSTFSDATA=false
|
|
||||||
|
|
||||||
# Set to true if you need late_start service script
|
|
||||||
LATESTARTSERVICE=true
|
|
||||||
|
|
||||||
##########################################################################################
|
|
||||||
# Replace list
|
|
||||||
##########################################################################################
|
|
||||||
|
|
||||||
# List all directories you want to directly replace in the system
|
|
||||||
# Check the documentations for more info why you would need this
|
|
||||||
|
|
||||||
# Construct your list in the following format
|
|
||||||
# This is an example
|
|
||||||
REPLACE_EXAMPLE="
|
|
||||||
/system/app/Youtube
|
|
||||||
/system/priv-app/SystemUI
|
|
||||||
/system/priv-app/Settings
|
|
||||||
/system/framework
|
|
||||||
"
|
|
||||||
|
|
||||||
# Construct your own list here
|
|
||||||
REPLACE="
|
|
||||||
"
|
|
||||||
|
|
||||||
##########################################################################################
|
|
||||||
#
|
|
||||||
# Function Callbacks
|
|
||||||
#
|
|
||||||
# The following functions will be called by the installation framework.
|
|
||||||
# You do not have the ability to modify update-binary, the only way you can customize
|
|
||||||
# installation is through implementing these functions.
|
|
||||||
#
|
|
||||||
# When running your callbacks, the installation framework will make sure the Magisk
|
|
||||||
# internal busybox path is *PREPENDED* to PATH, so all common commands shall exist.
|
|
||||||
# Also, it will make sure /data, /system, and /vendor is properly mounted.
|
|
||||||
#
|
|
||||||
##########################################################################################
|
|
||||||
##########################################################################################
|
|
||||||
#
|
|
||||||
# The installation framework will export some variables and functions.
|
|
||||||
# You should use these variables and functions for installation.
|
|
||||||
#
|
|
||||||
# ! DO NOT use any Magisk internal paths as those are NOT public API.
|
|
||||||
# ! DO NOT use other functions in util_functions.sh as they are NOT public API.
|
|
||||||
# ! Non public APIs are not guranteed to maintain compatibility between releases.
|
|
||||||
#
|
|
||||||
# Available variables:
|
|
||||||
#
|
|
||||||
# MAGISK_VER (string): the version string of current installed Magisk
|
|
||||||
# MAGISK_VER_CODE (int): the version code of current installed Magisk
|
|
||||||
# BOOTMODE (bool): true if the module is currently installing in Magisk Manager
|
|
||||||
# MODPATH (path): the path where your module files should be installed
|
|
||||||
# TMPDIR (path): a place where you can temporarily store files
|
|
||||||
# ZIPFILE (path): your module's installation zip
|
|
||||||
# ARCH (string): the architecture of the device. Value is either arm, arm64, x86, or x64
|
|
||||||
# IS64BIT (bool): true if $ARCH is either arm64 or x64
|
|
||||||
# API (int): the API level (Android version) of the device
|
|
||||||
#
|
|
||||||
# Availible functions:
|
|
||||||
#
|
|
||||||
# ui_print <msg>
|
|
||||||
# print <msg> to console
|
|
||||||
# Avoid using 'echo' as it will not display in custom recovery's console
|
|
||||||
#
|
|
||||||
# abort <msg>
|
|
||||||
# print error message <msg> to console and terminate installation
|
|
||||||
# Avoid using 'exit' as it will skip the termination cleanup steps
|
|
||||||
#
|
|
||||||
# set_perm <target> <owner> <group> <permission> [context]
|
|
||||||
# if [context] is empty, it will default to "u:object_r:system_file:s0"
|
|
||||||
# this function is a shorthand for the following commands
|
|
||||||
# chown owner.group target
|
|
||||||
# chmod permission target
|
|
||||||
# chcon context target
|
|
||||||
#
|
|
||||||
# set_perm_recursive <directory> <owner> <group> <dirpermission> <filepermission> [context]
|
|
||||||
# if [context] is empty, it will default to "u:object_r:system_file:s0"
|
|
||||||
# for all files in <directory>, it will call:
|
|
||||||
# set_perm file owner group filepermission context
|
|
||||||
# for all directories in <directory> (including itself), it will call:
|
|
||||||
# set_perm dir owner group dirpermission context
|
|
||||||
#
|
|
||||||
##########################################################################################
|
|
||||||
##########################################################################################
|
|
||||||
# If you need boot scripts, DO NOT use general boot scripts (post-fs-data.d/service.d)
|
|
||||||
# ONLY use module scripts as it respects the module status (remove/disable) and is
|
|
||||||
# guaranteed to maintain the same behavior in future Magisk releases.
|
|
||||||
# Enable boot scripts by setting the flags in the config section above.
|
|
||||||
##########################################################################################
|
|
||||||
|
|
||||||
# Set what you want to display when installing your module
|
|
||||||
|
|
||||||
print_modname() {
|
|
||||||
ui_print " "
|
|
||||||
ui_print "*******************************"
|
|
||||||
ui_print "* rclone-mount *"
|
|
||||||
ui_print "* Magisk Module *"
|
|
||||||
ui_print "* by: piyushgarg *"
|
|
||||||
ui_print "*******************************"
|
|
||||||
ui_print "*rclone: (v1.48.0) mod: (v1.8)*"
|
|
||||||
ui_print "*******************************"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Copy/extract your module files into $MODPATH in on_install.
|
|
||||||
|
|
||||||
on_install() {
|
|
||||||
# The following is the default implementation: extract $ZIPFILE/system to $MODPATH
|
|
||||||
# Extend/change the logic to whatever you want
|
|
||||||
|
|
||||||
if [ "$ARCH" == "arm" ];then
|
|
||||||
BINARY_PATH=$TMPDIR/binary/rclone-arm
|
|
||||||
elif [ "$ARCH" == "arm64" ];then
|
|
||||||
BINARY_PATH=$TMPDIR/binary/rclone-arm64
|
|
||||||
elif [ "$ARCH" == "x86" ];then
|
|
||||||
BINARY_PATH=$TMPDIR/binary/rclone-x86
|
|
||||||
elif [ "$ARCH" == "x64" ];then
|
|
||||||
BINARY_PATH=$TMPDIR/binary/rclone-x64
|
|
||||||
fi
|
|
||||||
|
|
||||||
CONFIG_PATH=$TMPDIR/config
|
|
||||||
|
|
||||||
ui_print "* Detected arch: $ARCH"
|
|
||||||
ui_print "+ Extracting package contents..."
|
|
||||||
|
|
||||||
ui_print "+ Extracting rclone-$ARCH to $MODPATH/rclone"
|
|
||||||
unzip -p "$ZIPFILE" binary/rclone-arm > $MODPATH/rclone
|
|
||||||
ui_print "+ Extracting fusermount-$ARCH to $MODPATH/fusermount"
|
|
||||||
unzip -p "$ZIPFILE" binary/fusermount-${ARCH} > $MODPATH/fusermount
|
|
||||||
ui_print "+ Extracting lib-${ARCH}/libandroid-support.so to $MODPATH/libandroid-support.so"
|
|
||||||
unzip -p "$ZIPFILE" lib-${ARCH}/libandroid-support.so > $MODPATH/libandroid-support.so
|
|
||||||
ui_print "+ Extracting rclone-wrapper.sh script to $MODPATH/rclone-wrapper.sh"
|
|
||||||
unzip -p "$ZIPFILE" binary/rclone-wrapper.sh > $MODPATH/rclone-wrapper.sh
|
|
||||||
ui_print "+ Extracting fusermount-wrapper.sh script to $MODPATH/fusermount-wrapper.sh"
|
|
||||||
unzip -p "$ZIPFILE" binary/fusermount-wrapper.sh > $MODPATH/fusermount-wrapper.sh
|
|
||||||
ui_print "+ Extracting syncd.sh script to $MODPATH/syncd.sh"
|
|
||||||
unzip -p "$ZIPFILE" binary/syncd.sh > $MODPATH/syncd.sh
|
|
||||||
ui_print "+ Extracting inotifywait-${ARCH} to $MODPATH/inotifywait"
|
|
||||||
unzip -p "$ZIPFILE" binary/inotifywait-${ARCH} > $MODPATH/inotifywait
|
|
||||||
}
|
|
||||||
|
|
||||||
# Only some special files require specific permissions
|
|
||||||
# This function will be called after on_install is done
|
|
||||||
# The default permissions should be good enough for most cases
|
|
||||||
|
|
||||||
|
|
||||||
set_permissions() {
|
|
||||||
# The following is the default rule, DO NOT remove
|
|
||||||
set_perm_recursive $MODPATH 0 0 0755 0644
|
|
||||||
set_perm $MODPATH/rclone 0 0 0755
|
|
||||||
set_perm $MODPATH/fusermount 0 0 0755
|
|
||||||
set_perm $MODPATH/fusermount-wrapper.sh 0 0 0755
|
|
||||||
set_perm $MODPATH/service.sh 0 0 0755
|
|
||||||
set_perm $MODPATH/rclone-wrapper.sh 0 0 0755
|
|
||||||
set_perm $MODPATH/syncd.sh 0 0 0755
|
|
||||||
set_perm $MODPATH/inotifywait 0 0 0555
|
|
||||||
|
|
||||||
ln -sf $MODPATH/rclone /sbin/rclone
|
|
||||||
ln -sf $MODPATH/rclone-wrapper.sh /sbin/rclonew
|
|
||||||
ln -sf $MODPATH/fusermount /sbin/fusermount
|
|
||||||
|
|
||||||
ui_print "✓ Now no need to reboot..."
|
|
||||||
ui_print "+ Attempting to mount your [Remotes]:"
|
|
||||||
ui_print "+ please wait..."
|
|
||||||
ui_print ""
|
|
||||||
|
|
||||||
if [[ -e /sdcard/.rclone/rclone.conf ]]; then
|
|
||||||
|
|
||||||
export INTERACTIVE=1
|
|
||||||
$MODPATH/rclone-wrapper.sh remount
|
|
||||||
|
|
||||||
else
|
|
||||||
|
|
||||||
echo "'/sdcard/.rclone/rclone.conf' not found"
|
|
||||||
echo
|
|
||||||
echo "Additional setup required..."
|
|
||||||
echo "Please run rclone config in su terminal"
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Here are some examples:
|
|
||||||
# set_perm_recursive $MODPATH/system/lib 0 0 0755 0644
|
|
||||||
# set_perm $MODPATH/system/bin/app_process32 0 2000 0755 u:object_r:zygote_exec:s0
|
|
||||||
# set_perm $MODPATH/system/bin/dex2oat 0 2000 0755 u:object_r:dex2oat_exec:s0
|
|
||||||
# set_perm $MODPATH/system/lib/libart.so 0 0 0644
|
|
||||||
}
|
|
||||||
|
|
||||||
# You can add more functions to assist your custom script code
|
|
Binary file not shown.
Binary file not shown.
14
module.prop
Normal file → Executable file
14
module.prop
Normal file → Executable file
|
@ -1,8 +1,6 @@
|
||||||
id=com.piyushgarg.rclone
|
id=rclone.mount
|
||||||
name=rclone-mount
|
name=Cloud Storage Mounter (forked from rclone-mount)
|
||||||
modVer=1.13
|
version=rclone: (v1.55.0) mod: (v1.14)
|
||||||
BinVer=1.53.0
|
versionCode=114
|
||||||
version=rclone: (v1.53.0) mod: (v1.13)
|
author=AvinashReddy3108 (OG: piyushgarg)
|
||||||
versionCode=113
|
description=Mount and sync your cloud storage on your device using 'rclone' & 'fusermount', providing virtually limitless storage expansion with support for dozens of cloud providers and extensive customization options.
|
||||||
author=piyushgarg @ github.com
|
|
||||||
description=Mount cloud storage locally using rclone & fusermount. Virtually limitless storage expansion with support for dozens of cloud providers. Extremely useful for streaming large media files without need for full caching. Binaries obtained directly from rclone.org. Please refer to README.md for more info.
|
|
||||||
|
|
|
@ -1,60 +1,12 @@
|
||||||
#!/system/bin/sh
|
#!/system/bin/sh
|
||||||
|
|
||||||
# Do NOT assume where your module will be located.
|
# Do NOT assume where your module will be located.
|
||||||
# ALWAYS use $MODDIR if you need to know where this script
|
# ALWAYS use $MODDIR if you need to know where this script
|
||||||
# and module is placed.
|
# and module is placed.
|
||||||
# This will make sure your module will work
|
# This will make sure your module will work
|
||||||
# if Magisk changes it's mount point in the future
|
# if Magisk changes it's mount point in the future
|
||||||
|
|
||||||
PATH=/system/bin:/sbin:/sbin/.core/busybox:/system/xbin
|
# MODULE VARS
|
||||||
|
|
||||||
MODDIR="$(dirname "$(readlink -f "$0")")"
|
|
||||||
|
|
||||||
IMGDIR=/sbin/.core/img
|
|
||||||
UPDDIR=/data/adb/modules_update
|
|
||||||
id=com.piyushgarg.rclone
|
|
||||||
|
|
||||||
## resolve links - $0 may be a link to module home
|
|
||||||
PRG="$0"
|
|
||||||
|
|
||||||
# need this for relative symlinks
|
|
||||||
while [ -h "$PRG" ] ; do
|
|
||||||
ls=`ls -ld "$PRG"`
|
|
||||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
|
||||||
if expr "$link" : '/.*' > /dev/null; then
|
|
||||||
PRG="$link"
|
|
||||||
else
|
|
||||||
PRG="`dirname "$PRG"`/$link"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
saveddir=`pwd`
|
|
||||||
MODDIR2=`dirname "$PRG"`
|
|
||||||
# make it fully qualified
|
|
||||||
MODDIR2=`cd "$MODIR2" && pwd`
|
|
||||||
cd "$saveddir"
|
|
||||||
#echo 3 $MODDIR2
|
|
||||||
|
|
||||||
if [ -e ${UPDDIR}/${id}/rclone ]; then
|
|
||||||
HOME=${UPDDIR}/${id}
|
|
||||||
|
|
||||||
elif [ -e ${IMGDIR}/${id}/rclone ]; then
|
|
||||||
HOME=${IMGDIR}/${id}
|
|
||||||
|
|
||||||
elif [ -e ${MODDIR2}/${id}/rclone ]; then
|
|
||||||
HOME=${MODDIR2}/${id}
|
|
||||||
|
|
||||||
else
|
|
||||||
HOME=${MODDIR}
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo $HOME
|
|
||||||
|
|
||||||
ln -sf ${HOME}/rclone /sbin/rclone
|
|
||||||
ln -sf ${HOME}/fusermount /sbin/fusermount
|
|
||||||
ln -sf ${HOME}/rclone-wrapper.sh /sbin/rclonew
|
|
||||||
|
|
||||||
#MODULE VARS
|
|
||||||
SYSBIN=/system/bin
|
|
||||||
CLOUDROOTMOUNTPOINT=/mnt/cloud
|
CLOUDROOTMOUNTPOINT=/mnt/cloud
|
||||||
USER_CONFDIR=/sdcard/.rclone
|
USER_CONFDIR=/sdcard/.rclone
|
||||||
USER_CONF=${USER_CONFDIR}/rclone.conf
|
USER_CONF=${USER_CONFDIR}/rclone.conf
|
||||||
|
@ -71,8 +23,8 @@ DISABLE=0
|
||||||
NETCHK=1
|
NETCHK=1
|
||||||
NETCHK_ADDR=google.com
|
NETCHK_ADDR=google.com
|
||||||
|
|
||||||
#RCLONE PARAMETERS
|
# DEFAULT RCLONE PARAMETERS
|
||||||
CONFIGFILE=${HOME}/.config/rclone/rclone.conf
|
CONFIGFILE=${MODDIR}/.config/rclone/rclone.conf
|
||||||
LOGFILE=${USER_CONFDIR}/rclone.log
|
LOGFILE=${USER_CONFDIR}/rclone.log
|
||||||
LOGLEVEL=NOTICE
|
LOGLEVEL=NOTICE
|
||||||
CACHE=/data/rclone/cache
|
CACHE=/data/rclone/cache
|
||||||
|
@ -106,138 +58,82 @@ SFTP_ADDR=127.0.0.1:38722
|
||||||
SFTP_USER=
|
SFTP_USER=
|
||||||
SFTP_PASS=
|
SFTP_PASS=
|
||||||
|
|
||||||
|
|
||||||
if [[ -z ${INTERACTIVE} ]]; then
|
if [[ -z ${INTERACTIVE} ]]; then
|
||||||
|
|
||||||
INTERACTIVE=0
|
INTERACTIVE=0
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ! -d ${HOME}/.config/rclone ]]; then
|
if [[ ! -d ${MODDIR}/.config/rclone ]]; then
|
||||||
|
mkdir -p ${MODDIR}/.config/rclone
|
||||||
mkdir -p ${HOME}/.config/rclone
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
custom_params () {
|
custom_params () {
|
||||||
|
|
||||||
if [[ ${remote} = global ]]; then
|
if [[ ${remote} = global ]]; then
|
||||||
|
|
||||||
PARAMS="DISABLE LOGFILE LOGLEVEL CACHEMODE CHUNKSIZE CHUNKTOTAL CACHEWORKERS CACHEINFOAGE DIRCACHETIME ATTRTIMEOUT BUFFERSIZE READAHEAD M_UID M_GID DIRPERMS FILEPERMS READONLY BINDSD ADD_PARAMS REPLACE_PARAMS NETCHK NETCHK_IF NETCHK_ADDR HTTP FTP HTTP_ADDR FTP_ADDR SFTP SFTP_ADDR SFTP_USER SFTP_PASS PROFILE ISOLATE"
|
PARAMS="DISABLE LOGFILE LOGLEVEL CACHEMODE CHUNKSIZE CHUNKTOTAL CACHEWORKERS CACHEINFOAGE DIRCACHETIME ATTRTIMEOUT BUFFERSIZE READAHEAD M_UID M_GID DIRPERMS FILEPERMS READONLY BINDSD ADD_PARAMS REPLACE_PARAMS NETCHK NETCHK_IF NETCHK_ADDR HTTP FTP HTTP_ADDR FTP_ADDR SFTP SFTP_ADDR SFTP_USER SFTP_PASS PROFILE ISOLATE"
|
||||||
|
|
||||||
else
|
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 SUBPATH"
|
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
|
fi
|
||||||
|
|
||||||
BAD_SYNTAX="(^\s*#|^\s*$|^\s*[a-z_][^[:space:]]*=[^;&\(\`]*$)"
|
BAD_SYNTAX="(^\s*#|^\s*$|^\s*[a-z_][^[:space:]]*=[^;&\(\`]*$)"
|
||||||
|
|
||||||
if [[ -e ${USER_CONFDIR}/.${remote}.param ]]; then
|
if [[ -e ${USER_CONFDIR}/.${remote}.param ]]; then
|
||||||
|
|
||||||
echo "Found .${remote}.param"
|
echo "Found .${remote}.param"
|
||||||
|
|
||||||
if ! [[ $(egrep -q -iv "${BAD_SYNTAX}" ${USER_CONFDIR}/.${remote}.param) ]]; then
|
if ! [[ $(egrep -q -iv "${BAD_SYNTAX}" ${USER_CONFDIR}/.${remote}.param) ]]; then
|
||||||
|
|
||||||
echo "loading .${remote}.param"
|
echo "loading .${remote}.param"
|
||||||
|
|
||||||
# FIX: Unnecessary and very inefficient double loop
|
# FIX: Unnecessary and very inefficient double loop
|
||||||
for PARAM in ${PARAMS[@]}; do
|
for PARAM in ${PARAMS[@]}; do
|
||||||
|
|
||||||
while read -r VAR; do
|
while read -r VAR; do
|
||||||
|
|
||||||
if [[ "$(echo "${VAR}" |grep "$PARAM=")" ]]; then
|
if [[ "$(echo "${VAR}" |grep "$PARAM=")" ]]; then
|
||||||
echo "Importing ${VAR}"
|
echo "Importing ${VAR}"
|
||||||
VALUE="$(echo ${VAR} |cut -d '=' -f2)"
|
VALUE="$(echo ${VAR} |cut -d '=' -f2)"
|
||||||
|
|
||||||
VALUE=\"${VALUE}\"
|
VALUE=\"${VALUE}\"
|
||||||
|
# Unnecessary echo in a subshell execution below? Why not just:
|
||||||
# Unnecessary echo in a subshell execution below? Why not just:
|
|
||||||
# eval "${PARAM}""=""${VALUE}"
|
# eval "${PARAM}""=""${VALUE}"
|
||||||
eval $(echo "${PARAM}""=""${VALUE}")
|
eval $(echo "${PARAM}""=""${VALUE}")
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
done < ${USER_CONFDIR}/.${remote}.param
|
done < ${USER_CONFDIR}/.${remote}.param
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
echo ".${remote}.param contains bad syntax"
|
echo ".${remote}.param contains bad syntax"
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
global_params () {
|
global_params () {
|
||||||
|
|
||||||
remote=global
|
remote=global
|
||||||
custom_params
|
custom_params
|
||||||
unset remote
|
unset remote
|
||||||
echo
|
echo
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
net_chk() {
|
net_chk() {
|
||||||
|
|
||||||
if [ -z ${NETCHK_IF} ]; then
|
if [ -z ${NETCHK_IF} ]; then
|
||||||
|
|
||||||
NETCHK_IF=" "
|
NETCHK_IF=" "
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
NETCHK_IF=" -I ${NETCHK_IF} "
|
NETCHK_IF=" -I ${NETCHK_IF} "
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ping ${NETCHK_IF} -c 5 ${NETCHK_ADDR}
|
ping ${NETCHK_IF} -c 5 ${NETCHK_ADDR}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sd_unbind () {
|
sd_unbind () {
|
||||||
|
|
||||||
if [[ -z ${SDBINDPOINT} ]]; then
|
if [[ -z ${SDBINDPOINT} ]]; then
|
||||||
|
|
||||||
UNBINDPOINT=${BINDPOINT_D}/${remote}
|
UNBINDPOINT=${BINDPOINT_D}/${remote}
|
||||||
|
|
||||||
su -M -c umount -lf ${UNBINDPOINT} >> /dev/null 2>&1
|
su -M -c umount -lf ${UNBINDPOINT} >> /dev/null 2>&1
|
||||||
|
|
||||||
UNBINDPOINT=${BINDPOINT_R}/${remote}
|
UNBINDPOINT=${BINDPOINT_R}/${remote}
|
||||||
|
|
||||||
su -M -c umount -lf ${UNBINDPOINT} >> /dev/null 2>&1
|
su -M -c umount -lf ${UNBINDPOINT} >> /dev/null 2>&1
|
||||||
|
|
||||||
UNBINDPOINT=${BINDPOINT_W}/${remote}
|
UNBINDPOINT=${BINDPOINT_W}/${remote}
|
||||||
|
|
||||||
su -M -c umount -lf ${UNBINDPOINT} >> /dev/null 2>&1
|
su -M -c umount -lf ${UNBINDPOINT} >> /dev/null 2>&1
|
||||||
|
else
|
||||||
else
|
|
||||||
|
|
||||||
USER_BINDPOINT=${SDBINDPOINT}
|
USER_BINDPOINT=${SDBINDPOINT}
|
||||||
|
|
||||||
UNBINDPOINT=${RUNTIME_D}/emulated/${PROFILE}/${USER_BINDPOINT}
|
UNBINDPOINT=${RUNTIME_D}/emulated/${PROFILE}/${USER_BINDPOINT}
|
||||||
|
|
||||||
su -M -c umount -lf ${UNBINDPOINT} >> /dev/null 2>&1
|
su -M -c umount -lf ${UNBINDPOINT} >> /dev/null 2>&1
|
||||||
|
|
||||||
UNBINDPOINT=${RUNTIME_R}/emulated/${PROFILE}/${USER_BINDPOINT}
|
UNBINDPOINT=${RUNTIME_R}/emulated/${PROFILE}/${USER_BINDPOINT}
|
||||||
|
|
||||||
su -M -c umount -lf ${UNBINDPOINT} >> /dev/null 2>&1
|
su -M -c umount -lf ${UNBINDPOINT} >> /dev/null 2>&1
|
||||||
|
|
||||||
UNBINDPOINT=${RUNTIME_W}/emulated/${PROFILE}/${USER_BINDPOINT}
|
UNBINDPOINT=${RUNTIME_W}/emulated/${PROFILE}/${USER_BINDPOINT}
|
||||||
|
|
||||||
su -M -c umount -lf ${UNBINDPOINT} >> /dev/null 2>&1
|
su -M -c umount -lf ${UNBINDPOINT} >> /dev/null 2>&1
|
||||||
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sd_binder () {
|
sd_binder () {
|
||||||
|
|
||||||
if [[ -d ${RUNTIME_D} ]] && [[ ${BINDSD} = 1 ]]; then
|
if [[ -d ${RUNTIME_D} ]] && [[ ${BINDSD} = 1 ]]; then
|
||||||
|
if [[ -z ${SDBINDPOINT} ]]; then
|
||||||
if [[ -z ${SDBINDPOINT} ]]; then
|
|
||||||
|
|
||||||
mkdir -p ${DATA_MEDIA}/${PROFILE}/Cloud/${remote}
|
mkdir -p ${DATA_MEDIA}/${PROFILE}/Cloud/${remote}
|
||||||
chown media_rw:media_rw ${DATA_MEDIA}/${PROFILE}/Cloud/$remote
|
chown media_rw:media_rw ${DATA_MEDIA}/${PROFILE}/Cloud/$remote
|
||||||
|
|
||||||
|
@ -248,23 +144,17 @@ sd_binder () {
|
||||||
BINDPOINT=${BINDPOINT_R}/${remote}
|
BINDPOINT=${BINDPOINT_R}/${remote}
|
||||||
|
|
||||||
if ! mount |grep -q ${BINDPOINT}; then
|
if ! mount |grep -q ${BINDPOINT}; then
|
||||||
|
|
||||||
su -M -c mount --bind ${CLOUDROOTMOUNTPOINT}/${remote} ${BINDPOINT} >> /dev/null 2>&1
|
su -M -c mount --bind ${CLOUDROOTMOUNTPOINT}/${remote} ${BINDPOINT} >> /dev/null 2>&1
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
BINDPOINT=${BINDPOINT_W}/${remote}
|
BINDPOINT=${BINDPOINT_W}/${remote}
|
||||||
|
|
||||||
if ! mount |grep -q ${BINDPOINT}; then
|
if ! mount |grep -q ${BINDPOINT}; then
|
||||||
|
su -M -c mount --bind ${CLOUDROOTMOUNTPOINT}/${remote} ${BINDPOINT} >> /dev/null 2>&1
|
||||||
su -M -c mount --bind ${CLOUDROOTMOUNTPOINT}/${remote} ${BINDPOINT} >> /dev/null 2>&1
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "[$remote] available at: -> [/sdcard/Cloud/${remote}]"
|
echo "[$remote] available at: -> [/sdcard/Cloud/${remote}]"
|
||||||
|
else
|
||||||
else
|
|
||||||
|
|
||||||
mkdir ${DATA_MEDIA}/${PROFILE}/${SDBINDPOINT} >> /dev/null 2>&1
|
mkdir ${DATA_MEDIA}/${PROFILE}/${SDBINDPOINT} >> /dev/null 2>&1
|
||||||
chown media_rw:media_rw ${DATA_MEDIA}/${PROFILE}/${SDBINDPOINT}
|
chown media_rw:media_rw ${DATA_MEDIA}/${PROFILE}/${SDBINDPOINT}
|
||||||
|
|
||||||
|
@ -276,63 +166,45 @@ sd_binder () {
|
||||||
BINDPOINT=${RUNTIME_R}/emulated/${PROFILE}/${USER_BINDPOINT}
|
BINDPOINT=${RUNTIME_R}/emulated/${PROFILE}/${USER_BINDPOINT}
|
||||||
|
|
||||||
if ! mount |grep -q ${BINDPOINT}; then
|
if ! mount |grep -q ${BINDPOINT}; then
|
||||||
|
|
||||||
su -M -c mount --bind ${CLOUDROOTMOUNTPOINT}/${remote} ${BINDPOINT} >> /dev/null 2>&1
|
su -M -c mount --bind ${CLOUDROOTMOUNTPOINT}/${remote} ${BINDPOINT} >> /dev/null 2>&1
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
BINDPOINT=${RUNTIME_W}/emulated/${PROFILE}/${USER_BINDPOINT}
|
BINDPOINT=${RUNTIME_W}/emulated/${PROFILE}/${USER_BINDPOINT}
|
||||||
|
|
||||||
if ! mount |grep -q ${BINDPOINT}; then
|
if ! mount |grep -q ${BINDPOINT}; then
|
||||||
|
|
||||||
su -M -c mount --bind ${CLOUDROOTMOUNTPOINT}/${remote} ${BINDPOINT} >> /dev/null 2>&1
|
su -M -c mount --bind ${CLOUDROOTMOUNTPOINT}/${remote} ${BINDPOINT} >> /dev/null 2>&1
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "[$remote] available at: -> [/storage/emulated/${PROFILE}/${SDBINDPOINT}]"
|
echo "[$remote] available at: -> [/storage/emulated/${PROFILE}/${SDBINDPOINT}]"
|
||||||
|
|
||||||
unset BINDPOINT
|
unset BINDPOINT
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
syncd_service () {
|
syncd_service () {
|
||||||
|
|
||||||
if [[ ! -z ${SDSYNCDIRS} ]]; then
|
if [[ ! -z ${SDSYNCDIRS} ]]; then
|
||||||
|
export PIDFILE=${MODDIR}/.tmp/${remote}-syncd.pids
|
||||||
export PIDFILE=${HOME}/.tmp/${remote}-syncd.pids
|
|
||||||
|
|
||||||
kill -9 $(cat ${PIDFILE}) >> /dev/null 2>&1
|
kill -9 $(cat ${PIDFILE}) >> /dev/null 2>&1
|
||||||
rm ${PIDFILE} >> /dev/null 2>&1
|
rm ${PIDFILE} >> /dev/null 2>&1
|
||||||
|
|
||||||
if [[ ! -d ${HOME}/.tmp ]]; then
|
if [[ ! -d ${MODDIR}/.tmp ]]; then
|
||||||
|
mkdir -p ${MODDIR}/.tmp
|
||||||
mkdir -p ${HOME}/.tmp
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export PATH
|
export CLOUDROOTMOUNTPOINT
|
||||||
export CLOUDROOTMOUNTPOINT
|
export PROFILE
|
||||||
export PROFILE
|
export MODDIR
|
||||||
export HOME
|
export remote
|
||||||
export remote
|
export SYNCWIFI
|
||||||
export SYNCWIFI
|
export SYNC_BATTLVL
|
||||||
export SYNC_BATTLVL
|
export SYNC_CHARGE
|
||||||
export SYNC_CHARGE
|
export NETCHK_ADDR
|
||||||
export NETCHK_ADDR
|
|
||||||
|
|
||||||
IFS=$':'
|
IFS=$':'
|
||||||
|
|
||||||
for SYNCDIR in ${SDSYNCDIRS[@]}; do
|
for SYNCDIR in ${SDSYNCDIRS[@]}; do
|
||||||
|
|
||||||
export SYNCDIR
|
export SYNCDIR
|
||||||
|
${MODDIR}/syncd.sh >> /dev/null 2>&1 &
|
||||||
${HOME}/syncd.sh >> /dev/null 2>&1 &
|
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
unset IFS
|
unset IFS
|
||||||
|
@ -341,11 +213,9 @@ syncd_service () {
|
||||||
SYNC_BATTLVL=0
|
SYNC_BATTLVL=0
|
||||||
SYNC_WIFI=1
|
SYNC_WIFI=1
|
||||||
SYNC_CHARGE=0
|
SYNC_CHARGE=0
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
reset_params () {
|
reset_params () {
|
||||||
|
|
||||||
unset IFS
|
unset IFS
|
||||||
unset SDBINDPOINT
|
unset SDBINDPOINT
|
||||||
unset BINDSD
|
unset BINDSD
|
||||||
|
@ -379,268 +249,177 @@ reset_params () {
|
||||||
SYNC_WIFI=1
|
SYNC_WIFI=1
|
||||||
SYNC_BATTLVL=0
|
SYNC_BATTLVL=0
|
||||||
SYNC_CHARGE=0
|
SYNC_CHARGE=0
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rclone_mount () {
|
rclone_mount () {
|
||||||
|
|
||||||
if [[ ${READONLY} = 1 ]]; then
|
if [[ ${READONLY} = 1 ]]; then
|
||||||
|
|
||||||
READONLY=" --read-only "
|
READONLY=" --read-only "
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
READONLY=" "
|
READONLY=" "
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ${ADD_PARAMS} = 0 ]]; then
|
if [[ ${ADD_PARAMS} = 0 ]]; then
|
||||||
|
|
||||||
unset ADD_PARAMS
|
unset ADD_PARAMS
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ${REPLACE_PARAMS} = 0 ]]; then
|
if [[ ${REPLACE_PARAMS} = 0 ]]; then
|
||||||
|
|
||||||
unset REPLACE_PARAMS
|
unset REPLACE_PARAMS
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z ${REPLACE_PARAMS} ]]; then
|
if [[ -z ${REPLACE_PARAMS} ]]; then
|
||||||
|
|
||||||
RCLONE_PARAMS=" --log-file ${LOGFILE} --log-level ${LOGLEVEL} --vfs-cache-mode ${CACHEMODE} --cache-dir ${CACHE} --cache-chunk-path ${CACHE_BACKEND} --cache-db-path ${CACHE_BACKEND} --cache-tmp-upload-path ${CACHE} --vfs-read-chunk-size ${READCHUNKSIZE} --vfs-cache-max-size ${CACHEMAXSIZE} --cache-chunk-size ${CHUNKSIZE} --cache-chunk-total-size ${CHUNKTOTAL} --cache-workers ${CACHEWORKERS} --cache-info-age ${CACHEINFOAGE} --dir-cache-time ${DIRCACHETIME} --attr-timeout ${ATTRTIMEOUT} --cache-chunk-no-memory --use-mmap --buffer-size ${BUFFERSIZE} --max-read-ahead ${READAHEAD} --no-modtime --no-checksum --uid ${M_UID} --gid ${M_GID} --allow-other --dir-perms ${DIRPERMS} --file-perms ${FILEPERMS} --umask ${UMASK} ${READONLY} ${ADD_PARAMS} "
|
RCLONE_PARAMS=" --log-file ${LOGFILE} --log-level ${LOGLEVEL} --vfs-cache-mode ${CACHEMODE} --cache-dir ${CACHE} --cache-chunk-path ${CACHE_BACKEND} --cache-db-path ${CACHE_BACKEND} --cache-tmp-upload-path ${CACHE} --vfs-read-chunk-size ${READCHUNKSIZE} --vfs-cache-max-size ${CACHEMAXSIZE} --cache-chunk-size ${CHUNKSIZE} --cache-chunk-total-size ${CHUNKTOTAL} --cache-workers ${CACHEWORKERS} --cache-info-age ${CACHEINFOAGE} --dir-cache-time ${DIRCACHETIME} --attr-timeout ${ATTRTIMEOUT} --cache-chunk-no-memory --use-mmap --buffer-size ${BUFFERSIZE} --max-read-ahead ${READAHEAD} --no-modtime --no-checksum --uid ${M_UID} --gid ${M_GID} --allow-other --dir-perms ${DIRPERMS} --file-perms ${FILEPERMS} --umask ${UMASK} ${READONLY} ${ADD_PARAMS} "
|
||||||
|
|
||||||
elif [[ ! -z ${REPLACE_PARAMS} ]]; then
|
elif [[ ! -z ${REPLACE_PARAMS} ]]; then
|
||||||
|
|
||||||
RCLONE_PARAMS=" ${REPLACE_PARAMS} "
|
RCLONE_PARAMS=" ${REPLACE_PARAMS} "
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z ${ADD_PARAMS} ]]; then
|
if [[ -z ${ADD_PARAMS} ]]; then
|
||||||
|
|
||||||
ADD_PARAMS=" "
|
ADD_PARAMS=" "
|
||||||
|
|
||||||
elif [[ ! -z ${ADD_PARAMS} ]]; then
|
elif [[ ! -z ${ADD_PARAMS} ]]; then
|
||||||
|
|
||||||
ADD_PARAMS=" ${ADD_PARAMS} "
|
ADD_PARAMS=" ${ADD_PARAMS} "
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "[${remote}] available at: -> [${CLOUDROOTMOUNTPOINT}/${remote}]"
|
echo "[${remote}] available at: -> [${CLOUDROOTMOUNTPOINT}/${remote}]"
|
||||||
|
|
||||||
mkdir -p ${CLOUDROOTMOUNTPOINT}/${remote}
|
mkdir -p ${CLOUDROOTMOUNTPOINT}/${remote}
|
||||||
|
su -M -p -c nice -n 19 ionice -c 2 -n 7 ${MODDIR}/rclone mount "${remote}:${SUBPATH}" ${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 &
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
COUNT=0
|
COUNT=0
|
||||||
|
|
||||||
if [[ ${INTERACTIVE} = 0 ]]; then
|
if [[ ${INTERACTIVE} = 0 ]]; then
|
||||||
|
|
||||||
until [[ $(getprop sys.boot_completed) = 1 ]] && [[ $(getprop dev.bootcomplete) = 1 ]] && [[ $(getprop init.svc.bootanim) = stopped ]] && [[ -e ${USER_CONF} ]] || [[ ${COUNT} -eq 240 ]]; do
|
until [[ $(getprop sys.boot_completed) = 1 ]] && [[ $(getprop dev.bootcomplete) = 1 ]] && [[ $(getprop init.svc.bootanim) = stopped ]] && [[ -e ${USER_CONF} ]] || [[ ${COUNT} -eq 240 ]]; do
|
||||||
|
|
||||||
sleep 5
|
sleep 5
|
||||||
((++COUNT))
|
((++COUNT))
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
DECRYPT_CHK () {
|
DECRYPT_CHK () {
|
||||||
|
|
||||||
su -M -c ls sdcard |grep -q -w "Android"
|
su -M -c ls sdcard |grep -q -w "Android"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if [[ ${COUNT} -eq 240 ]] || [[ ! -d /sdcard/Android ]]; then
|
if [[ ${COUNT} -eq 240 ]] || [[ ! -d /sdcard/Android ]]; then
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ! -d ${USER_CONFDIR} ]]; then
|
if [[ ! -d ${USER_CONFDIR} ]]; then
|
||||||
|
|
||||||
mkdir ${USER_CONFDIR}
|
mkdir ${USER_CONFDIR}
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -e ${USER_CONFDIR}/.disable ]] && [[ ${INTERACTIVE} = 0 ]]; then
|
if [[ -e ${USER_CONFDIR}/.disable ]] && [[ ${INTERACTIVE} = 0 ]]; then
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ${INTERACTIVE} = 0 ]]; then
|
if [[ ${INTERACTIVE} = 0 ]]; then
|
||||||
|
|
||||||
export INTERACTIVE=1
|
export INTERACTIVE=1
|
||||||
|
${MODDIR}/service.sh
|
||||||
${HOME}/service.sh
|
|
||||||
|
|
||||||
exit
|
exit
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
global_params
|
global_params
|
||||||
|
|
||||||
if [[ ! -d ${CLOUDROOTMOUNTPOINT} ]]; then
|
if [[ ! -d ${CLOUDROOTMOUNTPOINT} ]]; then
|
||||||
|
|
||||||
mkdir -p ${CLOUDROOTMOUNTPOINT}
|
mkdir -p ${CLOUDROOTMOUNTPOINT}
|
||||||
chown root:sdcard_rw ${CLOUDROOTMOUNTPOINT}
|
chown root:sdcard_rw ${CLOUDROOTMOUNTPOINT}
|
||||||
touch ${CLOUDROOTMOUNTPOINT}/.nomedia
|
touch ${CLOUDROOTMOUNTPOINT}/.nomedia
|
||||||
chown root:sdcard_rw ${CLOUDROOTMOUNTPOINT}/.nomedia
|
chown root:sdcard_rw ${CLOUDROOTMOUNTPOINT}/.nomedia
|
||||||
chmod 0775 ${CLOUDROOTMOUNTPOINT}/.nomedia
|
chmod 0775 ${CLOUDROOTMOUNTPOINT}/.nomedia
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ! -e ${CLOUDROOTMOUNTPOINT}/.nomedia ]]; then
|
if [[ ! -e ${CLOUDROOTMOUNTPOINT}/.nomedia ]]; then
|
||||||
|
|
||||||
touch ${CLOUDROOTMOUNTPOINT}/.nomedia
|
touch ${CLOUDROOTMOUNTPOINT}/.nomedia
|
||||||
chown root:sdcard_rw ${CLOUDROOTMOUNTPOINT}/.nomedia
|
chown root:sdcard_rw ${CLOUDROOTMOUNTPOINT}/.nomedia
|
||||||
chmod 0644 ${CLOUDROOTMOUNTPOINT}/.nomedia
|
chmod 0644 ${CLOUDROOTMOUNTPOINT}/.nomedia
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ! -d ${CACHE} ]]; then
|
if [[ ! -d ${CACHE} ]]; then
|
||||||
|
|
||||||
mkdir -p ${CACHE}
|
mkdir -p ${CACHE}
|
||||||
chown root:sdcard_rw ${CACHE}
|
chown root:sdcard_rw ${CACHE}
|
||||||
chmod 0775 ${CACHE}
|
chmod 0775 ${CACHE}
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -d ${CACHE} ]]; then
|
if [[ -d ${CACHE} ]]; then
|
||||||
|
|
||||||
chown root:sdcard_rw ${CACHE}
|
chown root:sdcard_rw ${CACHE}
|
||||||
chmod 0775 ${CACHE}
|
chmod 0775 ${CACHE}
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ! -d ${CACHE_BACKEND} ]]; then
|
if [[ ! -d ${CACHE_BACKEND} ]]; then
|
||||||
|
|
||||||
mkdir -p ${CACHE_BACKEND}
|
mkdir -p ${CACHE_BACKEND}
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -d ${CACHE_BACKEND} ]]; then
|
if [[ -d ${CACHE_BACKEND} ]]; then
|
||||||
|
|
||||||
chown root:sdcard_rw ${CACHE_BACKEND}
|
chown root:sdcard_rw ${CACHE_BACKEND}
|
||||||
chmod 0775 ${CACHE_BACKEND}
|
chmod 0775 ${CACHE_BACKEND}
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ! -L ${RUNTIME_R}/cloud ]]; then
|
if [[ ! -L ${RUNTIME_R}/cloud ]]; then
|
||||||
|
|
||||||
ln -sf ${CLOUDROOTMOUNTPOINT} ${RUNTIME_R}/cloud
|
ln -sf ${CLOUDROOTMOUNTPOINT} ${RUNTIME_R}/cloud
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ! -L ${RUNTIME_W}/cloud ]]; then
|
if [[ ! -L ${RUNTIME_W}/cloud ]]; then
|
||||||
|
|
||||||
ln -sf ${CLOUDROOTMOUNTPOINT} ${RUNTIME_W}/cloud
|
ln -sf ${CLOUDROOTMOUNTPOINT} ${RUNTIME_W}/cloud
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ! -L ${RUNTIME_D}/cloud ]]; then
|
if [[ ! -L ${RUNTIME_D}/cloud ]]; then
|
||||||
|
|
||||||
ln -sf ${CLOUDROOTMOUNTPOINT} ${RUNTIME_D}/cloud
|
ln -sf ${CLOUDROOTMOUNTPOINT} ${RUNTIME_D}/cloud
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -e ${USER_CONF} ]]; then
|
if [[ -e ${USER_CONF} ]]; then
|
||||||
|
|
||||||
cp ${USER_CONF} ${CONFIGFILE}
|
cp ${USER_CONF} ${CONFIGFILE}
|
||||||
chmod 0600 ${CONFIGFILE}
|
chmod 0600 ${CONFIGFILE}
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ${NETCHK} = 1 ]]; then
|
if [[ ${NETCHK} = 1 ]]; then
|
||||||
|
until net_chk || [[ ${COUNT} = 60 ]]; do
|
||||||
until net_chk || [[ ${COUNT} = 60 ]]; do
|
|
||||||
|
|
||||||
sleep 5
|
sleep 5
|
||||||
((++COUNT))
|
((++COUNT))
|
||||||
|
|
||||||
done >> /dev/null 2>&1
|
done >> /dev/null 2>&1
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Default CACHEMODE ${CACHEMODE}"
|
echo "Default CACHEMODE ${CACHEMODE}"
|
||||||
|
|
||||||
sleep 5
|
sleep 5
|
||||||
|
|
||||||
LD_LIBRARY_PATH=${HOME} ${HOME}/rclone listremotes --config ${CONFIGFILE}|cut -f1 -d: |
|
LD_LIBRARY_PATH=${MODDIR} ${MODDIR}/rclone listremotes --config ${CONFIGFILE}|cut -f1 -d: |
|
||||||
|
while read remote; do
|
||||||
while read remote; do
|
echo
|
||||||
|
list_remote=${remote}
|
||||||
echo
|
CLOUDROOTMOUNTPOINT=/mnt/cloud
|
||||||
|
PROFILE=0
|
||||||
list_remote=${remote}
|
DISABLE=0
|
||||||
CLOUDROOTMOUNTPOINT=/mnt/cloud
|
READONLY=0
|
||||||
PROFILE=0
|
global_params >> /dev/null 2>&1
|
||||||
DISABLE=0
|
remote=${list_remote}
|
||||||
READONLY=0
|
custom_params
|
||||||
|
if [[ ${ISOLATE} = 1 ]] && [[ ${PROFILE} -gt 0 ]] && [[ ${BINDSD} = 1 ]]; then
|
||||||
global_params >> /dev/null 2>&1
|
CLOUDROOTMOUNTPOINT=/data/media/${PROFILE}/.cloud
|
||||||
|
fi
|
||||||
remote=${list_remote}
|
|
||||||
|
|
||||||
custom_params
|
|
||||||
|
|
||||||
if [[ ${ISOLATE} = 1 ]] && [[ ${PROFILE} -gt 0 ]] && [[ ${BINDSD} = 1 ]]; then
|
|
||||||
|
|
||||||
CLOUDROOTMOUNTPOINT=/data/media/${PROFILE}/.cloud
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ ${DISABLE} = 1 ]] || [[ -e ${USER_CONFDIR}/.${remote}.disable ]]; then
|
|
||||||
|
|
||||||
echo "${remote} disabled by user"
|
|
||||||
continue
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
sd_unbind
|
|
||||||
rclone_mount
|
|
||||||
sd_binder
|
|
||||||
syncd_service
|
|
||||||
reset_params
|
|
||||||
|
|
||||||
done
|
|
||||||
|
|
||||||
|
if [[ ${DISABLE} = 1 ]] || [[ -e ${USER_CONFDIR}/.${remote}.disable ]]; then
|
||||||
|
echo "${remote} disabled by user"
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
sd_unbind
|
||||||
|
rclone_mount
|
||||||
|
sd_binder
|
||||||
|
syncd_service
|
||||||
|
reset_params
|
||||||
|
done
|
||||||
echo
|
echo
|
||||||
|
|
||||||
if [[ ${HTTP} = 1 ]]; then
|
if [[ ${HTTP} = 1 ]]; then
|
||||||
|
if $(${MODDIR}/rclone serve http ${CLOUDROOTMOUNTPOINT} --addr ${HTTP_ADDR} --no-checksum --no-modtime --read-only >> /dev/null 2>&1 &); then
|
||||||
if $(/sbin/rclone serve http ${CLOUDROOTMOUNTPOINT} --addr ${HTTP_ADDR} --no-checksum --no-modtime --read-only >> /dev/null 2>&1 &); then
|
echo "HTTP Server: http://${HTTP_ADDR}"
|
||||||
|
|
||||||
echo "Notice: /mnt/cloud served via HTTP at: http://${HTTP_ADDR}"
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ${FTP} = 1 ]]; then
|
if [[ ${FTP} = 1 ]]; then
|
||||||
|
if $(${MODDIR}/rclone serve ftp ${CLOUDROOTMOUNTPOINT} --addr ${FTP_ADDR} --no-checksum --no-modtime --read-only >> /dev/null 2>&1 &); then
|
||||||
if $(/sbin/rclone serve ftp ${CLOUDROOTMOUNTPOINT} --addr ${FTP_ADDR} --no-checksum --no-modtime --read-only >> /dev/null 2>&1 &); then
|
echo "FTP Server: ftp://${FTP_ADDR}"
|
||||||
|
|
||||||
echo "Notice: /mnt/cloud served via FTP at: ftp://${FTP_ADDR}"
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ${SFTP} = 1 ]] && [[ ! -z ${SFTP_USER} ]] && [[ ! -z ${SFTP_PASS} ]]; then
|
if [[ ${SFTP} = 1 ]] && [[ ! -z ${SFTP_USER} ]] && [[ ! -z ${SFTP_PASS} ]]; then
|
||||||
|
if $(${MODDIR}/rclone serve sftp ${CLOUDROOTMOUNTPOINT} --addr ${SFTP_ADDR} --user ${SFTP_USER} --pass ${SFTP_PASS} --no-checksum --no-modtime --read-only >> /dev/null 2>&1 &); then
|
||||||
if $(/sbin/rclone serve sftp ${CLOUDROOTMOUNTPOINT} --addr ${SFTP_ADDR} --user ${SFTP_USER} --pass ${SFTP_PASS} --no-checksum --no-modtime --read-only >> /dev/null 2>&1 &); then
|
echo "SFTP Server: sftp://${SFTP_ADDR}"
|
||||||
|
|
||||||
echo "Notice: /mnt/cloud served via SFTP at: sftp://${SFTP_ADDR}"
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo
|
|
||||||
echo "...done"
|
|
||||||
|
|
||||||
exit
|
exit
|
|
@ -5,102 +5,63 @@ TMPDIR=${MODDIR}/.tmp
|
||||||
SYNC_PENDING=${TMPDIR}/${remote}.sync.pend
|
SYNC_PENDING=${TMPDIR}/${remote}.sync.pend
|
||||||
|
|
||||||
dump_battery () {
|
dump_battery () {
|
||||||
|
|
||||||
BATTERY_DUMP="$(dumpsys battery)"
|
BATTERY_DUMP="$(dumpsys battery)"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
battery_level () {
|
battery_level () {
|
||||||
|
|
||||||
echo "${BATTERY_DUMP}" |grep level |cut -d ':' -f2 |cut -d ' ' -f2
|
echo "${BATTERY_DUMP}" |grep level |cut -d ':' -f2 |cut -d ' ' -f2
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ac_charge () {
|
ac_charge () {
|
||||||
|
|
||||||
echo "${BATTERY_DUMP}" |grep -w "AC powered" |cut -d ":" -f2 |cut -d " " -f2
|
echo "${BATTERY_DUMP}" |grep -w "AC powered" |cut -d ":" -f2 |cut -d " " -f2
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
usb_charge () {
|
usb_charge () {
|
||||||
|
|
||||||
echo "${BATTERY_DUMP}" |grep -w "USB powered" |cut -d ":" -f2 |cut -d " " -f2
|
echo "${BATTERY_DUMP}" |grep -w "USB powered" |cut -d ":" -f2 |cut -d " " -f2
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
echo $$ >> ${PIDFILE}
|
echo $$ >> ${PIDFILE}
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
|
|
||||||
if [[ ! -e ${SYNC_PENDING} ]]; then
|
if [[ ! -e ${SYNC_PENDING} ]]; then
|
||||||
|
${MODDIR}/inotifywait "/storage/emulated/${PROFILE}/${SYNCDIR}" -e modify,create,moved_to,close_write -q >> /dev/null 2>&1 && touch ${SYNC_PENDING}
|
||||||
${HOME}/inotifywait "/storage/emulated/${PROFILE}/${SYNCDIR}" -e modify,create,moved_to,close_write -q >> /dev/null 2>&1 && touch ${SYNC_PENDING}
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
|
|
||||||
sleep 5
|
sleep 5
|
||||||
|
|
||||||
dump_battery
|
dump_battery
|
||||||
|
|
||||||
if [[ $(battery_level) -gt ${SYNC_BATTLVL} ]] || [[ $(bettery_level) -eq ${SYNC_BATTLVL} ]] || [[ $(ac_charge) = true ]] || [[ $(usb_charge) = true ]]; then
|
if [[ $(battery_level) -gt ${SYNC_BATTLVL} ]] || [[ $(bettery_level) -eq ${SYNC_BATTLVL} ]] || [[ $(ac_charge) = true ]] || [[ $(usb_charge) = true ]]; then
|
||||||
|
|
||||||
echo "Sync battery check success"
|
echo "Sync battery check success"
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
sleep 300
|
sleep 300
|
||||||
continue
|
continue
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $SYNC_CHARGE = 1 ]]; then
|
if [[ $SYNC_CHARGE = 1 ]]; then
|
||||||
|
|
||||||
if [[ $(ac_charge) = true ]] || [[ $(usb_charge) = true ]]; then
|
if [[ $(ac_charge) = true ]] || [[ $(usb_charge) = true ]]; then
|
||||||
|
|
||||||
echo "Sync charge check success"
|
echo "Sync charge check success"
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
echo "Sync charge check fail"
|
echo "Sync charge check fail"
|
||||||
sleep 300
|
sleep 300
|
||||||
continue
|
continue
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ${SYNC_WIFI} = 1 ]]; then
|
if [[ ${SYNC_WIFI} = 1 ]]; then
|
||||||
|
|
||||||
if ! ping -I wlan0 -c 1 ${NETCHK_ADDR} >> /dev/null 2>&1; then
|
if ! ping -I wlan0 -c 1 ${NETCHK_ADDR} >> /dev/null 2>&1; then
|
||||||
|
|
||||||
echo "Sync wifi check fail"
|
echo "Sync wifi check fail"
|
||||||
sleep 300
|
sleep 300
|
||||||
continue
|
continue
|
||||||
|
else
|
||||||
else
|
|
||||||
|
|
||||||
echo "Sync wifi check success"
|
echo "Sync wifi check success"
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
break
|
||||||
|
done
|
||||||
|
|
||||||
break
|
echo "Syncing..."
|
||||||
|
nice -n 19 ionice -c 2 -n 7 ${MODDIR}/rclone copy "/storage/emulated/${PROFILE}/${SYNCDIR}" "$CLOUDROOTMOUNTPOINT/${remote}/${SYNCDIR}" --retries-sleep=10m --retries 6 --transfers 1 --multi-thread-streams 1 >> /dev/null 2>&1
|
||||||
done
|
|
||||||
|
|
||||||
echo "Syncing..."
|
|
||||||
|
|
||||||
nice -n 19 ionice -c 2 -n 7 ${HOME}/rclone copy "/storage/emulated/${PROFILE}/${SYNCDIR}" "$CLOUDROOTMOUNTPOINT/${remote}/${SYNCDIR}" --retries-sleep=10m --retries 6 --transfers 1 --multi-thread-streams 1 >> /dev/null 2>&1
|
|
||||||
|
|
||||||
if [[ -e ${SYNC_PENDING} ]]; then
|
|
||||||
|
|
||||||
rm ${SYNC_PENDING}
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Sync finished!"
|
|
||||||
|
|
||||||
|
if [[ -e ${SYNC_PENDING} ]]; then
|
||||||
|
rm ${SYNC_PENDING}
|
||||||
|
fi
|
||||||
|
echo "Sync finished!"
|
||||||
done
|
done
|
|
@ -1,13 +1,12 @@
|
||||||
#!/system/bin/sh
|
#!/system/bin/sh
|
||||||
|
|
||||||
MODDIR="$(dirname "$(readlink -f "$0")")"
|
# Module directory, DO NOT TOUCH THIS!
|
||||||
UPDDIR=/data/adb/modules_update
|
MODDIR=${MODDIR:-$(magisk --path)/.magisk/modules/rclone.mount}
|
||||||
IMGDIR=/sbin/.core/img
|
echo "Using 'rclone' binary: ${MODDIR}/rclone"
|
||||||
id=com.piyushgarg.rclone
|
|
||||||
|
|
||||||
USER_CONFDIR=/sdcard/.rclone
|
USER_CONFDIR=/sdcard/.rclone
|
||||||
USER_CONF=${USER_CONFDIR}/rclone.conf
|
USER_CONF=${USER_CONFDIR}/rclone.conf
|
||||||
CONFIGFILE=${HOME}/.config/rclone/rclone.conf
|
CONFIGFILE=${MODDIR}/.config/rclone/rclone.conf
|
||||||
LOGFILE=${USER_CONFDIR}/rclone.log
|
LOGFILE=${USER_CONFDIR}/rclone.log
|
||||||
LOGLEVEL=NOTICE
|
LOGLEVEL=NOTICE
|
||||||
DATA_MEDIA=/data/media/0
|
DATA_MEDIA=/data/media/0
|
||||||
|
@ -23,226 +22,109 @@ CLOUDROOTMOUNTPOINT=/mnt/cloud
|
||||||
SCRIPTPID=$$
|
SCRIPTPID=$$
|
||||||
export INTERACTIVE=1
|
export INTERACTIVE=1
|
||||||
|
|
||||||
## resolve links - $0 may be a link to module home
|
|
||||||
PRG="$0"
|
|
||||||
|
|
||||||
# need this for relative symlinks
|
|
||||||
while [ -h "$PRG" ] ; do
|
|
||||||
ls=`ls -ld "$PRG"`
|
|
||||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
|
||||||
if expr "$link" : '/.*' > /dev/null; then
|
|
||||||
PRG="$link"
|
|
||||||
else
|
|
||||||
PRG="`dirname "$PRG"`/$link"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
echo $PRG
|
|
||||||
|
|
||||||
saveddir=`pwd`
|
|
||||||
|
|
||||||
MODDIR2=`dirname "$PRG"`
|
|
||||||
|
|
||||||
# make it fully qualified
|
|
||||||
MODDIR2=`cd "$MODIR2" && pwd`
|
|
||||||
|
|
||||||
cd "$saveddir"
|
|
||||||
#echo $MODDIR2
|
|
||||||
|
|
||||||
if [ -e ${UPDDIR}/${id}/rclone ]; then
|
|
||||||
HOME=${UPDDIR}/${id}
|
|
||||||
|
|
||||||
elif [ -e ${IMGDIR}/${id}/rclone ]; then
|
|
||||||
HOME=${IMGDIR}/${id}
|
|
||||||
|
|
||||||
elif [ -e ${MODDIR2}/${id}/rclone ]; then
|
|
||||||
HOME=${MODDIR2}/${id}
|
|
||||||
|
|
||||||
else
|
|
||||||
HOME=${MODDIR}
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo $HOME
|
|
||||||
|
|
||||||
CONFIGFILE=${HOME}/.config/rclone/rclone.conf
|
|
||||||
|
|
||||||
custom_params () {
|
custom_params () {
|
||||||
|
|
||||||
PARAMS="DISABLE BINDSD BINDPOINT"
|
PARAMS="DISABLE BINDSD BINDPOINT"
|
||||||
|
|
||||||
BAD_SYNTAX="(^\s*#|^\s*$|^\s*[a-z_][^[:space:]]*=[^;&\(\`]*$)"
|
BAD_SYNTAX="(^\s*#|^\s*$|^\s*[a-z_][^[:space:]]*=[^;&\(\`]*$)"
|
||||||
|
|
||||||
if [[ -e $USER_CONFDIR/.$remote.param ]]; then
|
if [[ -e $USER_CONFDIR/.$remote.param ]]; then
|
||||||
|
|
||||||
echo "Found .$remote.param"
|
echo "Found .$remote.param"
|
||||||
|
|
||||||
if ! [[ $(egrep -q -iv "$BAD_SYNTAX" $USER_CONFDIR/.$remote.param) ]]; then
|
if ! [[ $(egrep -q -iv "$BAD_SYNTAX" $USER_CONFDIR/.$remote.param) ]]; then
|
||||||
|
|
||||||
echo "loading .$remote.param"
|
echo "loading .$remote.param"
|
||||||
|
|
||||||
for PARAM in ${PARAMS[@]}; do
|
for PARAM in ${PARAMS[@]}; do
|
||||||
|
|
||||||
while read -r VAR; do
|
while read -r VAR; do
|
||||||
|
|
||||||
if [[ "$(echo "${VAR}" |grep -w "$PARAM")" ]]; then
|
if [[ "$(echo "${VAR}" |grep -w "$PARAM")" ]]; then
|
||||||
echo "Importing ${VAR}"
|
echo "Importing ${VAR}"
|
||||||
eval $(echo "${VAR}" |cut -d ' ' -f 1)
|
eval $(echo "${VAR}" |cut -d ' ' -f 1)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
done < $USER_CONFDIR/.$remote.param
|
done < $USER_CONFDIR/.$remote.param
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
echo ".$remote.param contains bad syntax"
|
echo ".$remote.param contains bad syntax"
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
config () {
|
config () {
|
||||||
|
if [[ ! -d ${USER_CONFDIR} ]]; then
|
||||||
if [[ ! -d ${USER_CONFDIR} ]]; then
|
mkdir ${USER_CONFDIR}
|
||||||
|
|
||||||
mkdir ${USER_CONFDIR}
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -e ${USER_CONFDIR}/rclone.conf ]]; then
|
if [[ -e ${USER_CONFDIR}/rclone.conf ]]; then
|
||||||
|
cp ${USER_CONFDIR}/rclone.conf ${MODDIR}/.config/rclone/rclone.conf
|
||||||
cp ${USER_CONFDIR}/rclone.conf ${HOME}/.config/rclone/rclone.conf
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
${MODDIR}/rclone config && cp ${MODDIR}/.config/rclone/rclone.conf ${USER_CONFDIR}/rclone.conf && echo && ${MODDIR}/rclone-wrapper.sh remount
|
||||||
${HOME}/rclone config && cp ${HOME}/.config/rclone/rclone.conf ${USER_CONFDIR}/rclone.conf && echo && ${HOME}/rclone-wrapper.sh remount
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
help () {
|
help () {
|
||||||
|
$MODDIR/rclone help
|
||||||
$HOME/rclone help
|
|
||||||
echo
|
echo
|
||||||
echo 'Wrapper Commands:'
|
echo 'Wrapper Commands:'
|
||||||
echo ' disable Disable a specified remote which exist in rclone.conf.'
|
echo ' disable Disable a specified remote which exist in rclone.conf.'
|
||||||
echo ' remount Remount the remotes inside rclone.conf except disabled.'
|
echo ' remount Remount the remotes inside rclone.conf except disabled.'
|
||||||
echo ' unmount Kill rclone & unmount all remotes.'
|
echo ' unmount Kill rclone & unmount all remotes.'
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
disable () {
|
disable () {
|
||||||
|
|
||||||
echo "disabling remote ${2}"
|
echo "disabling remote ${2}"
|
||||||
touch ${USER_CONFDIR}/.${2}.disable
|
touch ${USER_CONFDIR}/.${2}.disable
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unmount () {
|
unmount () {
|
||||||
|
|
||||||
echo "Killing & Unmounting Remotes...."
|
echo "Killing & Unmounting Remotes...."
|
||||||
|
|
||||||
echo
|
echo
|
||||||
|
|
||||||
kill $(pgrep -f rclone| grep -v ${SCRIPTPID}) >> /dev/null 2>&1
|
kill $(pgrep -f rclone| grep -v ${SCRIPTPID}) >> /dev/null 2>&1
|
||||||
|
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|
||||||
umount -lf ${CLOUDROOTMOUNTPOINT}/* >> /dev/null 2>&1
|
umount -lf ${CLOUDROOTMOUNTPOINT}/* >> /dev/null 2>&1
|
||||||
|
|
||||||
umount -lf ${CLOUDROOTMOUNTPOINT} >> /dev/null 2>&1
|
umount -lf ${CLOUDROOTMOUNTPOINT} >> /dev/null 2>&1
|
||||||
|
${MODDIR}/rclone purge ${CLOUDROOTMOUNTPOINT} >> /dev/null 2>&1
|
||||||
$HOME/rclone purge ${CLOUDROOTMOUNTPOINT} >> /dev/null 2>&1
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sd_unbind_func () {
|
sd_unbind_func () {
|
||||||
|
|
||||||
if [[ -z ${BINDPOINT} ]]; then
|
if [[ -z ${BINDPOINT} ]]; then
|
||||||
|
|
||||||
UNBINDPOINT=${BINDPOINT_DEF}/${remote}
|
UNBINDPOINT=${BINDPOINT_DEF}/${remote}
|
||||||
|
|
||||||
su -M -c umount -lf ${UNBINDPOINT} >> /dev/null 2>&1
|
su -M -c umount -lf ${UNBINDPOINT} >> /dev/null 2>&1
|
||||||
|
|
||||||
UNBINDPOINT=${BINDPOINT_R}/${remote}
|
UNBINDPOINT=${BINDPOINT_R}/${remote}
|
||||||
|
|
||||||
su -M -c umount -lf ${UNBINDPOINT} >> /dev/null 2>&1
|
su -M -c umount -lf ${UNBINDPOINT} >> /dev/null 2>&1
|
||||||
|
|
||||||
UNBINDPOINT=${BINDPOINT_W}/${remote}
|
UNBINDPOINT=${BINDPOINT_W}/${remote}
|
||||||
|
|
||||||
su -M -c umount -lf ${UNBINDPOINT} >> /dev/null 2>&1
|
su -M -c umount -lf ${UNBINDPOINT} >> /dev/null 2>&1
|
||||||
|
else
|
||||||
else
|
|
||||||
|
|
||||||
USER_BINDPOINT=${BINDPOINT}
|
USER_BINDPOINT=${BINDPOINT}
|
||||||
|
|
||||||
UNBINDPOINT=${RUNTIME_D}/emulated/0/${USER_BINDPOINT}
|
UNBINDPOINT=${RUNTIME_D}/emulated/0/${USER_BINDPOINT}
|
||||||
|
|
||||||
su -M -c umount -lf ${UNBINDPOINT} >> /dev/null 2>&1
|
su -M -c umount -lf ${UNBINDPOINT} >> /dev/null 2>&1
|
||||||
|
|
||||||
UNBINDPOINT=${RUNTIME_R}/emulated/0/${USER_BINDPOINT}
|
UNBINDPOINT=${RUNTIME_R}/emulated/0/${USER_BINDPOINT}
|
||||||
|
|
||||||
su -M -c umount -lf ${UNBINDPOINT} >> /dev/null 2>&1
|
su -M -c umount -lf ${UNBINDPOINT} >> /dev/null 2>&1
|
||||||
|
|
||||||
UNBINDPOINT=${RUNTIME_W}/emulated/0/${USER_BINDPOINT}
|
UNBINDPOINT=${RUNTIME_W}/emulated/0/${USER_BINDPOINT}
|
||||||
|
|
||||||
su -M -c umount -lf ${UNBINDPOINT} >> /dev/null 2>&1
|
su -M -c umount -lf ${UNBINDPOINT} >> /dev/null 2>&1
|
||||||
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sd_unbind () {
|
sd_unbind () {
|
||||||
|
${MODDIR}/rclone listremotes --config ${CONFIGFILE} | cut -f1 -d: | while read remote; do
|
||||||
${HOME}/rclone listremotes --config ${CONFIGFILE} | cut -f1 -d: | while read remote; do
|
echo
|
||||||
echo
|
custom_params
|
||||||
custom_params
|
sd_unbind_func
|
||||||
sd_unbind_func
|
done >> /dev/null 2>&1
|
||||||
|
|
||||||
done >> /dev/null 2>&1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
remount () {
|
remount () {
|
||||||
|
|
||||||
sd_unbind
|
sd_unbind
|
||||||
unmount
|
unmount
|
||||||
${HOME}/service.sh
|
${MODDIR}/service.sh
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if [[ ${1} = disable ]]; then
|
if [[ ${1} = disable ]]; then
|
||||||
|
|
||||||
disable
|
disable
|
||||||
|
|
||||||
elif [[ ${1} = remount ]]; then
|
elif [[ ${1} = remount ]]; then
|
||||||
|
|
||||||
remount
|
remount
|
||||||
|
|
||||||
elif [[ ${1} = unmount ]]; then
|
elif [[ ${1} = unmount ]]; then
|
||||||
|
|
||||||
sd_unbind
|
sd_unbind
|
||||||
unmount
|
unmount
|
||||||
|
|
||||||
|
|
||||||
elif [[ ${1} = config ]]; then
|
elif [[ ${1} = config ]]; then
|
||||||
|
|
||||||
config
|
config
|
||||||
|
|
||||||
elif [[ ${1} = help ]]; then
|
elif [[ ${1} = help ]]; then
|
||||||
|
|
||||||
help
|
help
|
||||||
|
|
||||||
elif [[ ${1} = --help ]]; then
|
elif [[ ${1} = --help ]]; then
|
||||||
|
|
||||||
help
|
help
|
||||||
|
|
||||||
elif [[ -z ${1} ]]; then
|
elif [[ -z ${1} ]]; then
|
||||||
|
|
||||||
help
|
help
|
||||||
|
|
||||||
else
|
else
|
||||||
|
${MODDIR}/rclone $*
|
||||||
${HOME}/rclone $*
|
|
||||||
|
|
||||||
fi
|
fi
|
0
system/placeholder
Executable file
0
system/placeholder
Executable file
31
uninstall.sh
Executable file
31
uninstall.sh
Executable file
|
@ -0,0 +1,31 @@
|
||||||
|
echo "Un-mounting remotes..."
|
||||||
|
CONFIGFILE=/sdcard/.rclone/rclone.conf
|
||||||
|
CLOUDROOTMOUNTPOINT=/mnt/cloud/
|
||||||
|
mkdir -p $CLOUDROOTMOUNTPOINT
|
||||||
|
|
||||||
|
$MODDIR/rclone listremotes --config ${CONFIGFILE}|cut -f1 -d: |
|
||||||
|
while read line; do
|
||||||
|
echo "Un-mounting [$line] ..."
|
||||||
|
umount -f ${CLOUDROOTMOUNTPOINT}/${line}
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "... done"
|
||||||
|
|
||||||
|
# Don't modify anything after this
|
||||||
|
if [ -f $INFO ]; then
|
||||||
|
while read LINE; do
|
||||||
|
if [ "$(echo -n $LINE | tail -c 1)" == "~" ]; then
|
||||||
|
continue
|
||||||
|
elif [ -f "$LINE~" ]; then
|
||||||
|
mv -f $LINE~ $LINE
|
||||||
|
else
|
||||||
|
rm -f $LINE
|
||||||
|
while true; do
|
||||||
|
LINE=$(dirname $LINE)
|
||||||
|
[ "$(ls -A $LINE 2>/dev/null)" ] && break 1 || rm -rf $LINE
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
done < $INFO
|
||||||
|
rm -f $INFO
|
||||||
|
fi
|
Loading…
Add table
Add a link
Reference in a new issue