@longleash/cli 0.1.0-rc.6 → 0.1.0-rc.7
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/bin/longleash.mjs +22 -4
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/runtime/app/dist/assets/app-DS3tqdbW.js +27 -0
- package/runtime/app/dist/assets/{welcome-DFnhFAOE.js → welcome-CitqOflI.js} +19 -10
- package/runtime/app/dist/build.json +1 -1
- package/runtime/app/dist/index.html +1 -1
- package/runtime/app/dist/welcome.html +1 -1
- package/runtime/daemon/bin/longleashd.mjs +24 -5
- package/runtime/app/dist/assets/app-NtxDJpY6.js +0 -27
package/bin/longleash.mjs
CHANGED
|
@@ -1816,8 +1816,8 @@ StartLimitBurst=5
|
|
|
1816
1816
|
[Service]
|
|
1817
1817
|
Type=simple
|
|
1818
1818
|
ExecStart=${systemdQuote(paths.wrapper)} run
|
|
1819
|
-
EnvironmentFile=${
|
|
1820
|
-
WorkingDirectory=${
|
|
1819
|
+
EnvironmentFile=${systemdPath(paths.environment)}
|
|
1820
|
+
WorkingDirectory=${systemdPath(home)}
|
|
1821
1821
|
UMask=0077
|
|
1822
1822
|
Restart=on-failure
|
|
1823
1823
|
RestartSec=5s
|
|
@@ -1971,16 +1971,28 @@ function installSystemdService(context) {
|
|
|
1971
1971
|
if (!context.paths.environment) throw new Error("The Linux service environment path is missing.");
|
|
1972
1972
|
const previousUnit = snapshot(context.paths.definition);
|
|
1973
1973
|
const previousEnvironment = snapshot(context.paths.environment);
|
|
1974
|
+
const wasEnabled = run(context, "systemctl", ["--user", "is-enabled", "--quiet", SYSTEMD_UNIT]).status === 0;
|
|
1975
|
+
const wasActive = run(context, "systemctl", ["--user", "is-active", "--quiet", SYSTEMD_UNIT]).status === 0;
|
|
1974
1976
|
try {
|
|
1975
1977
|
writeManagedAtomically(context.paths.environment, renderSystemdEnvironment(context.paths, context.env), 384);
|
|
1976
1978
|
writeManagedAtomically(context.paths.definition, renderSystemdUnit(context.paths, context.home), 384);
|
|
1977
1979
|
requireSuccess(context, "systemctl", ["--user", "daemon-reload"]);
|
|
1978
|
-
|
|
1980
|
+
if (wasActive) {
|
|
1981
|
+
if (!wasEnabled) requireSuccess(context, "systemctl", ["--user", "enable", SYSTEMD_UNIT]);
|
|
1982
|
+
requireSuccess(context, "systemctl", ["--user", "restart", SYSTEMD_UNIT]);
|
|
1983
|
+
} else {
|
|
1984
|
+
requireSuccess(context, "systemctl", ["--user", "enable", "--now", SYSTEMD_UNIT]);
|
|
1985
|
+
}
|
|
1979
1986
|
} catch (error) {
|
|
1980
1987
|
restore(context.paths.environment, previousEnvironment);
|
|
1981
1988
|
restore(context.paths.definition, previousUnit);
|
|
1982
1989
|
run(context, "systemctl", ["--user", "daemon-reload"]);
|
|
1983
|
-
if (previousUnit !== null)
|
|
1990
|
+
if (previousUnit !== null) {
|
|
1991
|
+
if (wasEnabled) run(context, "systemctl", ["--user", "enable", SYSTEMD_UNIT]);
|
|
1992
|
+
else run(context, "systemctl", ["--user", "disable", SYSTEMD_UNIT]);
|
|
1993
|
+
if (wasActive) run(context, "systemctl", ["--user", "restart", SYSTEMD_UNIT]);
|
|
1994
|
+
else run(context, "systemctl", ["--user", "stop", SYSTEMD_UNIT]);
|
|
1995
|
+
}
|
|
1984
1996
|
throw error;
|
|
1985
1997
|
}
|
|
1986
1998
|
}
|
|
@@ -2102,6 +2114,12 @@ function systemdQuote(value) {
|
|
|
2102
2114
|
if (/[\0\r\n]/.test(value)) throw new Error("Service paths may not contain control characters.");
|
|
2103
2115
|
return `"${value.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/%/g, "%%")}"`;
|
|
2104
2116
|
}
|
|
2117
|
+
function systemdPath(value) {
|
|
2118
|
+
if (/[\u0000-\u0008\u000a-\u001f\u007f-\u009f]/.test(value)) {
|
|
2119
|
+
throw new Error("Service paths may not contain control characters.");
|
|
2120
|
+
}
|
|
2121
|
+
return value.replace(/%/g, "%%").replace(/\\/g, "\\x5c").replace(/ /g, "\\x20").replace(/\t/g, "\\x09").replace(/"/g, "\\x22").replace(/'/g, "\\x27");
|
|
2122
|
+
}
|
|
2105
2123
|
function environmentQuote(value) {
|
|
2106
2124
|
if (/[\0\r\n]/.test(value)) throw new Error("Service environment values may not contain control characters.");
|
|
2107
2125
|
return `"${value.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"`;
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@longleash/cli",
|
|
3
|
-
"version": "0.1.0-rc.
|
|
3
|
+
"version": "0.1.0-rc.7",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@longleash/cli",
|
|
9
|
-
"version": "0.1.0-rc.
|
|
9
|
+
"version": "0.1.0-rc.7",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"os": [
|
|
12
12
|
"darwin",
|