Skip to content

Commit

Permalink
1
Browse files Browse the repository at this point in the history
  • Loading branch information
shinohara-rin committed May 4, 2024
1 parent a5fd8fd commit 47ae285
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31131,13 +31131,14 @@ function setup_sshkey(pubkey, qemu_process, ready_callback) {
let waitForPrompt = waitFor("root@freebsd:", () => {
waitForPrompt = () => { }
let waitForKey = waitFor(pubkeyContent, () => {
show_message("info", "SSH key added successfully");
ready_callback(qemu_process)
})
qemu_process.stdout.on('data', data => {
process.stdout.write(data.toString())
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");
Expand Down
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,13 +241,14 @@ function setup_sshkey(pubkey, qemu_process, ready_callback) {
let waitForPrompt = waitFor("root@freebsd:", () => {
waitForPrompt = () => { }
let waitForKey = waitFor(pubkeyContent, () => {
show_message("info", "SSH key added successfully");
ready_callback(qemu_process)
})
qemu_process.stdout.on('data', data => {
process.stdout.write(data.toString())
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");
Expand Down

0 comments on commit 47ae285

Please sign in to comment.