Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
shinohara-rin committed May 4, 2024
1 parent ae1b21b commit 9d76902
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 16 deletions.
14 changes: 6 additions & 8 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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, () => {
Expand All @@ -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() {
Expand Down
14 changes: 6 additions & 8 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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, () => {
Expand All @@ -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() {
Expand Down

0 comments on commit 9d76902

Please sign in to comment.