vm/windows: Properly escape shell command.

Security-wise it's not a big issue because we're still sandboxed, but I
really don't want to write something like \\\\\\\\192.168.0.2\\\\share
in order to set up network shares.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
This commit is contained in:
aszlig 2014-02-16 01:42:10 +01:00
parent cfa859d792
commit aa65a7057f
No known key found for this signature in database
GPG Key ID: D0EBD0EC8C2DC961

View File

@ -57,6 +57,8 @@ let
};
};
shellEscape = x: "'${lib.replaceChars ["'"] [("'\\'" + "'")] x}'";
initScript = writeScript "init.sh" (''
#!${stdenv.shell}
${coreutils}/bin/mkdir -p /etc/samba /etc/samba/private /var/lib/samba
@ -104,7 +106,7 @@ let
-o StrictHostKeyChecking=no \
-i /ssh.key \
-l Administrator \
192.168.0.1 -- "${command}"
192.168.0.1 -- ${shellEscape command}
${busybox}/sbin/poweroff -f
''));