in src/distro.rs [188:236]
fn build_logical_volume_details(part: &mut [PartInfo], cli_info: &CliInfo, distro: &mut Distro) {
let mut lv: Vec<LogicalVolume> = Vec::new();
part.iter_mut()
.filter(|lvm| lvm.part_type == "8E00")
.for_each(|part| {
let lvm_partition = format!(
"{}{}",
helper::get_recovery_disk_path(cli_info),
part.number
);
match mount::importvg(cli_info, part.number) {
Ok(_) => {}
Err(e) => {
error!("Error importing VG: {e}");
process::exit(1);
}
}
if log::log_enabled!(log::Level::Debug) {
let lvscan = helper::run_fun("lvscan").unwrap();
debug!("lvscan after running importvg ");
lvscan.lines().for_each(|line| debug!("{:#?}", line));
}
let lv_detail =
helper::run_fun(&format!("lsblk -ln {} -o NAME,FSTYPE | sed '1d'", lvm_partition));
let lv_detail_string =
lv_detail.expect("lsblk shouldn't raise an error when getting fs information");
debug!(
"build_logical_volume_details: 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(),
});
}
part.logical_volumes = LogicalVolumesType::Some(lv.clone());
distro.is_lvm = true;
});
}