fix: fix incorrect rclone configuration detection (fixed #205)

This commit is contained in:
ttionya
2025-10-23 18:29:33 +08:00
parent 3f7d693ba6
commit 083e8e93ab
+10 -1
View File
@@ -34,13 +34,22 @@ function color() {
########################################
function check_rclone_connection() {
# check if the configuration exists
rclone ${RCLONE_GLOBAL_FLAG} config show "${RCLONE_REMOTE_NAME}" > /dev/null 2>&1
local RCLONE_CONFIG_FILE=$(rclone config file 2>&1 | grep -o '/[^[:space:]]*rclone\.conf')
grep -c "\[${RCLONE_REMOTE_NAME}\]" "${RCLONE_CONFIG_FILE}" > /dev/null 2>&1
if [[ $? != 0 ]]; then
color red "rclone configuration information not found"
color blue "Please configure rclone first, check https://github.com/ttionya/vaultwarden-backup/blob/master/README.md#backup"
exit 1
fi
# check flags validity
rclone ${RCLONE_GLOBAL_FLAG} version > /dev/null 2>&1
if [[ $? != 0 ]]; then
color red "illegal rclone global flags"
color blue "Please check https://rclone.org/flags/"
exit 1
fi
# check connection
local ERROR_COUNT=0