ramm 0.0.44 → 0.0.46

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/ramm.js CHANGED
@@ -123,7 +123,7 @@ var execCommandOverSsh = async (command, context) => {
123
123
  return await execCommand(`ssh${sshKeyPart} ${context.getAddress()} '${command}'`);
124
124
  };
125
125
  // src/init.ts
126
- var installBun = async (context) => {
126
+ var installBunOverSsh = async (context) => {
127
127
  const bunPath = new URL(import.meta.resolve("./bun.sh")).pathname;
128
128
  await copyFilesBySsh(bunPath, "./bun.sh", context);
129
129
  await execCommandOverSsh("./bun.sh", context);
@@ -242,11 +242,11 @@ var checkSystemdUnit = async (serviceName, context = defaultContext) => {
242
242
  return spawnResult.exitCode === 0;
243
243
  };
244
244
  var createSystemdUnit = async (unitName, content, context = defaultContext) => {
245
- const pathToSeviceTarget = getSystemdPathToService(unitName, context);
245
+ const pathToSeviceTarget = getSystemdPathToUnit(unitName, context);
246
246
  await writeFileFull(pathToSeviceTarget, content);
247
247
  await reloadSystemd(context);
248
248
  };
249
- var getSystemdPathToService = (serviceName, context = defaultContext) => {
249
+ var getSystemdPathToUnit = (serviceName, context = defaultContext) => {
250
250
  if (context.userspace) {
251
251
  return `~/.config/systemd/user/${serviceName}`;
252
252
  }
@@ -350,12 +350,15 @@ var runPodmanContainer = async (name, command) => {
350
350
  };
351
351
  var runPodmanContainerService = async (name, command, context = defaultContext) => {
352
352
  const serviceName = `${name}.service`;
353
+ const filepath = getSystemdPathToUnit(serviceName);
353
354
  if (await checkSystemdUnit(serviceName, context)) {
354
355
  await stopSystemdUnit(serviceName, context);
355
356
  }
356
357
  await runPodmanContainer(name, command);
357
- await execCommand(`podman generate systemd --name --new ${name} > ${serviceName}`);
358
- await createSystemdService(serviceName, serviceName, context);
358
+ await execCommand(`podman generate systemd --name --new ${name} > ${filepath}`);
359
+ await reloadSystemd(context);
360
+ await startSystemdUnit(serviceName, context);
361
+ await enabledSystemdUnit(serviceName, context);
359
362
  };
360
363
  var addNftPodmanRule = async () => {
361
364
  const podmanNetworksResult = await execCommand("podman network inspect $(podman network ls -q) -f '{{.NetworkInterface}}'");
@@ -503,8 +506,8 @@ export {
503
506
  loginPodman,
504
507
  installSystemPackage,
505
508
  installPodman,
506
- installBun,
507
- getSystemdPathToService,
509
+ installBunOverSsh,
510
+ getSystemdPathToUnit as getSystemdPathToService,
508
511
  getServerFingerprint,
509
512
  execCommandRaw,
510
513
  execCommandOverSsh,
@@ -1,2 +1,2 @@
1
1
  import type { Context } from "./context.ts";
2
- export declare const installBun: (context: Context) => Promise<void>;
2
+ export declare const installBunOverSsh: (context: Context) => Promise<void>;
@@ -1,9 +1,9 @@
1
1
  export { execCommandOverSsh, execCommand, execCommandMayError, copyFilesBySsh, execCommandRaw, } from "./base/base.ts";
2
2
  export { Context } from "./context.ts";
3
- export { installBun } from "./init.ts";
3
+ export { installBunOverSsh } from "./init.ts";
4
4
  export { installPodman, runPodmanContainer, loginPodman } from "./podman.ts";
5
5
  export { runPodmanContainerService, addNftPodmanRule } from "./podman.ts";
6
- export { startSystemdUnit, enabledSystemdUnit, restartSystemdUnit, createSystemdService, getSystemdPathToService, createSystemdUnit, reloadSystemd, } from "./systemd.ts";
6
+ export { startSystemdUnit, enabledSystemdUnit, restartSystemdUnit, createSystemdService, getSystemdPathToUnit as getSystemdPathToService, createSystemdUnit, reloadSystemd, } from "./systemd.ts";
7
7
  export { installSystemPackage } from "./packages.ts";
8
8
  export { printBlock } from "./print.ts";
9
9
  export { setupNftable } from "./nft.ts";
@@ -6,5 +6,5 @@ export declare const restartSystemdUnit: (name: string, context?: Context) => Pr
6
6
  export declare const stopSystemdUnit: (name: string, context?: Context) => Promise<void>;
7
7
  export declare const checkSystemdUnit: (serviceName: string, context?: Context) => Promise<boolean>;
8
8
  export declare const createSystemdUnit: (unitName: string, content: string, context?: Context) => Promise<void>;
9
- export declare const getSystemdPathToService: (serviceName: string, context?: Context) => string;
9
+ export declare const getSystemdPathToUnit: (serviceName: string, context?: Context) => string;
10
10
  export declare const createSystemdService: (serviceName: string, content: string, context?: Context) => Promise<void>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ramm",
3
3
  "type": "module",
4
- "version": "0.0.44",
4
+ "version": "0.0.46",
5
5
  "scripts": {
6
6
  "build": "bun build ./src/ramm.ts --target bun --outdir ./dist && cp ./src/bun.sh ./dist/bun.sh",
7
7
  "types": "tsc --project tsconfig.types.json"