build-fhs-{chroot,user}env: expose sockets in /tmp

This commit is contained in:
Nikolay Amiantov 2015-08-24 01:42:40 +03:00
parent ff25df9366
commit ec27ba44d0
5 changed files with 16 additions and 2 deletions

View File

@ -3,7 +3,7 @@
chrootenvDest=/run/chrootenv/@name@
# Create some mount points for stuff that must be bind mounted
mkdir -p $chrootenvDest/{nix/store,dev,proc,sys,host-etc,home,var,run}
mkdir -p $chrootenvDest/{nix/store,dev,proc,sys,host-etc,host-tmp,home,var,run}
# Symlink the software that should be part of the chroot system profile
for i in @chrootEnv@/*

View File

@ -22,5 +22,13 @@ mount --rbind /run $chrootenvDest/run
# Bind mount the host system's /etc
mount --bind /etc $chrootenvDest/host-etc
# Bind mount the host system's /tmp
mount --bind /tmp $chrootenvDest/host-tmp
# Bind mount /tmp
mount --bind /tmp/chrootenv-@name@ $chrootenvDest/tmp
# Expose sockets in /tmp
for i in /tmp/.*-unix; do
ln -s "/host-tmp/$(basename "$i")" "$chrootenvDest/$i"
done

View File

@ -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,tmp,run}
umount -l $chrootenvDest/{dev/pts,dev/shm,dev,nix/store,proc,sys,host-etc,host-tmp,home,var,tmp,run}

View File

@ -7,6 +7,7 @@ mounts = [ ['/nix/store', nil],
['/proc', nil],
['/sys', nil],
['/etc', 'host-etc'],
['/tmp', 'host-tmp'],
['/home', nil],
['/var', nil],
['/run', nil],

View File

@ -10,6 +10,11 @@ let
'';
init = writeText "init" ''
# Expose sockets in /tmp
for i in /host-tmp/.*-unix; do
ln -s "$i" "/tmp/$(basename "$i")"
done
[ -d "$1" ] && [ -r "$1" ] && cd "$1"
shift
exec "${runScript}" "$@"