summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hscript/script_e.cc22
1 files changed, 13 insertions, 9 deletions
diff --git a/hscript/script_e.cc b/hscript/script_e.cc
index 829d672..8c857d7 100644
--- a/hscript/script_e.cc
+++ b/hscript/script_e.cc
@@ -162,25 +162,29 @@ bool Script::execute() const {
if(opts.test(InstallEnvironment)) ped_device_free_all();
if(!opts.test(Simulate)) {
- if(!fs::exists(targetDirectory() + "/dev", ec)) {
- fs::create_directory(targetDirectory() + "/dev", ec);
+ const std::string devpath = targetDirectory() + "/dev";
+ const std::string procpath = targetDirectory() + "/proc";
+ const std::string syspath = targetDirectory() + "/sys";
+
+ if(!fs::exists(devpath, ec)) {
+ fs::create_directory(devpath, ec);
}
- if(mount("/dev", "/target/dev", nullptr, MS_BIND, nullptr) != 0) {
+ if(mount("/dev", devpath.c_str(), nullptr, MS_BIND, nullptr) != 0) {
output_warning("internal", "could not bind-mount /dev; "
"bootloader configuration may fail");
}
- if(!fs::exists(targetDirectory() + "/proc", ec)) {
- fs::create_directory(targetDirectory() + "/proc", ec);
+ if(!fs::exists(procpath, ec)) {
+ fs::create_directory(procpath, ec);
}
- if(mount("none", "/target/proc", "proc", 0, nullptr) != 0) {
+ if(mount("none", procpath.c_str(), "proc", 0, nullptr) != 0) {
output_warning("internal", "target procfs could not be mounted");
}
- if(!fs::exists(targetDirectory() + "/sys", ec)) {
- fs::create_directory(targetDirectory() + "/sys", ec);
+ if(!fs::exists(syspath, ec)) {
+ fs::create_directory(syspath, ec);
}
- if(mount("none", "/target/sys", "sysfs", 0, nullptr) != 0) {
+ if(mount("none", syspath.c_str(), "sysfs", 0, nullptr) != 0) {
output_warning("internal", "target sysfs could not be mounted");
}
}