summaryrefslogtreecommitdiff
path: root/hscript
diff options
context:
space:
mode:
Diffstat (limited to 'hscript')
-rw-r--r--hscript/meta.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/hscript/meta.cc b/hscript/meta.cc
index ab8bdb5..dc17290 100644
--- a/hscript/meta.cc
+++ b/hscript/meta.cc
@@ -104,11 +104,19 @@ bool Hostname::execute() const {
/* Runner.Execute.hostname.Write. */
output_info(pos, "hostname: write '" + actual + "' to /etc/hostname");
if(script->options().test(Simulate)) {
+ std::cout << "mkdir -p " << script->targetDirectory() << "/etc"
+ << std::endl;
std::cout << "printf '%s' " << actual << " > "
<< script->targetDirectory() << "/etc/hostname" << std::endl;
}
#ifdef HAS_INSTALL_ENV
else {
+ error_code ec;
+ fs::create_directory(script->targetDirectory() + "/etc", ec);
+ if(ec && ec.value() != EEXIST) {
+ output_error(pos, "hostname: could not create /etc", ec.message());
+ return false;
+ }
std::ofstream hostname_f(script->targetDirectory() + "/etc/hostname",
std::ios_base::trunc);
if(!hostname_f) {