Update dotfiles/.local/share/chezmoi/home/dot_ssh/create_encrypted_private_readonly_private_id_rsa.tmpl, dotfiles/.local/share/chezmoi/home/dot_ssh/run_onchanges_after_generate-public-keys, dotfiles/.local/share/chezmoi/system-linux/etc/systemd/system/r2-{{ .user.username }}.service.tmpl, dotfiles/.local/share/chezmoi/system-linux/usr/local/bin/executable_rclone-mount, dotfiles/.local/share/chezmoi/home/dot_cache/readonly_rclone/.gitkeep, dotfiles/.local/share/chezmoi/system-linux/var/cache/readonly_rclone/remove_dot_gitkeep, dotfiles/.local/share/chezmoi/system-linux/etc/rcloneignore, dotfiles/.local/share/chezmoi/system-linux/etc/systemd/system/r2-docker.service, dotfiles/.local/share/chezmoi/system-linux/mnt/private_r2-docker/remove_dot_gitkeep, dotfiles/.local/share/chezmoi/system-linux/var/log/user/run_onchange_after-symlink-user-logs, dotfiles/.local/share/chezmoi/home/.chezmoi.yaml.tmpl, dotfiles/.local/share/chezmoi/home/dot_local/log/remove_dot_gitkeep, dotfiles/.local/share/chezmoi/home/private_dot_config/rclone/merge_rclone.conf
Deleted dotfiles/.local/share/chezmoi/home/dot_ssh/id_rsa.pub
2022-11-24 19:04:16 -08:00
|
|
|
#!/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
|
2022-11-24 19:11:59 -08:00
|
|
|
RCLONE_IGNORE="$CONFIG_FOLDER/rcloneignore"
|
|
|
|
if [ ! -f "$RCLONE_IGNORE" ] && [ -f "/etc/rcloneignore" ]; then
|
|
|
|
RCLONE_IGNORE='etc/rcloneignore'
|
|
|
|
fi
|
Update dotfiles/.local/share/chezmoi/home/dot_ssh/create_encrypted_private_readonly_private_id_rsa.tmpl, dotfiles/.local/share/chezmoi/home/dot_ssh/run_onchanges_after_generate-public-keys, dotfiles/.local/share/chezmoi/system-linux/etc/systemd/system/r2-{{ .user.username }}.service.tmpl, dotfiles/.local/share/chezmoi/system-linux/usr/local/bin/executable_rclone-mount, dotfiles/.local/share/chezmoi/home/dot_cache/readonly_rclone/.gitkeep, dotfiles/.local/share/chezmoi/system-linux/var/cache/readonly_rclone/remove_dot_gitkeep, dotfiles/.local/share/chezmoi/system-linux/etc/rcloneignore, dotfiles/.local/share/chezmoi/system-linux/etc/systemd/system/r2-docker.service, dotfiles/.local/share/chezmoi/system-linux/mnt/private_r2-docker/remove_dot_gitkeep, dotfiles/.local/share/chezmoi/system-linux/var/log/user/run_onchange_after-symlink-user-logs, dotfiles/.local/share/chezmoi/home/.chezmoi.yaml.tmpl, dotfiles/.local/share/chezmoi/home/dot_local/log/remove_dot_gitkeep, dotfiles/.local/share/chezmoi/home/private_dot_config/rclone/merge_rclone.conf
Deleted dotfiles/.local/share/chezmoi/home/dot_ssh/id_rsa.pub
2022-11-24 19:04:16 -08:00
|
|
|
|
|
|
|
### 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 \
|
2022-11-24 19:11:59 -08:00
|
|
|
--filter-from="$RCLONE_IGNORE"
|
Update dotfiles/.local/share/chezmoi/home/dot_ssh/create_encrypted_private_readonly_private_id_rsa.tmpl, dotfiles/.local/share/chezmoi/home/dot_ssh/run_onchanges_after_generate-public-keys, dotfiles/.local/share/chezmoi/system-linux/etc/systemd/system/r2-{{ .user.username }}.service.tmpl, dotfiles/.local/share/chezmoi/system-linux/usr/local/bin/executable_rclone-mount, dotfiles/.local/share/chezmoi/home/dot_cache/readonly_rclone/.gitkeep, dotfiles/.local/share/chezmoi/system-linux/var/cache/readonly_rclone/remove_dot_gitkeep, dotfiles/.local/share/chezmoi/system-linux/etc/rcloneignore, dotfiles/.local/share/chezmoi/system-linux/etc/systemd/system/r2-docker.service, dotfiles/.local/share/chezmoi/system-linux/mnt/private_r2-docker/remove_dot_gitkeep, dotfiles/.local/share/chezmoi/system-linux/var/log/user/run_onchange_after-symlink-user-logs, dotfiles/.local/share/chezmoi/home/.chezmoi.yaml.tmpl, dotfiles/.local/share/chezmoi/home/dot_local/log/remove_dot_gitkeep, dotfiles/.local/share/chezmoi/home/private_dot_config/rclone/merge_rclone.conf
Deleted dotfiles/.local/share/chezmoi/home/dot_ssh/id_rsa.pub
2022-11-24 19:04:16 -08:00
|
|
|
"$MOUNT":/ "$MOUNT_PATH"
|