diff options
-rw-r--r-- | hscript/disk.cc | 20 | ||||
-rw-r--r-- | tests/kvm.installfile | 10 |
2 files changed, 24 insertions, 6 deletions
diff --git a/hscript/disk.cc b/hscript/disk.cc index 1aaf45f..35936ac 100644 --- a/hscript/disk.cc +++ b/hscript/disk.cc @@ -482,6 +482,10 @@ bool Partition::validate(ScriptOptions opts) const { } bool Partition::execute(ScriptOptions opts) const { + output_info("installfile:" + std::to_string(this->lineno()), + "partition: creating partition #" + std::to_string(_partno) + + " on " + _block); + if(opts.test(Simulate)) { output_error("installfile:" + std::to_string(this->lineno()), "partition: Not supported in Simulation mode"); @@ -826,6 +830,9 @@ bool Filesystem::execute(ScriptOptions opts) const { std::string cmd; std::vector<std::string> args; + output_info("installfile:" + std::to_string(line), + "fs: creating new filesystem on " + _block); + switch(_type) { case Ext2: cmd = "mkfs.ext2"; @@ -870,7 +877,7 @@ bool Filesystem::execute(ScriptOptions opts) const { } #ifdef HAS_INSTALL_ENV - const char **argv = new const char*[args.size() + 1]; + const char **argv = new const char*[args.size() + 2]; pid_t child; int status; @@ -878,13 +885,14 @@ bool Filesystem::execute(ScriptOptions opts) const { for(unsigned long index = 0; index < args.size(); index++) { argv[index + 1] = args.at(index).c_str(); } + argv[args.size() + 1] = nullptr; status = posix_spawnp(&child, cmd.c_str(), nullptr, nullptr, - const_cast<char * const *>(argv), nullptr); + const_cast<char * const *>(argv), environ); if(status != 0) { /* extremely unlikely failure case */ output_error("installfile:" + std::to_string(this->lineno()), - "filesystem: cannot fork", strerror(status)); + "fs: cannot fork", strerror(status)); delete[] argv; return false; } @@ -894,13 +902,13 @@ bool Filesystem::execute(ScriptOptions opts) const { if(waitpid(child, &status, 0) == -1) { /* unlikely failure case */ output_error("installfile:" + std::to_string(this->lineno()), - "filesystem: waitpid", strerror(errno)); + "fs: waitpid", strerror(errno)); return false; } if(!WIFEXITED(status)) { output_error("installfile:" + std::to_string(this->lineno()), - "filesystem: received fatal signal " + + "fs: received fatal signal " + std::to_string(WTERMSIG(status)) + " while running " + cmd); return false; @@ -908,7 +916,7 @@ bool Filesystem::execute(ScriptOptions opts) const { if(WEXITSTATUS(status) != 0) { output_error("installfile:" + std::to_string(this->lineno()), - "filesystem: " + cmd + " exited with status " + + "fs: " + cmd + " exited with status " + std::to_string(WEXITSTATUS(status))); return false; } diff --git a/tests/kvm.installfile b/tests/kvm.installfile new file mode 100644 index 0000000..5d54116 --- /dev/null +++ b/tests/kvm.installfile @@ -0,0 +1,10 @@ +hostname horizonkvmtest-ppc64.adelielinux.org +rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/ +network true +netaddress eth0 dhcp +diskid /dev/sda QEMU_HARDDISK +disklabel /dev/sda gpt +partition /dev/sda 1 fill +fs /dev/sda1 ext4 +mount /dev/sda1 / +pkginstall adelie-base-posix |