summaryrefslogtreecommitdiff
path: root/hscript/meta.cc
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2019-11-02 16:16:41 -0500
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2019-11-02 16:16:41 -0500
commit9f422751407f2d100080a0075f8b2293b5a080bd (patch)
tree72aad62536cdff2e726fbf34971e16e42a77686a /hscript/meta.cc
parent3dbe0982a10c823a2793a3d125beba2edf75f1f7 (diff)
downloadhorizon-9f422751407f2d100080a0075f8b2293b5a080bd.tar.gz
horizon-9f422751407f2d100080a0075f8b2293b5a080bd.tar.bz2
horizon-9f422751407f2d100080a0075f8b2293b5a080bd.tar.xz
horizon-9f422751407f2d100080a0075f8b2293b5a080bd.zip
hscript: Handle creation of directories when needed
Diffstat (limited to 'hscript/meta.cc')
-rw-r--r--hscript/meta.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/hscript/meta.cc b/hscript/meta.cc
index fbd6f31..55316ac 100644
--- a/hscript/meta.cc
+++ b/hscript/meta.cc
@@ -135,6 +135,15 @@ bool Hostname::execute(ScriptOptions opts) const {
}
#ifdef HAS_INSTALL_ENV
else {
+ if(!fs::exists("/target/etc/conf.d")) {
+ error_code ec;
+ fs::create_directory("/target/etc/conf.d", ec);
+ if(ec) {
+ output_error("installfile:" + std::to_string(line),
+ "hostname: could not create /etc/conf.d "
+ "directory", ec.message());
+ }
+ }
std::ofstream net_conf_f("/target/etc/conf.d/net",
std::ios_base::app);
if(!net_conf_f) {