install.fairie/home/dot_local/bin/executable_rclone-mount
Brian Zalewski 9037474d22 Update 29 files
- /system/Applications/Firefox.app/Contents/Resources/distribution/policies.json
- /system/etc/cups/cupsd.conf
- /system/etc/cups/modify_cupsd.conf
- /system/etc/fonts/local.conf
- /system/etc/grub.d/31-hold-shift
- /system/etc/opt/chrome/policies/managed/policies.json
- /system/etc/qubes/repo-templates/qubes-templates.repo
- /system/etc/yum.repos.d/qubes-dom0.repo
- /system/etc/timeshift/timeshift.json
- /system/usr/lib/firefox-esr/distribution/policies.json
- /system/usr/lib/firefox/distribution/policies.json
- /system/var/cache/rclone/remove_dot_gitkeep
- /system/mnt/private_r2-docker/remove_dot_gitkeep
- /system/etc/sddm.conf
- /home/.chezmoiscripts/universal/run_onchange_after_57-netdata.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_20-font.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_14-timeshift.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_50-rclone.tmpl
- /home/.chezmoiscripts/qubes/run_onchange_before_12-update-dom0.tmpl
- /home/dot_config/rclone/merge_rclone.conf
- /home/dot_config/cups/cupsd.conf
- /home/dot_config/qubes/qubes-templates.repo
- /home/dot_config/qubes/qubes-dom0.repo
- /home/dot_config/timeshift/timeshift.json
- /home/Cloud/Private/remove_dot_gitkeep
- /home/Cloud/Public/remove_dot_gitkeep
- /home/dot_local/share/firefox/distribution/policies.json
- /home/dot_local/bin/executable_rclone-mount
- /home/dot_local/grub.d/31-hold-shift
2023-01-29 06:07:01 +00:00

64 lines
1.6 KiB
Bash

#!/usr/bin/env sh
### Variables
TYPE="$1"
USER="$2"
MOUNT="$3"
if [ "$TYPE" = 'user' ]; then
CACHE_FOLDER="/home/$USER/.cache/rclone"
CONFIG_FOLDER="/home/$USER/.config/rclone"
LOG_FOLDER="/home/$USER/.local/log"
LOG_FILE="$LOG_FOLDER/$MOUNT.log"
MOUNT_PATH="/home/{{ .user.username }}/.local/mnt/$MOUNT"
elif [ "$TYPE" = 'docker' ]; then
CACHE_FOLDER="/var/cache/rclone/$MOUNT"
CONFIG_FOLDER="/etc"
LOG_FOLDER="/var/log/rclone"
LOG_FILE="$LOG_FOLDER/$MOUNT.log"
MOUNT_PATH="/mnt/$MOUNT"
else
CACHE_FOLDER="/var/cache/rclone"
CONFIG_FOLDER="/etc"
LOG_FOLDER="/var/log/rclone"
LOG_FILE="$LOG_FOLDER/$MOUNT.log"
MOUNT_PATH="/mnt/$MOUNT"
fi
### Ensure directories created
if [ ! -d "$CACHE_FOLDER" ]; then
mkdir -p "$CACHE_FOLDER"
fi
if [ ! -d "$CONFIG_FOLDER" ]; then
mkdir -p "$CONFIG_FOLDER"
fi
if [ ! -d "$LOG_FOLDER" ]; then
mkdir -p "$LOG_FOLDER"
fi
if [ ! -d "$MOUNT_PATH" ]; then
mkdir -p "$MOUNT_PATH"
fi
RCLONE_IGNORE="$CONFIG_FOLDER/rcloneignore"
if [ ! -f "$RCLONE_IGNORE" ] && [ -f "/etc/rcloneignore" ]; then
RCLONE_IGNORE='etc/rcloneignore'
fi
### Mount
/usr/bin/rclone --config="$CONFIG_FOLDER/rclone.conf" \
mount \
--cache-tmp-upload-path="$CACHE_FOLDER/$MOUNT-upload" \
--cache-chunk-path="$CACHE_FOLDER/$MOUNT-chunks" \
--cache-workers=8 \
--cache-writes \
--cache-dir="$CACHE_FOLDER/$MOUNT-vfs" \
--cache-db-path="$CACHE_FOLDER/$MOUNT-db" \
--log-file="$LOG_FILE" \
--no-modtime \
--drive-use-trash \
--stats=0 \
--checkers=16 \
--bwlimit=40M \
--dir-cache-time=60m \
--vfs-cache-mode full \
--cache-info-age=60m \
--filter-from="$RCLONE_IGNORE"
"$MOUNT":/ "$MOUNT_PATH"