diff options
author | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2019-10-08 23:22:03 -0500 |
---|---|---|
committer | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2019-10-08 23:22:03 -0500 |
commit | a9adb4c0d448662a2d7f1b6971cdf92b42b10c7f (patch) | |
tree | be194585bdd38a06cedb542d80f81650a6503d49 /hscript | |
parent | cf2867874149ff6fd6c14b2fd3d842dab37f7a98 (diff) | |
download | horizon-a9adb4c0d448662a2d7f1b6971cdf92b42b10c7f.tar.gz horizon-a9adb4c0d448662a2d7f1b6971cdf92b42b10c7f.tar.bz2 horizon-a9adb4c0d448662a2d7f1b6971cdf92b42b10c7f.tar.xz horizon-a9adb4c0d448662a2d7f1b6971cdf92b42b10c7f.zip |
hscript: Add +opts+ member-var to Script class
Diffstat (limited to 'hscript')
-rw-r--r-- | hscript/script.cc | 20 | ||||
-rw-r--r-- | hscript/script.hh | 1 |
2 files changed, 20 insertions, 1 deletions
diff --git a/hscript/script.cc b/hscript/script.cc index d8510b6..90e6774 100644 --- a/hscript/script.cc +++ b/hscript/script.cc @@ -286,12 +286,30 @@ const Script *Script::load(std::istream &sstream, const ScriptOptions opts) { delete the_script; return nullptr; } else { + the_script->opts = opts; return the_script; } } bool Script::validate() const { - return false; + int failures = 0; + if(!this->internal->network->validate()) failures++; + if(!this->internal->hostname->validate()) failures++; + if(!this->internal->rootpw->validate()) failures++; + for(auto &mount : this->internal->mounts) { + if(!mount->validate()) { + failures++; + continue; + } + /* TODO requirements to implement: + * Runner.Validate.mount.Unique. + * Runner.Validate.mount.Root. + */ + if(this->opts.test(InstallEnvironment)) { + /* TODO: Runner.Validate.mount.Block. */ + } + } + return (failures == 0); } } diff --git a/hscript/script.hh b/hscript/script.hh index 65637c2..16c2ab4 100644 --- a/hscript/script.hh +++ b/hscript/script.hh @@ -46,6 +46,7 @@ class Script { private: /*! Initialise the Script class. */ Script(); + ScriptOptions opts; public: /*! Load a HorizonScript from the specified path. * @param path The path to load from. |