@hasna/machines 0.0.11 → 0.0.12
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/dist/cli/index.js
CHANGED
|
@@ -18777,13 +18777,26 @@ ${key}=${value}
|
|
|
18777
18777
|
return log2;
|
|
18778
18778
|
}
|
|
18779
18779
|
function binPath() {
|
|
18780
|
-
const
|
|
18781
|
-
|
|
18782
|
-
`)[0]
|
|
18780
|
+
const candidates = [];
|
|
18781
|
+
const which = sh2("command -v machines").out.split(`
|
|
18782
|
+
`)[0]?.trim();
|
|
18783
|
+
if (which)
|
|
18784
|
+
candidates.push(which);
|
|
18785
|
+
if (process.argv[1])
|
|
18786
|
+
candidates.push(process.argv[1]);
|
|
18787
|
+
const home = process.env["HOME"] || "/home/hasna";
|
|
18788
|
+
candidates.push(`${home}/.bun/bin/machines`, "/home/hasna/.bun/bin/machines", "/root/.bun/bin/machines", "/usr/local/bin/machines");
|
|
18789
|
+
for (const c of candidates) {
|
|
18790
|
+
if (c && existsSync10(c))
|
|
18791
|
+
return c;
|
|
18792
|
+
}
|
|
18793
|
+
return "machines";
|
|
18783
18794
|
}
|
|
18795
|
+
var ROOT_DATA_DIR = "/etc/machines-heal";
|
|
18784
18796
|
function installHealService() {
|
|
18785
18797
|
const log2 = [];
|
|
18786
18798
|
const exec = binPath();
|
|
18799
|
+
const binDir = exec.includes("/") ? exec.slice(0, exec.lastIndexOf("/")) : "/usr/local/bin";
|
|
18787
18800
|
const unit = `[Unit]
|
|
18788
18801
|
Description=Hasna machines self-healing network watchdog
|
|
18789
18802
|
After=network.target NetworkManager.service tailscaled.service
|
|
@@ -18794,8 +18807,9 @@ Type=simple
|
|
|
18794
18807
|
ExecStart=${exec} heal daemon
|
|
18795
18808
|
Restart=always
|
|
18796
18809
|
RestartSec=10
|
|
18797
|
-
# Persisted state/config live in root's data dir.
|
|
18798
18810
|
Environment=HOME=/root
|
|
18811
|
+
Environment=HASNA_MACHINES_DIR=${ROOT_DATA_DIR}
|
|
18812
|
+
Environment=PATH=${binDir}:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
|
18799
18813
|
|
|
18800
18814
|
[Install]
|
|
18801
18815
|
WantedBy=multi-user.target
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"heal-daemon.d.ts","sourceRoot":"","sources":["../../src/commands/heal-daemon.ts"],"names":[],"mappings":"AAUA,OAAO,EAWL,KAAK,UAAU,EAChB,MAAM,WAAW,CAAC;AAMnB,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAMD,wFAAwF;AACxF,wBAAgB,WAAW,CAAC,MAAM,EAAE,UAAU,EAAE,IAAI,GAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAO,GAAG,cAAc,CAsC/F;AAwBD,wBAAgB,cAAc,IAAI;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAOzE;AAED,wBAAgB,eAAe,IAAI,IAAI,CAiBtC;AAOD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,EAAE,CAyB7D;AAED,0EAA0E;AAC1E,wBAAgB,sBAAsB,IAAI,MAAM,EAAE,CAejD;
|
|
1
|
+
{"version":3,"file":"heal-daemon.d.ts","sourceRoot":"","sources":["../../src/commands/heal-daemon.ts"],"names":[],"mappings":"AAUA,OAAO,EAWL,KAAK,UAAU,EAChB,MAAM,WAAW,CAAC;AAMnB,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,OAAO,CAAC;I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