in src/distro.rs [593:638]
fn ade_prepare_lv(partition_details: &mut [PartInfo], distro: &mut Distro) {
info!(
"ADE is enabled. Collecting LV details from the ADE disk if an LVM signature is found."
);
let crypt_partition: &mut PartInfo = partition_details
.iter_mut()
.find(|part| part.fstype == "crypt?")
.unwrap();
// if the partition is not a LVM partition we don't need to proceed
if crypt_partition.part_type != "8E00" {
info!("No LVM partition found on the ADE disk.");
return;
} else {
crypt_partition.fstype = "LVM2_member".to_string();
distro.is_lvm = true;
}
let mut lv: Vec<LogicalVolume> = Vec::new();
let lv_detail =
helper::run_fun(&format!("lsblk -ln {} -o NAME,FSTYPE | sed '1d'", constants::ADE_OSENCRYPT_PATH));
let lv_detail_string =
lv_detail.expect("lsblk shouldn't raise an error when getting fs information");
debug!(
" ade_prepare_lv :: lv_detail_string: {:?}",
&lv_detail_string
);
for line in lv_detail_string.lines() {
let mut v: Vec<&str> = line.trim().split(' ').collect();
v.retain(|&x| !x.is_empty());
lv.push(LogicalVolume {
name: v[0].to_string(),
fstype: v[1].to_string(),
});
}
crypt_partition.logical_volumes = LogicalVolumesType::Some(lv);
debug!(
"LV partition collected on the ADE eneabled disk/partition: {:#?}",
&partition_details
);
}