Latest
This commit is contained in:
parent
ff46081022
commit
ffd7b1fab6
3 changed files with 12 additions and 14 deletions
|
@ -80,7 +80,7 @@ EOT
|
||||||
|
|
||||||
logg info 'Ensuring /var/cache/rclone exists'
|
logg info 'Ensuring /var/cache/rclone exists'
|
||||||
sudo mkdir -p /var/cache/rclone
|
sudo mkdir -p /var/cache/rclone
|
||||||
sudo chmod 770 /var/cache/rclone
|
sudo chmod 755 /var/cache/rclone
|
||||||
# Add user / group with script in ~/.local/bin/add-user, if it is available
|
# Add user / group with script in ~/.local/bin/add-user, if it is available
|
||||||
if command -v add-user > /dev/null; then
|
if command -v add-user > /dev/null; then
|
||||||
sudo add-user rclone
|
sudo add-user rclone
|
||||||
|
@ -89,7 +89,7 @@ EOT
|
||||||
|
|
||||||
logg info 'Ensuring /var/log/rclone exists'
|
logg info 'Ensuring /var/log/rclone exists'
|
||||||
sudo mkdir -p /var/log/rclone
|
sudo mkdir -p /var/log/rclone
|
||||||
sudo chmod 770 /var/log/rclone
|
sudo chmod 755 /var/log/rclone
|
||||||
sudo chown -Rf rclone:rclone /var/log/rclone 2> /dev/null || sudo chown -Rf rclone:$(id -g -n) /var/log/rclone
|
sudo chown -Rf rclone:rclone /var/log/rclone 2> /dev/null || sudo chown -Rf rclone:$(id -g -n) /var/log/rclone
|
||||||
|
|
||||||
logg info 'Adding ~/.local/bin/rclone-mount to /usr/local/bin'
|
logg info 'Adding ~/.local/bin/rclone-mount to /usr/local/bin'
|
||||||
|
@ -98,11 +98,11 @@ EOT
|
||||||
|
|
||||||
logg info 'Adding ~/.config/rclone/rcloneignore to /etc/rcloneignore'
|
logg info 'Adding ~/.config/rclone/rcloneignore to /etc/rcloneignore'
|
||||||
sudo cp -f "${XDG_CONFIG_HOME:-$HOME/.config}/rclone/rcloneignore" /etc/rcloneignore
|
sudo cp -f "${XDG_CONFIG_HOME:-$HOME/.config}/rclone/rcloneignore" /etc/rcloneignore
|
||||||
sudo chmod 640 /etc/rcloneignore
|
sudo chmod 644 /etc/rcloneignore
|
||||||
|
|
||||||
logg info 'Adding ~/.config/rclone/system-rclone.conf to /etc/rclone.conf'
|
logg info 'Adding ~/.config/rclone/system-rclone.conf to /etc/rclone.conf'
|
||||||
sudo cp -f "${XDG_CONFIG_HOME:-$HOME/.config}/rclone/system-rclone.conf" /etc/rclone.conf
|
sudo cp -f "${XDG_CONFIG_HOME:-$HOME/.config}/rclone/system-rclone.conf" /etc/rclone.conf
|
||||||
sudo chmod 640 /etc/rclone.conf
|
sudo chmod 644 /etc/rclone.conf
|
||||||
|
|
||||||
### Add / configure service files
|
### Add / configure service files
|
||||||
if [ -d /etc/systemd/system ]; then
|
if [ -d /etc/systemd/system ]; then
|
||||||
|
@ -116,7 +116,7 @@ EOT
|
||||||
### Ensure mount folder is created
|
### Ensure mount folder is created
|
||||||
logg info "Ensuring /mnt/$SERVICE_ID is created with proper permissions"
|
logg info "Ensuring /mnt/$SERVICE_ID is created with proper permissions"
|
||||||
sudo mkdir -p "/mnt/$SERVICE_ID"
|
sudo mkdir -p "/mnt/$SERVICE_ID"
|
||||||
sudo chmod 770 "/mnt/$SERVICE_ID"
|
sudo chmod 755 "/mnt/$SERVICE_ID"
|
||||||
sudo chown -Rf rclone:rclone "/mnt/$SERVICE_ID" 2> /dev/null || sudo chown -Rf rclone:$(id -g -n) "/mnt/$SERVICE_ID"
|
sudo chown -Rf rclone:rclone "/mnt/$SERVICE_ID" 2> /dev/null || sudo chown -Rf rclone:$(id -g -n) "/mnt/$SERVICE_ID"
|
||||||
|
|
||||||
### Enable / restart the service
|
### Enable / restart the service
|
||||||
|
|
|
@ -9,9 +9,11 @@ MOUNT="$3"
|
||||||
if [ "$TYPE" = 'user' ]; then
|
if [ "$TYPE" = 'user' ]; then
|
||||||
MOUNT_REF="$USER-$MOUNT"
|
MOUNT_REF="$USER-$MOUNT"
|
||||||
MOUNT_LOWERCASE="user/$USER-$MOUNT"
|
MOUNT_LOWERCASE="user/$USER-$MOUNT"
|
||||||
|
SUDO_FLAG=""
|
||||||
else
|
else
|
||||||
MOUNT_REF="$MOUNT"
|
MOUNT_REF="$MOUNT"
|
||||||
MOUNT_LOWERCASE="$(echo "$MOUNT" | tr "[:upper:]" "[:lower:]")"
|
MOUNT_LOWERCASE="$(echo "$MOUNT" | tr "[:upper:]" "[:lower:]")"
|
||||||
|
SUDO_FLAG="sudo"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
### Path definitions
|
### Path definitions
|
||||||
|
@ -42,13 +44,9 @@ fi
|
||||||
### Ensure folders exist
|
### Ensure folders exist
|
||||||
for FOLDER in "$CACHE_FOLDER" "$CONFIG_FOLDER" "$LOG_FOLDER" "$MOUNT_PATH"; do
|
for FOLDER in "$CACHE_FOLDER" "$CONFIG_FOLDER" "$LOG_FOLDER" "$MOUNT_PATH"; do
|
||||||
if [ ! -d "$FOLDER" ]; then
|
if [ ! -d "$FOLDER" ]; then
|
||||||
mkdir -p "$FOLDER" || sudo mkdir -p "$FOLDER"
|
$SUDO_FLAG mkdir -p "$FOLDER"
|
||||||
sudo chmod 755 "$FOLDER"
|
$SUDO_FLAG chmod 755 "$FOLDER"
|
||||||
if command -v own > /dev/null; then
|
$SUDO_FLAG chown -Rf rclone:rclone "$FOLDER" 2> /dev/null || sudo chown -Rf rclone:$(id -g -n) "$FOLDER"
|
||||||
sudo own "$FOLDER"
|
|
||||||
else
|
|
||||||
sudo chown -Rf rclone:rclone "$FOLDER" 2> /dev/null || sudo chown -Rf rclone:$(id -g -n) "$FOLDER"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -63,7 +61,7 @@ unset AWS_CA_BUNDLE
|
||||||
export PATH="$PATH:/usr/local/bin:/usr/bin"
|
export PATH="$PATH:/usr/local/bin:/usr/bin"
|
||||||
# TODO: Only launch with --rc-web-gui if the servers hostname is the {{ .kubernetesHost }}
|
# TODO: Only launch with --rc-web-gui if the servers hostname is the {{ .kubernetesHost }}
|
||||||
# TODO: Add more secure authentication method
|
# TODO: Add more secure authentication method
|
||||||
sudo rclone --config "$CONFIG_FOLDER/rclone.conf" \
|
$SUDO_FLAG rclone --config "$CONFIG_FOLDER/rclone.conf" \
|
||||||
mount \
|
mount \
|
||||||
--allow-other \
|
--allow-other \
|
||||||
--buffer-size 4G \
|
--buffer-size 4G \
|
||||||
|
|
|
@ -7985,7 +7985,7 @@ softwarePackages:
|
||||||
_name: Rclone
|
_name: Rclone
|
||||||
ansible: professormanhattan.rclone
|
ansible: professormanhattan.rclone
|
||||||
apt: rclone
|
apt: rclone
|
||||||
brew: rclone
|
brew:linux: rclone
|
||||||
choco:
|
choco:
|
||||||
- rclone
|
- rclone
|
||||||
- winfsp
|
- winfsp
|
||||||
|
|
Loading…
Reference in a new issue