windows: add sshUnquoted to for interpolated parameters

This partially reverts commit 525b91cb21.
pull/30/head
Astro 2019-11-14 00:13:03 +01:00
parent 184de89074
commit 91182a37dd
2 changed files with 11 additions and 12 deletions

View File

@ -33,13 +33,14 @@ let
# Pass empty config file to prevent ssh from failing to create ~/.ssh # Pass empty config file to prevent ssh from failing to create ~/.ssh
sshOpts = "-F /dev/null -o StrictHostKeyChecking=accept-new -o UserKnownHostsFile=\$TMP/known_hosts"; sshOpts = "-F /dev/null -o StrictHostKeyChecking=accept-new -o UserKnownHostsFile=\$TMP/known_hosts";
ssh = cmd: '' sshWithQuotes = quotes: cmd: ''
echo ssh windows '${cmd}' echo ssh windows ${quotes}${cmd}${quotes}
${sshpass}/bin/sshpass -p${sshPassword} -- \ ${sshpass}/bin/sshpass -p${sshPassword} -- \
${openssh}/bin/ssh -np 2022 ${sshOpts} \ ${openssh}/bin/ssh -np 2022 ${sshOpts} \
${sshUser}@localhost \ ${sshUser}@localhost \
'${cmd}' ${quotes}${cmd}${quotes}
''; '';
ssh = sshWithQuotes "'";
scp = src: target: '' scp = src: target: ''
echo "Copy ${src} to ${target}" echo "Copy ${src} to ${target}"
${sshpass}/bin/sshpass -p${sshPassword} -- \ ${sshpass}/bin/sshpass -p${sshPassword} -- \
@ -49,6 +50,6 @@ let
in in
{ {
inherit qemu-img runQemu ssh scp; inherit qemu-img runQemu ssh sshWithQuotes scp;
inputs = [ qemu_kvm openssh sshpass ]; inputs = [ qemu_kvm openssh sshpass ];
} }

View File

@ -17,6 +17,7 @@ let
}; };
# Double-escape because we produce a script from a shell heredoc # Double-escape because we produce a script from a shell heredoc
ssh = cmd: qemu.ssh (escape cmd); ssh = cmd: qemu.ssh (escape cmd);
sshUnquoted = qemu.sshWithQuotes "\"";
scp = qemu.scp; scp = qemu.scp;
condaEnv = "artiq-env"; condaEnv = "artiq-env";
tcpPorts = [ 1380 1381 1382 1383 ]; tcpPorts = [ 1380 1381 1382 1383 ];
@ -53,14 +54,11 @@ stdenv.mkDerivation {
echo "Wait for Windows to boot" echo "Wait for Windows to boot"
sleep 10 sleep 10
${ssh "ver"} ${ssh "ver"}
# FIXME: clean up this hack with the for loops i=0
for pkg in ${sipycoPkg}/noarch/sipyco*.tar.bz2 ; do for pkg in ${sipycoPkg}/noarch/sipyco*.tar.bz2 ${artiqPkg}/noarch/artiq*.tar.bz2 ; do
${scp "\\$pkg" "sipyco.tar.bz2"} ${scp "\\$pkg" "to_install\\$i.tar.bz2"}
${ssh "anaconda\\scripts\\activate ${condaEnv} && conda install sipyco.tar.bz2"} ${sshUnquoted "anaconda\\scripts\\activate ${condaEnv} && conda install to_install\\$i.tar.bz2"}
done ((i=i+1))
for pkg in ${artiqPkg}/noarch/artiq*.tar.bz2 ; do
${scp "\\$pkg" "artiq.tar.bz2"}
${ssh "anaconda\\scripts\\activate ${condaEnv} && conda install artiq.tar.bz2"}
done done
# Schedule a timed shutdown against hanging test runs # Schedule a timed shutdown against hanging test runs