Fix error determin backup partition.
This commit is contained in:
parent
07e65564d3
commit
58d1db64b9
@ -46,7 +46,11 @@ hosts_base_dir=$crontab_base_dir/hosts
|
|||||||
|
|
||||||
extern_usb_disk=false
|
extern_usb_disk=false
|
||||||
extern_sata_disk=false
|
extern_sata_disk=false
|
||||||
|
|
||||||
|
# - A separate disk for backups that must be mounted for the backup process.
|
||||||
|
# -
|
||||||
intern_disk=false
|
intern_disk=false
|
||||||
|
|
||||||
# - remote_disk
|
# - remote_disk
|
||||||
# -
|
# -
|
||||||
# - - You need a fstab-entry in order to mount the backup partition
|
# - - 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="-o user_xattr,acl,barrier=1"
|
||||||
mount_flags=""
|
mount_flags=""
|
||||||
|
|
||||||
if $extern_usb_disk || $extern_sata_disk ; then
|
|
||||||
|
|
||||||
backup_partition=
|
backup_partition=
|
||||||
backup_raw_partition=
|
disk_identifier=
|
||||||
disk_identifier=
|
_found=false
|
||||||
_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
|
## - In case of unencrypted (and labeled) extern backup disc
|
||||||
## -
|
## -
|
||||||
if [ -d "/dev/disk/by-label" ]; then
|
if [ -d "/dev/disk/by-label" ]; then
|
||||||
backup_partition=$(realpath /dev/disk/by-label/`ls /dev/disk/by-label | grep $base_label_name`)
|
backup_partition=$(realpath /dev/disk/by-label/`ls /dev/disk/by-label | grep $base_label_name`)
|
||||||
[[ "X" != "X$backup_raw_partition" ]] && _found=true
|
[[ "X" != "X$backup_partition" ]] && _found=true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
## - Otherwise, assuming the backup disc is the alphabetic last attached device
|
## - Otherwise, assuming the backup disc is the alphabetic last attached device
|
||||||
## - in device list
|
## - in device list
|
||||||
## -
|
## -
|
||||||
if ! $_found ; then
|
if ! $_found ; then
|
||||||
|
|
||||||
for file in `ls /dev/disk/by-uuid` ; do
|
for file in `ls /dev/disk/by-uuid` ; do
|
||||||
_disk=`basename $(realpath /dev/disk/by-uuid/$file) | grep -e "^sd"`
|
_disk=`basename $(realpath /dev/disk/by-uuid/$file) | grep -e "^sd"`
|
||||||
[[ "X" = "${_disk}X" ]] && continue
|
[[ "X" = "${_disk}X" ]] && continue
|
||||||
@ -100,29 +110,20 @@ if $extern_usb_disk || $extern_sata_disk ; then
|
|||||||
done
|
done
|
||||||
|
|
||||||
if [ "X$disk_identifier" = "X" ]; then
|
if [ "X$disk_identifier" = "X" ]; then
|
||||||
|
|
||||||
## - Backup device could not be detected, so we will try the (above) given one..
|
## - Backup device could not be detected, so we will try the (above) given one..
|
||||||
## -
|
## -
|
||||||
backup_raw_partition=$_backup_partition
|
backup_partition=$_backup_partition
|
||||||
else
|
|
||||||
backup_raw_partition=/dev/$disk_identifier
|
|
||||||
fi
|
|
||||||
|
|
||||||
if $crypto_backup_device ; then
|
|
||||||
backup_partition="/dev/mapper/${backup_partition_name}"
|
|
||||||
else
|
else
|
||||||
backup_partition=$backup_raw_partition
|
backup_partition=/dev/$disk_identifier
|
||||||
fi
|
fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
elif $remote_disk ; then
|
elif $remote_disk ; then
|
||||||
|
|
||||||
backup_resource="$(grep "$backup_mountpoint" /etc/fstab | grep -v -E "\s*#" | awk '{print$1}' | head -1)"
|
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
|
|
||||||
fi
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user