dsnap-sync: pre-check for working ssh, if remote is given
o user must have a working pubkey auth for remote backups via ssh o be more precise and state the progname
This commit is contained in:
@@ -84,21 +84,24 @@ check_prerequisites () {
|
|||||||
which notify-send >/dev/null 2>&1 && { donotify=true; }
|
which notify-send >/dev/null 2>&1 && { donotify=true; }
|
||||||
which pv >/dev/null 2>&1 && { do_pv_cmd=true; }
|
which pv >/dev/null 2>&1 && { do_pv_cmd=true; }
|
||||||
|
|
||||||
if [ $(id -u) -ne 0 ] ; then printf "Script must be run as root\n" ; exit 1 ; fi
|
if [ $(id -u) -ne 0 ] ; then printf "$progname: must be run as root\n" ; exit 1 ; fi
|
||||||
|
|
||||||
|
if [ -z "$remote" ]; then
|
||||||
|
$ssh which sh >/dev/null 2>&1 || { printf "'remote shell' is not working!\nPlease correct your public authentication and try again.\n" && exit 1; }
|
||||||
|
fi
|
||||||
|
|
||||||
if [ ! -r "$SNAPPER_CONFIG" ]; then
|
if [ ! -r "$SNAPPER_CONFIG" ]; then
|
||||||
die "$SNAPPER_CONFIG does not exist."
|
die "$progname: $SNAPPER_CONFIG does not exist."
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
check_snapper_failed_ids () {
|
check_snapper_failed_ids () {
|
||||||
local batch=${1:-$false}
|
local batch=${1:-$false}
|
||||||
|
|
||||||
# active, non finished snapshot backups are marked with following string
|
# active, non finished snapshot backups are marked with a reasonable string
|
||||||
# "$progname backup in progress" (snapper description field)
|
# default: $(snap_description_running -> "$progname backup in progress"
|
||||||
snapper_failed_ids=$(eval snapper --config $selected_config list --type single | awk '/'"$snap_description_running"'/ {cnt++} END {print cnt}')
|
snapper_failed_ids=$(eval snapper --config $selected_config list --type single | awk '/'"$snap_description_running"'/ {cnt++} END {print cnt}')
|
||||||
if [ ${#snapper_failed_ids} -gt 0 ]; then
|
if [ ${#snapper_failed_ids} -gt 0 ]; then
|
||||||
#if [ -n "$snapper_failed_ids" ]; then
|
|
||||||
if [ "$batch" ]; then
|
if [ "$batch" ]; then
|
||||||
answer="yes"
|
answer="yes"
|
||||||
else
|
else
|
||||||
@@ -1146,6 +1149,7 @@ verify_snapper_structure () {
|
|||||||
die "%s needs to be a BTRFS subvolume. But given %s is just a directory.\n" "$snapper_config" "$backup_root/$snapper_config"
|
die "%s needs to be a BTRFS subvolume. But given %s is just a directory.\n" "$snapper_config" "$backup_root/$snapper_config"
|
||||||
fi
|
fi
|
||||||
# if changed, adapt SUBVOLUME in given config
|
# if changed, adapt SUBVOLUME in given config
|
||||||
|
# TODO: adapt SUBVOLUME in given config, since path might have changed meanwhile
|
||||||
#$ssh $(. /etc/snapper/configs/$snapper_config)
|
#$ssh $(. /etc/snapper/configs/$snapper_config)
|
||||||
#get_config "/etc/snapper/configs/$snapper_config" "SUBVOLUME"
|
#get_config "/etc/snapper/configs/$snapper_config" "SUBVOLUME"
|
||||||
#if $ssh [ "$SUBVOLUME" != \"$backup_root/$snapper_config\" ]; then
|
#if $ssh [ "$SUBVOLUME" != \"$backup_root/$snapper_config\" ]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user