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>
This commit is contained in:
aszlig 2014-12-15 19:12:58 +01:00
parent 5d67b17901
commit d85fabd68c
No known key found for this signature in database
GPG Key ID: D0EBD0EC8C2DC961
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'");
};