From 447ceb902c7a34d8d9bb9594a67848c13c61ad9f Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Fri, 1 Nov 2019 18:52:27 -0500 Subject: hscript: Start calling execute on the disk keys --- hscript/script.cc | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 57 insertions(+), 5 deletions(-) (limited to 'hscript') diff --git a/hscript/script.cc b/hscript/script.cc index cc819e4..e253dbe 100644 --- a/hscript/script.cc +++ b/hscript/script.cc @@ -16,6 +16,9 @@ #include #include #include +#ifdef HAS_INSTALL_ENV +# include +#endif /* HAS_INSTALL_ENV */ #include #include @@ -1130,6 +1133,9 @@ bool Script::execute() const { /**************** DISK SETUP ****************/ output_step_start("disk"); +#ifdef HAS_INSTALL_ENV + if(opts.test(InstallEnvironment)) ped_device_probe_all(); +#endif /* HAS_INSTALL_ENV */ /* REQ: Runner.Execute.diskid */ for(auto &diskid : this->internal->diskids) { if(!diskid->execute(opts)) { @@ -1146,13 +1152,56 @@ bool Script::execute() const { } } - /* partition */ + /* REQ: Runner.Execute.partition */ + /* Ensure partitions are created in on-disk order. */ + std::sort(this->internal->partitions.begin(), this->internal->partitions.end(), + [](std::unique_ptr const &e1, + std::unique_ptr const &e2) { + return (e1->device() + "p" + std::to_string(e1->partno())) < + (e2->device() + "p" + std::to_string(e2->partno())); + }); + for(auto &part : this->internal->partitions) { + if(!part->execute(opts)) { + EXECUTE_FAILURE("disk"); + return false; + } + } + /* encrypt PVs */ - /* lvm_pv */ - /* lvm_vg */ - /* lvm_lv */ + + /* REQ: Runner.Execute.lvm_pv */ + for(auto &pv : this->internal->lvm_pvs) { + if(!pv->execute(opts)) { + EXECUTE_FAILURE("disk"); + return false; + } + } + + /* REQ: Runner.Execute.lvm_vg */ + for(auto &vg : this->internal->lvm_vgs) { + if(!vg->execute(opts)) { + EXECUTE_FAILURE("disk"); + return false; + } + } + + /* REQ: Runner.Execute.lvm_lv */ + for(auto &lv : this->internal->lvm_lvs) { + if(!lv->execute(opts)) { + EXECUTE_FAILURE("disk"); + return false; + } + } + /* encrypt */ - /* fs */ + + /* REQ: Runner.Execute.fs */ + for(auto &fs : this->internal->fses) { + if(!fs->execute(opts)) { + EXECUTE_FAILURE("disk"); + return false; + } + } /* REQ: Runner.Execute.mount */ /* Sort by mountpoint. @@ -1168,6 +1217,9 @@ bool Script::execute() const { return false; } } +#ifdef HAS_INSTALL_ENV + if(opts.test(InstallEnvironment)) ped_device_free_all(); +#endif /* HAS_INSTALL_ENV */ output_step_end("disk"); /**************** PRE PACKAGE METADATA ****************/ -- cgit v1.2.3-70-g09d2