mirror of
https://0xacab.org/liberate/backupninja.git
synced 2024-11-10 04:42:31 +01:00
Merge branch 'fix_11316' into 'master'
Support LUKS v2 headers, fixes #11316 Closes #11316 See merge request riseuplabs/backupninja!47
This commit is contained in:
commit
ac8b41eb87
@ -639,8 +639,10 @@ if [ "$partitions" == "yes" ]; then
|
||||
fi
|
||||
|
||||
if [ "$luksheaders" == "yes" ]; then
|
||||
devices=`LC_ALL=C $SFDISK -l 2>/dev/null | grep -E '^(Disk )?/dev/' | @SED@ -e 's/Disk //' -re 's/:? +.*//g'`
|
||||
[ -n "$devices" ] || warning "No block device found"
|
||||
devices=`LC_ALL=C $LSBLK --output NAME,TYPE --list --paths 2>/dev/null | grep "disk$" | grep -v '^/dev/zram' | @AWK@ '{print $1}'`
|
||||
if [ "$devices" == "" ]; then
|
||||
warning "No harddisks found"
|
||||
fi
|
||||
partitions=`LC_ALL=C $SFDISK -l 2>/dev/null |grep "^/dev" | @AWK@ '{print $1}'`
|
||||
[ -n "$partitions" ] || warning "No partitions found"
|
||||
targetdevices=""
|
||||
@ -654,20 +656,9 @@ if [ "$luksheaders" == "yes" ]; then
|
||||
label=${dev#/dev/}
|
||||
label=${label//\//-}
|
||||
outputfile=${luksheadersfile//__star__/$label}
|
||||
# the following sizes are expressed in terms of 512-byte sectors
|
||||
debug "Let us find out the LUKS header size for $dev"
|
||||
debug "$CRYPTSETUP luksDump \"$dev\" | grep '^Payload offset:' | @AWK@ '{print $3}'"
|
||||
headersize=`$CRYPTSETUP luksDump "$dev" | grep '^Payload offset:' | @AWK@ '{print $3}'`
|
||||
if [ $? -ne 0 ]; then
|
||||
warning "Could not compute the size of LUKS header, skipping $dev"
|
||||
continue
|
||||
elif [ -z "$headersize" -o -n "`echo \"$headersize\" | @SED@ 's/[0-9]*//g'`" ]; then
|
||||
warning "The computed size of LUKS header is not an integer, skipping $dev"
|
||||
continue
|
||||
fi
|
||||
debug "Let us backup the LUKS header of $dev"
|
||||
debug "$DD if=\"${dev}\" of=\"${outputfile}\" bs=512 count=\"${headersize}\""
|
||||
output=`$DD if="${dev}" of="${outputfile}" bs=512 count="${headersize}" 2>&1`
|
||||
debug "$CRYPTSETUP luksHeaderBackup \"${dev}\" --header-backup-file \"${outputfile}\""
|
||||
output=`$CRYPTSETUP luksHeaderBackup "${dev}" --header-backup-file "${outputfile}" 2>&1`
|
||||
exit_code=$?
|
||||
if [ $exit_code -eq 0 ]; then
|
||||
debug "$output"
|
||||
|
Loading…
Reference in New Issue
Block a user