diff options
author | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2020-03-15 01:54:20 -0500 |
---|---|---|
committer | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2020-03-15 01:54:20 -0500 |
commit | 28c81a32aa59a9b2d39ddd7f86fb1d2677da32cc (patch) | |
tree | 3ef9b9578812bd90cafa6164843e52f89c72c460 | |
parent | a42230d6351db5f3dab0ce2820006a84495200e3 (diff) | |
download | horizon-28c81a32aa59a9b2d39ddd7f86fb1d2677da32cc.tar.gz horizon-28c81a32aa59a9b2d39ddd7f86fb1d2677da32cc.tar.bz2 horizon-28c81a32aa59a9b2d39ddd7f86fb1d2677da32cc.tar.xz horizon-28c81a32aa59a9b2d39ddd7f86fb1d2677da32cc.zip |
hscript: Mount /dev, /proc, /sys under /target
-rw-r--r-- | hscript/script_e.cc | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/hscript/script_e.cc b/hscript/script_e.cc index acaffda..2b9f8f4 100644 --- a/hscript/script_e.cc +++ b/hscript/script_e.cc @@ -16,6 +16,7 @@ #include <string> #ifdef HAS_INSTALL_ENV # include <parted/parted.h> +# include <sys/mount.h> #endif /* HAS_INSTALL_ENV */ #include "script.hh" @@ -155,6 +156,30 @@ bool Script::execute() const { } #ifdef HAS_INSTALL_ENV if(opts.test(InstallEnvironment)) ped_device_free_all(); + + if(!opts.test(Simulate)) { + if(!fs::exists(targetDirectory() + "/dev", ec)) { + fs::create_directory(targetDirectory() + "/dev", ec); + } + if(mount("/dev", "/target/dev", 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(mount("none", "/target/proc", "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(mount("none", "/target/sys", "sysfs", 0, nullptr) != 0) { + output_warning("internal", "target sysfs could not be mounted"); + } + } #endif /* HAS_INSTALL_ENV */ output_step_end("disk"); |