nixos/virtualbox/hostonlyif: Fix writing to /root.

Creates unnecessary cruft in the root users home directory, which we
really don't need. Except the log, but therefore we now cat the log to
stderr and the private temporary directory is cleaned up afterwards.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
(cherry picked from commit d85fabd68c)
This commit is contained in:
aszlig
2014-12-15 19:12:58 +01:00
parent c141582aaf
commit 0a5535ffd6
2 changed files with 4 additions and 0 deletions

View File

@@ -97,10 +97,13 @@ in
path = [ virtualbox ];
serviceConfig.RemainAfterExit = true;
serviceConfig.Type = "oneshot";
serviceConfig.PrivateTmp = true;
environment.VBOX_USER_HOME = "/tmp";
script =
''
if ! [ -e /sys/class/net/vboxnet0 ]; then
VBoxManage hostonlyif create
cat /tmp/VBoxSVC.log >&2
fi
'';
postStop =

View File

@@ -348,6 +348,7 @@ in {
subtest "privilege-escalation", sub {
$machine->fail("test -e '/root/VirtualBox VMs'");
$machine->fail("test -e '/root/.config/VirtualBox'");
$machine->succeed("test -e '/home/alice/VirtualBox VMs'");
};