summaryrefslogtreecommitdiff
path: root/hscript/script_e.cc
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2020-06-23 01:11:14 -0500
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2020-06-23 01:11:14 -0500
commitca5486725468e69569ff352d0d075e8081e1e22d (patch)
tree1db6c4c9561cec5191462296eae5dd5cf150c549 /hscript/script_e.cc
parent6a5af0c939b2f60a739b1a9a7e2514036b1d94fd (diff)
downloadhorizon-ca5486725468e69569ff352d0d075e8081e1e22d.tar.gz
horizon-ca5486725468e69569ff352d0d075e8081e1e22d.tar.bz2
horizon-ca5486725468e69569ff352d0d075e8081e1e22d.tar.xz
horizon-ca5486725468e69569ff352d0d075e8081e1e22d.zip
hscript: Recursively bind-mount /dev and /sys
We need this for /dev/shm to be present in the target. We need to bind-mount /sys recursively for efivarfs to be available for GRUB's use in the target. While we're here, unmount /dev and /sys recursively when creating an image.
Diffstat (limited to 'hscript/script_e.cc')
-rw-r--r--hscript/script_e.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/hscript/script_e.cc b/hscript/script_e.cc
index 5917b19..cf004a0 100644
--- a/hscript/script_e.cc
+++ b/hscript/script_e.cc
@@ -169,7 +169,8 @@ bool Script::execute() const {
if(!fs::exists(devpath, ec)) {
fs::create_directory(devpath, ec);
}
- if(mount("/dev", devpath.c_str(), nullptr, MS_BIND, nullptr) != 0) {
+ if(mount("/dev", devpath.c_str(), nullptr, MS_BIND | MS_REC,
+ nullptr) != 0) {
output_warning("internal", "could not bind-mount /dev; "
"bootloader configuration may fail");
}
@@ -184,7 +185,8 @@ bool Script::execute() const {
if(!fs::exists(syspath, ec)) {
fs::create_directory(syspath, ec);
}
- if(mount("none", syspath.c_str(), "sysfs", 0, nullptr) != 0) {
+ if(mount("/sys", syspath.c_str(), nullptr, MS_BIND | MS_REC,
+ nullptr) != 0) {
output_warning("internal", "target sysfs could not be mounted");
}
}