From bad42ab94bb518b334521ac5394421e6513d55d8 Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Tue, 29 Oct 2019 10:54:50 -0500 Subject: hscript: Only use LVMGroup::test_pv in install env builds --- hscript/disk.cc | 4 ++++ hscript/script.cc | 2 ++ 2 files changed, 6 insertions(+) diff --git a/hscript/disk.cc b/hscript/disk.cc index 634e56f..bec5d3e 100644 --- a/hscript/disk.cc +++ b/hscript/disk.cc @@ -531,6 +531,7 @@ bool LVMGroup::validate(ScriptOptions) const { } bool LVMGroup::test_pv(ScriptOptions) const { +#ifdef HAS_INSTALL_ENV const char *fstype = blkid_get_tag_value(nullptr, "TYPE", this->pv().c_str()); if(fstype == nullptr) { @@ -539,6 +540,9 @@ bool LVMGroup::test_pv(ScriptOptions) const { } return (strcmp(fstype, "LVM2_member") == 0); +#else + return true; +#endif } bool LVMGroup::execute(ScriptOptions) const { diff --git a/hscript/script.cc b/hscript/script.cc index 9913b2a..357ed15 100644 --- a/hscript/script.cc +++ b/hscript/script.cc @@ -872,12 +872,14 @@ bool Script::validate() const { if(seen_pvs.find(vg->pv()) == seen_pvs.end()) { /* Okay, let's see if a PV already exists there... */ if(opts.test(InstallEnvironment)) { +#ifdef HAS_INSTALL_ENV if(!vg->test_pv(opts)) { failures++; output_error("installfile:" + std::to_string(vg->lineno()), "lvm_vg: a physical volume does not exist on " + vg->pv()); } +#endif } else { /* We can't tell if we aren't running on the target. */ output_warning("installfile:" + std::to_string(vg->lineno()), -- cgit v1.2.3-60-g2f50