summaryrefslogtreecommitdiff
path: root/hscript/disk.cc
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2019-10-12 00:44:14 -0500
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2019-10-12 00:44:14 -0500
commit1f0a1dec1af315e6465e1c1dd503aa942a85b1f4 (patch)
treee8464d9f1e12d3366fa181a2c1dc95a68e817b9c /hscript/disk.cc
parent47558ea71d523fb71307d394be4bfad8da4664d8 (diff)
downloadhorizon-1f0a1dec1af315e6465e1c1dd503aa942a85b1f4.tar.gz
horizon-1f0a1dec1af315e6465e1c1dd503aa942a85b1f4.tar.bz2
horizon-1f0a1dec1af315e6465e1c1dd503aa942a85b1f4.tar.xz
horizon-1f0a1dec1af315e6465e1c1dd503aa942a85b1f4.zip
hscript: Pass opts to all validate()s, implement 'mount' validation
Diffstat (limited to 'hscript/disk.cc')
-rw-r--r--hscript/disk.cc14
1 files changed, 11 insertions, 3 deletions
diff --git a/hscript/disk.cc b/hscript/disk.cc
index 093c111..c0b0de9 100644
--- a/hscript/disk.cc
+++ b/hscript/disk.cc
@@ -12,6 +12,7 @@
#include <algorithm>
#include <string>
+#include <unistd.h>
#include "disk.hh"
#include "util/output.hh"
@@ -63,10 +64,17 @@ Key *Mount::parseFromData(const std::string data, int lineno, int *errors,
return new Mount(lineno, dev, where, opt);
}
-bool Mount::validate() const {
- return false;
+bool Mount::validate(ScriptOptions options) const {
+ /* We only validate if running in an Installation Environment. */
+ if(!options.test(InstallEnvironment)) return true;
+
+ /* XXX TODO: This will fail validation if the block device does not
+ * already exist. However, we must take in to account that block devices
+ * may not yet exist during the script validation phase. This check may
+ * need to happen in Script::validate like the Uniqueness tests. */
+ return(access(this->mountpoint().c_str(), F_OK));
}
-bool Mount::execute() const {
+bool Mount::execute(ScriptOptions) const {
return false;
}