|
@@ -232,11 +232,6 @@ backup_mounted_volume(){
|
|
|
backup_basename=$1
|
|
backup_basename=$1
|
|
|
partition_dev=$2
|
|
partition_dev=$2
|
|
|
part_type=$3
|
|
part_type=$3
|
|
|
- device_to_mount=$4
|
|
|
|
|
-
|
|
|
|
|
- if [[ "" = "$device_to_mount" ]] ; then
|
|
|
|
|
- device_to_mount=$partition_dev
|
|
|
|
|
- fi
|
|
|
|
|
|
|
|
|
|
part_type_filename="$backup_basename.type"
|
|
part_type_filename="$backup_basename.type"
|
|
|
echo $part_type > $TARGET_DIR/$part_type_filename
|
|
echo $part_type > $TARGET_DIR/$part_type_filename
|
|
@@ -247,7 +242,7 @@ backup_mounted_volume(){
|
|
|
mountpoint_dir="/mnt/$mount_dir_name"
|
|
mountpoint_dir="/mnt/$mount_dir_name"
|
|
|
test "1" = "$VERBOSE" && echo "Mounting $partition_dev to $mountpoint_dir"
|
|
test "1" = "$VERBOSE" && echo "Mounting $partition_dev to $mountpoint_dir"
|
|
|
mkdir -p $mountpoint_dir
|
|
mkdir -p $mountpoint_dir
|
|
|
- mount $device_to_mount $mountpoint_dir
|
|
|
|
|
|
|
+ mount $partition_dev $mountpoint_dir
|
|
|
test "1" = "$VERBOSE" && echo "Backing up from $mountpoint_dir to $TARGET_DIR/$backup_filename"
|
|
test "1" = "$VERBOSE" && echo "Backing up from $mountpoint_dir to $TARGET_DIR/$backup_filename"
|
|
|
|
|
|
|
|
if [[ "$SKIP_TAR" != 1 ]] ; then
|
|
if [[ "$SKIP_TAR" != 1 ]] ; then
|
|
@@ -255,7 +250,7 @@ backup_mounted_volume(){
|
|
|
test "1" != "$DEBUG" && tar --numeric-owner $COMPRESSION_ALGORITHM $VERBOSE_OPTION $EXCLUDE_STRING -pcf $TARGET_DIR/$backup_filename -C $mountpoint_dir .
|
|
test "1" != "$DEBUG" && tar --numeric-owner $COMPRESSION_ALGORITHM $VERBOSE_OPTION $EXCLUDE_STRING -pcf $TARGET_DIR/$backup_filename -C $mountpoint_dir .
|
|
|
fi
|
|
fi
|
|
|
|
|
|
|
|
- umount $device_to_mount
|
|
|
|
|
|
|
+ umount $partition_dev
|
|
|
rmdir $mountpoint_dir
|
|
rmdir $mountpoint_dir
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -276,8 +271,8 @@ ensure_crypt_part_is_opened(){
|
|
|
|
|
|
|
|
#Now get the partition type and returns it
|
|
#Now get the partition type and returns it
|
|
|
part_type=`lsblk -l -n -o NAME,FSTYPE $partition_dev | grep $backup_basename | awk '{print $2}'`
|
|
part_type=`lsblk -l -n -o NAME,FSTYPE $partition_dev | grep $backup_basename | awk '{print $2}'`
|
|
|
- _RET=${part_type}
|
|
|
|
|
- _UNCRYPTED_VOL=$current_vol_name
|
|
|
|
|
|
|
+ _UNCRYPTED_TYPE=${part_type}
|
|
|
|
|
+ _UNCRYPTED_VOL=/dev/mapper/$current_vol_name
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
backup_disk(){
|
|
backup_disk(){
|
|
@@ -314,25 +309,21 @@ backup_disk(){
|
|
|
device_to_mount=""
|
|
device_to_mount=""
|
|
|
#Partition type
|
|
#Partition type
|
|
|
echo "Saving partition type"
|
|
echo "Saving partition type"
|
|
|
- part_type=`lsblk -no FSTYPE $partition_dev`
|
|
|
|
|
- echo "------ lsblk -lno NAME,FSTYPE $partition_dev | grep $DISK_DEVICE | awk '{print $2}'"
|
|
|
|
|
- lsblk -lno NAME,FSTYPE $partition_dev | grep $(basename $partition_dev) | awk '{print $2}'
|
|
|
|
|
- the_part_type=$(lsblk -lno NAME,FSTYPE $partition_dev | grep $(basename $partition_dev)|awk '{print $2}')
|
|
|
|
|
- echo "------"the_part_type=$the_part_type DISK_DEVICE=$DISK_DEVICE partition_dev=$partition_dev
|
|
|
|
|
-
|
|
|
|
|
|
|
+ part_type=`lsblk -lno NAME,FSTYPE $partition_dev | grep $(basename $partition_dev) | awk '{print $2}'`
|
|
|
#part_type=`lsblk -lno NAME,FSTYPE $partition_dev | grep $DISK_DEVICE | print '{print $2}'`
|
|
#part_type=`lsblk -lno NAME,FSTYPE $partition_dev | grep $DISK_DEVICE | print '{print $2}'`
|
|
|
case $part_type in
|
|
case $part_type in
|
|
|
- crypto_LUKS*)
|
|
|
|
|
|
|
+ crypto_LUKS)
|
|
|
#We extra steps here:
|
|
#We extra steps here:
|
|
|
#First decipher the luks partition:
|
|
#First decipher the luks partition:
|
|
|
echo '###'$part_type'###'
|
|
echo '###'$part_type'###'
|
|
|
ensure_crypt_part_is_opened $partition_dev $backup_basename
|
|
ensure_crypt_part_is_opened $partition_dev $backup_basename
|
|
|
- part_type=${_RET}
|
|
|
|
|
- echo '###'$part_type'###'
|
|
|
|
|
|
|
+ part_type=${_UNCRYPTED_TYPE}
|
|
|
|
|
+ echo '***'$part_type'***'
|
|
|
device_to_mount=${_UNCRYPTED_VOL}
|
|
device_to_mount=${_UNCRYPTED_VOL}
|
|
|
|
|
+ backup_mounted_volume $backup_basename $device_to_mount $part_type
|
|
|
;;
|
|
;;
|
|
|
*)
|
|
*)
|
|
|
- backup_mounted_volume $backup_basename $partition_dev $part_type $device_to_mount
|
|
|
|
|
|
|
+ backup_mounted_volume $backup_basename $partition_dev $part_type
|
|
|
;;
|
|
;;
|
|
|
esac
|
|
esac
|
|
|
done
|
|
done
|