Blob Blame Raw
diff --git a/libexec/mods/linux_build.smod b/libexec/mods/linux_build.smod
index 196a96f..c5ebc32 100644
--- a/libexec/mods/linux_build.smod
+++ b/libexec/mods/linux_build.smod
@@ -40,6 +40,11 @@ Bootstrap() {
         echo "Bootstrap: You must first call 'DistType'!" >&2
         exit 5
     fi
+
+    __mount_proc
+    __mount_dev
+    __mount_sys
+
     return 0
 }
 
@@ -166,6 +171,7 @@ RunCmd() {
     return 0
 }
 
+
 Finalize() {
     for i in $EMPTY_FILES; do
         if [ ! -f "$SINGULARITY_BUILD_ROOT/$i" ]; then
@@ -186,3 +192,22 @@ Finalize() {
     fi
     echo "singularity / rootfs rw 0 0" > "$SINGULARITY_BUILD_ROOT/etc/mtab"
 }
+
+
+__mount_dev() {
+    if [ -d "/dev" -a -d "$SINGULARITY_BUILD_ROOT/dev" ]; then
+        mount --rbind "/dev" "$SINGULARITY_BUILD_ROOT/dev"
+    fi
+}
+__mount_proc() {
+    if [ -d "/proc" -a -d "$SINGULARITY_BUILD_ROOT/proc" ]; then
+        mount --rbind "/proc" "$SINGULARITY_BUILD_ROOT/proc"
+    fi
+}
+__mount_sys() {
+    if [ -d "/sys" -a -d "$SINGULARITY_BUILD_ROOT/sys" ]; then
+        mount --rbind "/sys" "$SINGULARITY_BUILD_ROOT/sys"
+    fi
+}
+
+
diff --git a/libexec/mods/linux_build_debian.smod b/libexec/mods/linux_build_debian.smod
index 27825c0..0ddadd4 100644
--- a/libexec/mods/linux_build_debian.smod
+++ b/libexec/mods/linux_build_debian.smod
@@ -59,6 +59,10 @@ Bootstrap() {
         fi
     fi
 
+    __mount_proc
+    __mount_dev
+    __mount_sys
+
     return 0
 }
 
diff --git a/libexec/mods/linux_build_redhat.smod b/libexec/mods/linux_build_redhat.smod
index a5a5fad..443f290 100644
--- a/libexec/mods/linux_build_redhat.smod
+++ b/libexec/mods/linux_build_redhat.smod
@@ -82,6 +82,10 @@ Bootstrap() {
         exit 1
     fi
 
+    __mount_proc
+    __mount_dev
+    __mount_sys
+
     return 0
 }