diff --git a/dist/index.js b/dist/index.js index 1ef2950..29105f1 100644 --- a/dist/index.js +++ b/dist/index.js @@ -31099,9 +31099,9 @@ function start_vm(qemu_version, os, cpu, arch, bios, machine, filename, pubkey) show_message("info", qemu_executable + ' ' + qemu_args.join(' ')); qemu_wrapper(qemu_executable, qemu_args, (qemu_process) => { + setup_sshkey(pubkey, qemu_process); let runScript = core.getInput('run'); fs.writeFileSync('/tmp/run.sh', runScript); - spawnSync('scp', ['-o', 'StrictHostKeyChecking=no', '-i', pubkey, '-p', '2222', '/tmp/run.sh', 'root@localhost:/tmp/run.sh']); let ssh = spawn('ssh', ['-vvv', '-o', 'StrictHostKeyChecking=no', '-p', '2222', '-i', pubkey, 'root@localhost']); ssh.stdout.pipe(process.stdout); ssh.stderr.pipe(process.stderr); @@ -31115,6 +31115,12 @@ function start_vm(qemu_version, os, cpu, arch, bios, machine, filename, pubkey) core.endGroup(); }; +function setup_sshkey(pubkey, qemu_process) { + show_message("info", "Setting up SSH key for QEMU"); + qemu_process.stdin.write("root\n"); + qemu_process.stdin.write(`cat > /root/.ssh/authorized_keys <<<"${pubkey}"\n`); +} + function ensure_install_deps() { show_message("info", "Installing OVMF"); let result = spawnSync("sudo", ["apt-get", "update"], { diff --git a/index.js b/index.js index 2658915..f794045 100644 --- a/index.js +++ b/index.js @@ -209,9 +209,9 @@ function start_vm(qemu_version, os, cpu, arch, bios, machine, filename, pubkey) show_message("info", qemu_executable + ' ' + qemu_args.join(' ')); qemu_wrapper(qemu_executable, qemu_args, (qemu_process) => { + setup_sshkey(pubkey, qemu_process); let runScript = core.getInput('run'); fs.writeFileSync('/tmp/run.sh', runScript); - spawnSync('scp', ['-o', 'StrictHostKeyChecking=no', '-i', pubkey, '-p', '2222', '/tmp/run.sh', 'root@localhost:/tmp/run.sh']); let ssh = spawn('ssh', ['-vvv', '-o', 'StrictHostKeyChecking=no', '-p', '2222', '-i', pubkey, 'root@localhost']); ssh.stdout.pipe(process.stdout); ssh.stderr.pipe(process.stderr); @@ -225,6 +225,12 @@ function start_vm(qemu_version, os, cpu, arch, bios, machine, filename, pubkey) core.endGroup(); }; +function setup_sshkey(pubkey, qemu_process) { + show_message("info", "Setting up SSH key for QEMU"); + qemu_process.stdin.write("root\n"); + qemu_process.stdin.write(`cat > /root/.ssh/authorized_keys <<<"${pubkey}"\n`); +} + function ensure_install_deps() { show_message("info", "Installing OVMF"); let result = spawnSync("sudo", ["apt-get", "update"], {