From 9d769023d9e7f95f285b242f2bb861356b7527a7 Mon Sep 17 00:00:00 2001 From: Rin Date: Sat, 4 May 2024 12:40:19 +0800 Subject: [PATCH] test --- dist/index.js | 14 ++++++-------- index.js | 14 ++++++-------- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/dist/index.js b/dist/index.js index 3f91f71..c39fafc 100644 --- a/dist/index.js +++ b/dist/index.js @@ -31127,7 +31127,6 @@ function waitFor(trigger, callback) { function setup_sshkey(pubkey, qemu_process, ready_callback) { const pubkeyContent = fs.readFileSync(pubkey, { encoding: "utf-8" }); show_message("info", "Setting up SSH key for QEMU"); - qemu_process.stdin.write("root\n"); let waitForPrompt = waitFor("root@freebsd:", () => { waitForPrompt = () => { } let waitForKey = waitFor(pubkeyContent, () => { @@ -31139,18 +31138,17 @@ function setup_sshkey(pubkey, qemu_process, ready_callback) { waitForKey(data) }) show_message("debug", "Writing to stdin") - qemu_process.stdin.write(`echo "${pubkeyContent}" > /root/.ssh/authorized_keys\n`, () => { - qemu_process.stdin.write(`cat /root/.ssh/authorized_keys\n`, () => { - qemu_process.stdin.write("echo 'PermitRootLogin yes' >> /etc/ssh/sshd_config\n", () => { - qemu_process.stdin.write("/etc/rc.d/sshd restart\n"); - }); - }); - }); + // qemu_process.stdin.write(`echo "${pubkeyContent}" > /root/.ssh/authorized_keys\n`, () => { + // qemu_process.stdin.write(`cat /root/.ssh/authorized_keys\n`, () => { + qemu_process.stdin.write("echo 'PermitRootLogin yes' >> /etc/ssh/sshd_config && /etc/rc.d/sshd restart\n"); + // }); + // }); }) qemu_process.stdout.on('data', (data) => { waitForPrompt(data) process.stdout.write(data.toString()) }); + qemu_process.stdin.write("root\n"); } function ensure_install_deps() { diff --git a/index.js b/index.js index 636d634..c4c2cc9 100644 --- a/index.js +++ b/index.js @@ -237,7 +237,6 @@ function waitFor(trigger, callback) { function setup_sshkey(pubkey, qemu_process, ready_callback) { const pubkeyContent = fs.readFileSync(pubkey, { encoding: "utf-8" }); show_message("info", "Setting up SSH key for QEMU"); - qemu_process.stdin.write("root\n"); let waitForPrompt = waitFor("root@freebsd:", () => { waitForPrompt = () => { } let waitForKey = waitFor(pubkeyContent, () => { @@ -249,18 +248,17 @@ function setup_sshkey(pubkey, qemu_process, ready_callback) { waitForKey(data) }) show_message("debug", "Writing to stdin") - qemu_process.stdin.write(`echo "${pubkeyContent}" > /root/.ssh/authorized_keys\n`, () => { - qemu_process.stdin.write(`cat /root/.ssh/authorized_keys\n`, () => { - qemu_process.stdin.write("echo 'PermitRootLogin yes' >> /etc/ssh/sshd_config\n", () => { - qemu_process.stdin.write("/etc/rc.d/sshd restart\n"); - }); - }); - }); + // qemu_process.stdin.write(`echo "${pubkeyContent}" > /root/.ssh/authorized_keys\n`, () => { + // qemu_process.stdin.write(`cat /root/.ssh/authorized_keys\n`, () => { + qemu_process.stdin.write("echo 'PermitRootLogin yes' >> /etc/ssh/sshd_config && /etc/rc.d/sshd restart\n"); + // }); + // }); }) qemu_process.stdout.on('data', (data) => { waitForPrompt(data) process.stdout.write(data.toString()) }); + qemu_process.stdin.write("root\n"); } function ensure_install_deps() {