mirror of
https://github.com/rclone/rclone.git
synced 2025-08-10 22:23:57 +02:00
Enable syntax highlight for the script
@ -2,49 +2,49 @@
|
|||||||
|
|
||||||
To enable mounting a rclone volume using system mount tool, the following helper script must be named `rclonefs` and placed in `$PATH`:
|
To enable mounting a rclone volume using system mount tool, the following helper script must be named `rclonefs` and placed in `$PATH`:
|
||||||
|
|
||||||
#!/bin/bash
|
```bash
|
||||||
remote=$1
|
#!/bin/bash
|
||||||
mountpoint=$2
|
remote=$1
|
||||||
shift 2
|
mountpoint=$2
|
||||||
|
shift 2
|
||||||
|
|
||||||
# Process -o parameters
|
# Process -o parameters
|
||||||
while getopts :o: opts; do
|
while getopts :o: opts; do
|
||||||
case $opts in
|
case $opts in
|
||||||
o)
|
o)
|
||||||
params=${OPTARG//,/ }
|
params=${OPTARG//,/ }
|
||||||
for param in $params; do
|
for param in $params; do
|
||||||
if [ "$param" == "rw" ]; then continue; fi
|
if [ "$param" == "rw" ]; then continue; fi
|
||||||
if [ "$param" == "ro" ]; then continue; fi
|
if [ "$param" == "ro" ]; then continue; fi
|
||||||
if [ "$param" == "dev" ]; then continue; fi
|
if [ "$param" == "dev" ]; then continue; fi
|
||||||
if [ "$param" == "suid" ]; then continue; fi
|
if [ "$param" == "suid" ]; then continue; fi
|
||||||
if [ "$param" == "exec" ]; then continue; fi
|
if [ "$param" == "exec" ]; then continue; fi
|
||||||
if [ "$param" == "auto" ]; then continue; fi
|
if [ "$param" == "auto" ]; then continue; fi
|
||||||
if [ "$param" == "nodev" ]; then continue; fi
|
if [ "$param" == "nodev" ]; then continue; fi
|
||||||
if [ "$param" == "nosuid" ]; then continue; fi
|
if [ "$param" == "nosuid" ]; then continue; fi
|
||||||
if [ "$param" == "noexec" ]; then continue; fi
|
if [ "$param" == "noexec" ]; then continue; fi
|
||||||
if [ "$param" == "noauto" ]; then continue; fi
|
if [ "$param" == "noauto" ]; then continue; fi
|
||||||
if [[ $param == x-systemd.* ]]; then continue; fi
|
if [[ $param == x-systemd.* ]]; then continue; fi
|
||||||
trans="$trans --$param"
|
trans="$trans --$param"
|
||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
\?)
|
\?)
|
||||||
echo "Invalid option: -$OPTARG"
|
echo "Invalid option: -$OPTARG"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
# exec rclone
|
|
||||||
trans="$trans $remote $mountpoint"
|
|
||||||
# NOTE: do not try "mount --daemon" here, it does not play well with systemd automount, use '&'!
|
|
||||||
# NOTE: mount is suid and ignores pre-set PATHs -> specify explicitely
|
|
||||||
PATH=$PATH rclone mount $trans </dev/null >/dev/null 2>/dev/null &
|
|
||||||
|
|
||||||
# wait until mounting is complete
|
|
||||||
until grep -q " ${mountpoint// /\\\\040} fuse.rclone " /proc/mounts; do
|
|
||||||
sleep 0.5
|
|
||||||
done
|
|
||||||
|
|
||||||
|
# exec rclone
|
||||||
|
trans="$trans $remote $mountpoint"
|
||||||
|
# NOTE: do not try "mount --daemon" here, it does not play well with systemd automount, use '&'!
|
||||||
|
# NOTE: mount is suid and ignores pre-set PATHs -> specify explicitely
|
||||||
|
PATH=$PATH rclone mount $trans </dev/null >/dev/null 2>/dev/null &
|
||||||
|
|
||||||
|
# wait until mounting is complete
|
||||||
|
until grep -q " ${mountpoint// /\\\\040} fuse.rclone " /proc/mounts; do
|
||||||
|
sleep 0.5
|
||||||
|
done
|
||||||
|
```
|
||||||
## fstab
|
## fstab
|
||||||
|
|
||||||
In `/etc/fstab` you can add something like:
|
In `/etc/fstab` you can add something like:
|
||||||
|
Reference in New Issue
Block a user