From 21ef748c92c10d10d670cd89655ff0b022069b60 Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Sat, 2 Nov 2019 16:34:09 -0500 Subject: hscript: More logging and dir creation --- hscript/meta.cc | 1 + hscript/network.cc | 6 ++++++ hscript/script.cc | 27 +++++++++++++++++++++++++++ 3 files changed, 34 insertions(+) diff --git a/hscript/meta.cc b/hscript/meta.cc index 55316ac..ad39083 100644 --- a/hscript/meta.cc +++ b/hscript/meta.cc @@ -130,6 +130,7 @@ bool Hostname::execute(ScriptOptions opts) const { output_info("installfile:" + std::to_string(this->lineno()), "hostname: set domain name '" + domain + "'"); if(opts.test(Simulate)) { + std::cout << "mkdir -p /target/etc/conf.d" << std::endl; std::cout << "printf 'dns_domain_lo=\"" << domain << "\"\\" << "n' >> /target/etc/conf.d/net" << std::endl; } diff --git a/hscript/network.cc b/hscript/network.cc index 2f4111e..f728aef 100644 --- a/hscript/network.cc +++ b/hscript/network.cc @@ -266,6 +266,9 @@ bool NetAddress::validate(ScriptOptions opts) const { } bool NetAddress::execute(ScriptOptions) const { + output_info("installfile:" + std::to_string(this->lineno()), + "netaddress: adding configuration for " + _iface); + std::ofstream config("/tmp/horizon/netifrc/config_" + this->iface(), std::ios_base::app); if(!config) { @@ -477,6 +480,9 @@ bool NetSSID::validate(ScriptOptions options) const { } bool NetSSID::execute(ScriptOptions) const { + output_info("installfile:" + std::to_string(this->lineno()), + "netssid: configuring SSID " + _ssid); + std::ofstream conf("/tmp/horizon/wpa_supplicant.conf", std::ios_base::app); if(!conf) { diff --git a/hscript/script.cc b/hscript/script.cc index 841c546..6eebae8 100644 --- a/hscript/script.cc +++ b/hscript/script.cc @@ -1224,11 +1224,29 @@ bool Script::execute() const { /**************** PRE PACKAGE METADATA ****************/ output_step_start("pre-metadata"); + + /* REQ: Runner.Execute.hostname */ if(!this->internal->hostname->execute(opts)) { EXECUTE_FAILURE("pre-metadata"); return false; } + /* REQ: Runner.Execute.repository */ + if(opts.test(Simulate)) { + std::cout << "mkdir -p /target/etc/apk" << std::endl; + } +#ifdef HAS_INSTALL_ENV + else { + if(!fs::exists("/target/etc/apk", ec)) { + fs::create_directory("/target/etc/apk", ec); + if(ec) { + output_error("internal", "failed to initialise APK"); + EXECUTE_FAILURE("pre-metadata"); + return false; + } + } + } +#endif /* HAS_INSTALL_ENV */ for(auto &repo : this->internal->repos) { if(!repo->execute(opts)) { EXECUTE_FAILURE("pre-metadata"); @@ -1324,6 +1342,7 @@ bool Script::execute() const { } if(opts.test(Simulate)) { + std::cout << "mkdir -p /target/etc/conf.d" << std::endl; std::cout << "cat >>/target/etc/conf.d/net <<- NETCONF_EOF" << std::endl << conf.str() << std::endl << "NETCONF_EOF" << std::endl; @@ -1389,6 +1408,14 @@ bool Script::execute() const { /**************** PKGDB ****************/ output_step_start("pkgdb"); + /* REQ: Runner.Execute.signingkey */ + for(auto &key : this->internal->repo_keys) { + if(!key->execute(opts)) { + EXECUTE_FAILURE("pkgdb"); + return false; + } + } + /* REQ: Runner.Execute.pkginstall.APKDB */ output_info("internal", "initialising APK"); if(opts.test(Simulate)) { -- cgit v1.2.3-70-g09d2