querysub 0.656.0 → 0.657.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "querysub",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.657.0",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"note1": "note on node-forge fork, see https://github.com/digitalbazaar/forge/issues/744 for details",
|
|
@@ -79,8 +79,8 @@
|
|
|
79
79
|
"node-forge": "https://github.com/sliftist/forge#e618181b469b07bdc70b968b0391beb8ef5fecd6",
|
|
80
80
|
"pako": "^2.1.0",
|
|
81
81
|
"peggy": "^5.0.6",
|
|
82
|
-
"sliftutils": "^1.7.
|
|
83
|
-
"socket-function": "^1.2.
|
|
82
|
+
"sliftutils": "^1.7.130",
|
|
83
|
+
"socket-function": "^1.2.35",
|
|
84
84
|
"terser": "^5.31.0",
|
|
85
85
|
"typenode": "^6.6.1",
|
|
86
86
|
"typesafecss": "^0.32.0",
|
|
@@ -114,6 +114,12 @@ async function writeRemoteFile(sshRemote: string, remotePath: string, content: s
|
|
|
114
114
|
await runPromise(`ssh ${sshRemote} "echo ${encoded} | base64 -d | ${write}"`);
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
+
/** Reads one value off the remote: the last line of the command's output, since banners and connection chatter come before it. */
|
|
118
|
+
async function sshValue(sshRemote: string, command: string, config?: { nothrow?: boolean }): Promise<string> {
|
|
119
|
+
let output = await runPromise(`ssh ${sshRemote} "${command}"`, { nothrow: config?.nothrow });
|
|
120
|
+
return (output.trim().split("\n").at(-1) || "").trim();
|
|
121
|
+
}
|
|
122
|
+
|
|
117
123
|
function getGitHubKeyCachePath(repoUrl: string): string {
|
|
118
124
|
let repoOwner = "";
|
|
119
125
|
let repoName = "";
|
|
@@ -491,7 +497,7 @@ async function main() {
|
|
|
491
497
|
}
|
|
492
498
|
|
|
493
499
|
// Get the public key from remote machine
|
|
494
|
-
const sshPublicKey = await
|
|
500
|
+
const sshPublicKey = await sshValue(sshRemote, "cat ~/.ssh/id_rsa.pub");
|
|
495
501
|
const keyTitle = `Machine Setup - ${sshRemote} - ${new Date().toISOString()}`;
|
|
496
502
|
|
|
497
503
|
// Add the deploy key to GitHub repository
|
|
@@ -513,8 +519,8 @@ async function main() {
|
|
|
513
519
|
console.log("✅ Dependencies installed");
|
|
514
520
|
|
|
515
521
|
// 6. Install the daemon that keeps the machine process running
|
|
516
|
-
let remoteUser =
|
|
517
|
-
let remoteHome =
|
|
522
|
+
let remoteUser = await sshValue(sshRemote, "whoami");
|
|
523
|
+
let remoteHome = await sshValue(sshRemote, "echo $HOME");
|
|
518
524
|
console.log(`Installing the ${SERVICE_UNIT_NAME} daemon (user ${remoteUser}, home ${remoteHome})...`);
|
|
519
525
|
await writeRemoteFile(sshRemote, `~/${DAEMON_SCRIPT_NAME}`, getDaemonScript(remoteHome), false);
|
|
520
526
|
await runPromise(`ssh ${sshRemote} "chmod +x ~/${DAEMON_SCRIPT_NAME}"`);
|
|
@@ -560,7 +566,7 @@ sudo systemctl start ${SERVICE_UNIT_NAME}
|
|
|
560
566
|
let screenDeadline = Date.now() + SCREEN_VERIFY_TIMEOUT;
|
|
561
567
|
let screenUp = false;
|
|
562
568
|
while (Date.now() < screenDeadline) {
|
|
563
|
-
let panePid =
|
|
569
|
+
let panePid = await sshValue(sshRemote, `tmux list-panes -t ${SERVICE_NAME} -F '#{pane_pid}' 2>/dev/null || true`, { nothrow: true });
|
|
564
570
|
if (panePid) {
|
|
565
571
|
screenUp = true;
|
|
566
572
|
break;
|