diff options
author | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2019-11-01 18:52:27 -0500 |
---|---|---|
committer | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2019-11-01 18:52:27 -0500 |
commit | 447ceb902c7a34d8d9bb9594a67848c13c61ad9f (patch) | |
tree | 1633d9a20a66cc832dcd0d766c03092fc67ee3a6 | |
parent | 8bd47a3f42ff1cd9ae2252c7ef17639f57fe6250 (diff) | |
download | horizon-447ceb902c7a34d8d9bb9594a67848c13c61ad9f.tar.gz horizon-447ceb902c7a34d8d9bb9594a67848c13c61ad9f.tar.bz2 horizon-447ceb902c7a34d8d9bb9594a67848c13c61ad9f.tar.xz horizon-447ceb902c7a34d8d9bb9594a67848c13c61ad9f.zip |
hscript: Start calling execute on the disk keys
-rw-r--r-- | hscript/script.cc | 62 |
1 files changed, 57 insertions, 5 deletions
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 <fstream> #include <iostream> #include <map> +#ifdef HAS_INSTALL_ENV +# include <parted/parted.h> +#endif /* HAS_INSTALL_ENV */ #include <set> #include <sstream> @@ -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<Keys::Partition> const &e1, + std::unique_ptr<Keys::Partition> 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 ****************/ |