Enable syntax highlight for the script

Mikhail Yenuchenko
2021-09-18 23:09:36 +03:00
parent 925f471eed
commit 65406878e5

@ -2,13 +2,14 @@
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//,/ }
@ -31,20 +32,19 @@ To enable mounting a rclone volume using system mount tool, the following helper
echo "Invalid option: -$OPTARG" echo "Invalid option: -$OPTARG"
;; ;;
esac esac
done done
# exec rclone # exec rclone
trans="$trans $remote $mountpoint" trans="$trans $remote $mountpoint"
# NOTE: do not try "mount --daemon" here, it does not play well with systemd automount, use '&'! # 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 # NOTE: mount is suid and ignores pre-set PATHs -> specify explicitely
PATH=$PATH rclone mount $trans </dev/null >/dev/null 2>/dev/null & PATH=$PATH rclone mount $trans </dev/null >/dev/null 2>/dev/null &
# wait until mounting is complete # wait until mounting is complete
until grep -q " ${mountpoint// /\\\\040} fuse.rclone " /proc/mounts; do until grep -q " ${mountpoint// /\\\\040} fuse.rclone " /proc/mounts; do
sleep 0.5 sleep 0.5
done done
```
## fstab ## fstab
In `/etc/fstab` you can add something like: In `/etc/fstab` you can add something like: