ramm 0.0.43 → 0.0.45

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
@@ -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
  }
@@ -254,8 +254,8 @@ var getSystemdPathToService = (serviceName, context = defaultContext) => {
254
254
  };
255
255
  var createSystemdService = async (serviceName, content, context = defaultContext) => {
256
256
  await createSystemdUnit(serviceName, content, context);
257
- await enabledSystemdUnit(`systemctl enable ${serviceName}`, context);
258
- await startSystemdUnit(`systemctl start ${serviceName}`, context);
257
+ await enabledSystemdUnit(serviceName, context);
258
+ await startSystemdUnit(serviceName, context);
259
259
  };
260
260
 
261
261
  // src/nft.ts
@@ -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}}'");
@@ -504,7 +507,7 @@ export {
504
507
  installSystemPackage,
505
508
  installPodman,
506
509
  installBun,
507
- getSystemdPathToService,
510
+ getSystemdPathToUnit as getSystemdPathToService,
508
511
  getServerFingerprint,
509
512
  execCommandRaw,
510
513
  execCommandOverSsh,
@@ -3,7 +3,7 @@ export { Context } from "./context.ts";
3
3
  export { installBun } 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.43",
4
+ "version": "0.0.45",
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"