summaryrefslogtreecommitdiff
path: root/hscript/script.cc
diff options
context:
space:
mode:
Diffstat (limited to 'hscript/script.cc')
-rw-r--r--hscript/script.cc28
1 files changed, 28 insertions, 0 deletions
diff --git a/hscript/script.cc b/hscript/script.cc
index 1bb2176..93d8cb4 100644
--- a/hscript/script.cc
+++ b/hscript/script.cc
@@ -121,9 +121,13 @@ struct Script::ScriptPrivate {
} else if(key_name == "rootpw") {
/*! TODO: implement */
return false;
+ } else if(key_name == "mount") {
+ /*! TODO: implement */
+ return false;
} else {
return false;
}
+#undef DUPLICATE_ERROR
}
};
@@ -232,6 +236,30 @@ const Script *Script::load(std::istream &sstream, const ScriptOptions opts) {
errors++;
}
+ /* Ensure no required keys are missing. */
+#define MISSING_ERROR(key) \
+ output_error("installfile:" + std::to_string(lineno),\
+ "expected value for key '" + key + "'",\
+ "this key is required", (opts.test(Pretty)));\
+ errors++;
+
+ if(!the_script->internal->network) {
+ MISSING_ERROR(std::string("network"))
+ }
+ if(!the_script->internal->hostname) {
+ MISSING_ERROR(std::string("hostname"))
+ }
+ if(the_script->internal->packages.size() == 0) {
+ MISSING_ERROR(std::string("pkginstall"))
+ }
+ if(!the_script->internal->rootpw) {
+ MISSING_ERROR(std::string("rootpw"))
+ }
+ if(the_script->internal->mounts.size() == 0) {
+ MISSING_ERROR(std::string("mount"))
+ }
+#undef MISSING_ERROR
+
output_message("parser", "0", "installfile",
std::to_string(errors) + " error(s), " +
std::to_string(warnings) + " warning(s).",