Optionally mount artifact cache.
This change makes the behavior off by default, but can be enabled by
setting the `MOUNT_ARTIFACT_CACHE` environment variable in development.
@@ -28,6 +28,8 @@ use mount::{self, Mount};
use filesystem;
use pty;
+const MOUNT_ARTIFACT_CACHE_ENVVAR: &'static str = "MOUNT_ARTIFACT_CACHE";
+
const ROOTFS_DIRS: &'static [&'static str] = &[
"etc",
"run",
@@ -185,6 +187,7 @@ pub fn run(rootfs: &Path, cmd: &str, args: Vec<OsString>) -> Result<()> {
Some(libc::MS_RDONLY),
)?;
+ if env::var(MOUNT_ARTIFACT_CACHE_ENVVAR).is_ok() {
// Bind mount outside artifact cache (and ensure outside directory exists)
let source = env::home_dir().ok_or(Error::HomeDirectoryNotFound)?.join(
".hab/cache/artifacts",
@@ -196,6 +199,7 @@ pub fn run(rootfs: &Path, cmd: &str, args: Vec<OsString>) -> Result<()> {
Mount::Nonrecursive,
None,
)?;
+ }
// Binlink BusyBox and Habitat CLI binaries
{
