fix: fix incorrect rclone configuration detection (fixed #205)
This commit is contained in:
+10
-1
@@ -34,13 +34,22 @@ function color() {
|
|||||||
########################################
|
########################################
|
||||||
function check_rclone_connection() {
|
function check_rclone_connection() {
|
||||||
# check if the configuration exists
|
# 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
|
if [[ $? != 0 ]]; then
|
||||||
color red "rclone configuration information not found"
|
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"
|
color blue "Please configure rclone first, check https://github.com/ttionya/vaultwarden-backup/blob/master/README.md#backup"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
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
|
# check connection
|
||||||
local ERROR_COUNT=0
|
local ERROR_COUNT=0
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user