Merge branch 'master' of git.oopen.de:backup/backup-rcopy

This commit is contained in:
Christoph 2023-01-22 16:23:41 +01:00
commit 120adb6e6b
2 changed files with 25 additions and 24 deletions

View File

@ -46,7 +46,11 @@ hosts_base_dir=$crontab_base_dir/hosts
extern_usb_disk=false
extern_sata_disk=false
# - A separate disk for backups that must be mounted for the backup process.
# -
intern_disk=false
# - remote_disk
# -
# - - You need a fstab-entry in order to mount the backup partition
@ -75,24 +79,30 @@ backup_partition_name=backup
#mount_flags="-o user_xattr,acl,barrier=1"
mount_flags=""
if $extern_usb_disk || $extern_sata_disk ; then
backup_partition=
backup_raw_partition=
disk_identifier=
_found=false
if $crypto_backup_device ; then
backup_raw_partition=$_backup_partition
backup_partition="/dev/mapper/${backup_partition_name}"
elif $extern_usb_disk || $extern_sata_disk || $intern_disk ; then
## - In case of unencrypted (and labeled) extern backup disc
## -
if [ -d "/dev/disk/by-label" ]; then
backup_partition=$(realpath /dev/disk/by-label/`ls /dev/disk/by-label | grep $base_label_name`)
[[ "X" != "X$backup_raw_partition" ]] && _found=true
backup_partition=$(realpath /dev/disk/by-label/`ls /dev/disk/by-label | grep -i $base_label_name`)
[[ "X${backup_partition}" != "X$(realpath /dev/disk/by-label/)" ]] && _found=true
fi
## - Otherwise, assuming the backup disc is the alphabetic last attached device
## - in device list
## -
if ! $_found ; then
for file in `ls /dev/disk/by-uuid` ; do
_disk=`basename $(realpath /dev/disk/by-uuid/$file) | grep -e "^sd"`
[[ "X" = "${_disk}X" ]] && continue
@ -100,32 +110,23 @@ if $extern_usb_disk || $extern_sata_disk ; then
done
if [ "X$disk_identifier" = "X" ]; then
## - Backup device could not be detected, so we will try the (above) given one..
## -
backup_raw_partition=$_backup_partition
else
backup_raw_partition=/dev/$disk_identifier
fi
if $crypto_backup_device ; then
backup_partition="/dev/mapper/${backup_partition_name}"
else
backup_partition=$backup_raw_partition
fi
fi
elif $remote_disk ; then
backup_resource="$(grep "$backup_mountpoint" /etc/fstab | grep -v -E "\s*#" | awk '{print$1}' | head -1)"
elif $intern_disk ; then
if $crypto_backup_device ; then
backup_raw_partition=$_backup_partition
backup_partition="/dev/mapper/${backup_partition_name}"
else
backup_partition=$_backup_partition
else
backup_partition=/dev/$disk_identifier
fi
fi
elif $remote_disk ; then
backup_resource="$(grep "$backup_mountpoint" /etc/fstab | grep -v -E "\s*#" | awk '{print$1}' | head -1)"
fi
## - send reminder for changing the backup disk
## -
#send_reminder=true

View File

@ -165,12 +165,12 @@ if $extern_usb_disk || $extern_sata_disk || $intern_disk ; then
elif ! $(df -h | grep $backup_partition | grep -q $backup_mountpoint 2> /dev/null) ; then
msg="[ Warning ]: Backup Partition is mounted, but mount point differs from script defined one ($backup_mountpoint)."
msg="[ Warning ]: Backup Partition '${backup_partition}' is mounted, but mount point differs from script defined one ($backup_mountpoint)."
msg="$msg\n Try to unmount partitionn and mount it again.."
if $MANUAL ; then
echo -e "\n$msg\n"
fi
echolog "\n[ Warning ]: Backup Partition is mounted, but mount point differs from script defined one
echolog "\n[ Warning ]: Backup Partition \033[1m${backup_partition}\033[mis mounted, but mount point differs from script defined one
which is '$backup_mountpoint'.\n\n Try to unmount partition and mount it again.."
$umount $backup_partition > /dev/null 2>&1
@ -211,7 +211,7 @@ if $extern_usb_disk || $extern_sata_disk || $intern_disk ; then
elif ! $(df -h | grep $backup_partition | grep -q $backup_mountpoint 2> /dev/null) ; then
msg="[ Error ]: Backup Partition is mounted, but mount point differs from script defined one ($backup_mountpoint)."
msg="[ Error ]: Backup Partition '${backup_partition}' is mounted, but mount point differs from script defined one ($backup_mountpoint)."
if $MANUAL ; then
echo -e "\n$msg\n"
else