[partition] Generate partition paths with /dev/

Returning partition full-paths instead of only the block-device-name
simplifies later code -- which would prepend /dev/ to the block-
device-name and umount that.
This commit is contained in:
Adriaan de Groot 2021-11-01 20:52:24 +01:00
parent 6c2b2b0daa
commit e56158f5b4

View File

@ -34,7 +34,7 @@ using CalamaresUtils::Partition::PartitionIterator;
* *
* The @p deviceName is a (whole-block) device, like "sda", and the partitions * The @p deviceName is a (whole-block) device, like "sda", and the partitions
* returned are then "sdaX". The whole-block device itself is ignored, if * returned are then "sdaX". The whole-block device itself is ignored, if
* present. * present. Partitions are returned with their full /dev/ path (e.g. /dev/sda1).
* *
* The format for /etc/partitions is, e.g. * The format for /etc/partitions is, e.g.
* major minor #blocks name * major minor #blocks name
@ -60,7 +60,7 @@ getPartitionsForDevice( const QString& deviceName )
if ( ( columns.count() >= 4 ) && ( columns[ 3 ].startsWith( deviceName ) ) if ( ( columns.count() >= 4 ) && ( columns[ 3 ].startsWith( deviceName ) )
&& ( columns[ 3 ] != deviceName ) ) && ( columns[ 3 ] != deviceName ) )
{ {
partitions.append( columns[ 3 ] ); partitions.append( QStringLiteral( "/dev/" ) + columns[ 3 ] );
} }
} }
} }
@ -285,8 +285,7 @@ ClearMountsJob::exec()
} }
apply( getCryptoDevices(), tryCryptoClose, goodNews ); apply( getCryptoDevices(), tryCryptoClose, goodNews );
apply( apply( partitionsList, tryUmount, goodNews );
partitionsList, []( const QString& p ) { return tryUmount( QString( "/dev/%1" ).arg( p ) ); }, goodNews );
apply( swapPartitions, tryClearSwap, goodNews ); apply( swapPartitions, tryClearSwap, goodNews );
Calamares::JobResult ok = Calamares::JobResult::ok(); Calamares::JobResult ok = Calamares::JobResult::ok();