From 4f5b4ceb858c36f77a83dbcd7e5ecccae36696d0 Mon Sep 17 00:00:00 2001 From: Christoph Hrdinka Date: Tue, 9 Sep 2014 10:53:52 +0200 Subject: [PATCH] build-fhs-chrootenv: bind mount chroots /tmp to hosts /tmp --- pkgs/build-support/build-fhs-chrootenv/destroy.sh.in | 5 +++-- pkgs/build-support/build-fhs-chrootenv/init.sh.in | 3 ++- pkgs/build-support/build-fhs-chrootenv/mount.sh.in | 3 +++ pkgs/build-support/build-fhs-chrootenv/umount.sh.in | 2 +- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/pkgs/build-support/build-fhs-chrootenv/destroy.sh.in b/pkgs/build-support/build-fhs-chrootenv/destroy.sh.in index 30b51cb5068f..8ddf350913eb 100644 --- a/pkgs/build-support/build-fhs-chrootenv/destroy.sh.in +++ b/pkgs/build-support/build-fhs-chrootenv/destroy.sh.in @@ -3,7 +3,7 @@ chrootenvDest=/run/chrootenv/@name@ # Remove bind mount points -rmdir $chrootenvDest/{dev,nix/store,nix,proc,sys,host-etc,home,var,run} +rmdir $chrootenvDest/{dev,nix/store,nix,proc,sys,host-etc,home,var,run,tmp} # Remove symlinks to the software that should be part of the chroot system profile for i in @chrootEnv@/sw/* @@ -15,7 +15,8 @@ do done # Remove the remaining folders -rm -Rf $chrootenvDest/{etc,root,tmp} +rm -Rf $chrootenvDest/{etc,root} +rm -Rf /tmp/chrootenv-@name@ # Remove the chroot environment folder rmdir $chrootenvDest diff --git a/pkgs/build-support/build-fhs-chrootenv/init.sh.in b/pkgs/build-support/build-fhs-chrootenv/init.sh.in index 5b0ab94bc4eb..079ec09d60f7 100644 --- a/pkgs/build-support/build-fhs-chrootenv/init.sh.in +++ b/pkgs/build-support/build-fhs-chrootenv/init.sh.in @@ -45,4 +45,5 @@ ln -s ../../../host-etc/static/fonts/conf.d/00-nixos.conf $chrootenvDest/etc/fon mkdir $chrootenvDest/root # Create tmp folder -mkdir -m1777 $chrootenvDest/tmp +mkdir -m1777 $chrootenvDest/tmp +mkdir -m1777 -p /tmp/chrootenv-@name@ diff --git a/pkgs/build-support/build-fhs-chrootenv/mount.sh.in b/pkgs/build-support/build-fhs-chrootenv/mount.sh.in index 225d9dbc4f72..c64f9356283b 100644 --- a/pkgs/build-support/build-fhs-chrootenv/mount.sh.in +++ b/pkgs/build-support/build-fhs-chrootenv/mount.sh.in @@ -21,3 +21,6 @@ mount --rbind /run $chrootenvDest/run # Bind mount the host system's /etc mount --bind /etc $chrootenvDest/host-etc + +# Bind mount /tmp +mount --bind /tmp/chrootenv-@name@ /run/chrootenv/steam/tmp diff --git a/pkgs/build-support/build-fhs-chrootenv/umount.sh.in b/pkgs/build-support/build-fhs-chrootenv/umount.sh.in index 5089141c0aa4..b8222a4121ab 100644 --- a/pkgs/build-support/build-fhs-chrootenv/umount.sh.in +++ b/pkgs/build-support/build-fhs-chrootenv/umount.sh.in @@ -3,4 +3,4 @@ chrootenvDest=/run/chrootenv/@name@ # Unmount all (r)bind mounts -umount -l $chrootenvDest/{dev/pts,dev/shm,dev,nix/store,proc,sys,host-etc,home,var,run} +umount -l $chrootenvDest/{dev/pts,dev/shm,dev,nix/store,proc,sys,host-etc,home,var,tmp,run}