From a9adb4c0d448662a2d7f1b6971cdf92b42b10c7f Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Tue, 8 Oct 2019 23:22:03 -0500 Subject: hscript: Add +opts+ member-var to Script class --- hscript/script.cc | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'hscript/script.cc') 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); } } -- cgit v1.2.3-60-g2f50