Merge branch '11293-partition_table_backup' into 'master'

Do not try to dump partition tables for a disk when non are detected

Closes #11293

See merge request riseuplabs/backupninja!22
This commit is contained in:
lavamind 2020-12-30 09:57:28 -08:00
commit 0491432147

View File

@ -609,12 +609,18 @@ fi
if [ "$partitions" == "yes" ]; then
if [ "$dosfdisk" == "yes" ]; then
devices=`LC_ALL=C $LSBLK --output NAME,TYPE --list --paths 2>/dev/null | grep "disk$" | grep -v '^/dev/zram' | @AWK@ '{print $1}'`
partitions=`LC_ALL=C $SFDISK -l 2>/dev/null |grep "^/dev" | @AWK@ '{print $1}'`
if [ "$devices" == "" ]; then
warning "No harddisks found"
fi
for dev in $devices; do
debug "$SFDISK will try to backup partition tables for device $dev"
[ -b $dev ] || continue
echo "${partitions}" | grep -q "${dev}"
if [ $? -ne 0 ] ; then
info "The device $dev does not appear to have any partitions"
continue
fi
label=${dev#/dev/}
label=${label//\//-}
outputfile=${partitionsfile//__star__/$label}