@3-/srv-linux 0.1.9

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/bun.lock ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "lockfileVersion": 1,
3
+ "configVersion": 1,
4
+ "workspaces": {
5
+ "": {
6
+ "name": "@3-/srv-linux",
7
+ "dependencies": {
8
+ "@3-/srv-obj-replace": "file:../obj_replace",
9
+ "zx": "^8.8.5",
10
+ },
11
+ },
12
+ },
13
+ "packages": {
14
+ "@3-/read": ["@3-/read@0.1.4", "", {}, "sha512-PZDRfIFuaFNAW6VjWupa7+g/3GbhES6shAgETN/RXtTdJxcIwl9HSBMy2sdfRqAc/FUeUJFL3F8PfpsdZbC8xg=="],
15
+
16
+ "@3-/srv-obj-replace": ["@3-/srv-obj-replace@file:../obj_replace", { "dependencies": { "@3-/read": "^0.1.4" } }],
17
+
18
+ "zx": ["zx@8.8.5", "", { "bin": { "zx": "build/cli.js" } }, "sha512-SNgDF5L0gfN7FwVOdEFguY3orU5AkfFZm9B5YSHog/UDHv+lvmd82ZAsOenOkQixigwH2+yyH198AwNdKhj+RA=="],
19
+ }
20
+ }
package/install.js ADDED
@@ -0,0 +1,21 @@
1
+ import fs from "fs/promises";
2
+ import { homedir } from "os";
3
+ import { join } from "path";
4
+ import { $ } from "zx";
5
+ import gen from "@3-/srv-obj-replace/gen.js";
6
+
7
+ export default async ({ name, scriptPath: script_path }) => {
8
+ const { execPath: exec_path } = process,
9
+ systemd_dir = join(homedir(), ".config", "systemd", "user"),
10
+ service_path = join(systemd_dir, `${name}.service`);
11
+
12
+ await fs.mkdir(systemd_dir, { recursive: true });
13
+ await gen(
14
+ { name, execPath: exec_path, scriptPath: script_path },
15
+ join(import.meta.dirname, "systemd.service"),
16
+ service_path
17
+ );
18
+ await $`systemctl --user daemon-reload`;
19
+ await $`systemctl --user stop ${name}.service || true`;
20
+ await $`systemctl --user enable --now ${name}.service`;
21
+ };
package/package.json ADDED
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "@3-/srv-linux",
3
+ "version": "0.1.9",
4
+ "os": [
5
+ "linux"
6
+ ],
7
+ "type": "module",
8
+ "exports": {
9
+ "./install.js": "./install.js",
10
+ "./uninstall.js": "./uninstall.js"
11
+ },
12
+ "dependencies": {
13
+ "@3-/srv-obj-replace": "file:../obj_replace",
14
+ "zx": "^8.8.5"
15
+ },
16
+ "repository": "https://github.com/i18n-site/lib/tree/dev",
17
+ "homepage": "https://github.com/i18n-site/lib/tree/dev",
18
+ "bugs": {
19
+ "url": "https://github.com/i18n-site/lib/issues"
20
+ }
21
+ }
@@ -0,0 +1,13 @@
1
+ [Unit]
2
+ Description=$name Daemon
3
+ After=network.target
4
+
5
+ [Service]
6
+ ExecStart=$execPath $scriptPath run
7
+ Restart=always
8
+ StandardOutput=syslog
9
+ StandardError=syslog
10
+ SyslogIdentifier=$name
11
+
12
+ [Install]
13
+ WantedBy=default.target
package/uninstall.js ADDED
@@ -0,0 +1,13 @@
1
+ import fs from "fs/promises";
2
+ import { homedir } from "os";
3
+ import { join } from "path";
4
+ import { $ } from "zx";
5
+
6
+ export default async ({ name }) => {
7
+ const systemd_dir = join(homedir(), ".config", "systemd", "user"),
8
+ service_path = join(systemd_dir, `${name}.service`);
9
+
10
+ await $`systemctl --user disable --now ${name}.service || true`;
11
+ await fs.rm(service_path, { force: true });
12
+ await $`systemctl --user daemon-reload`;
13
+ };