summaryrefslogtreecommitdiff
path: root/hscript/disk.cc
diff options
context:
space:
mode:
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;
}