ramm 0.0.56 → 0.0.58

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
@@ -168,6 +168,10 @@ var packages = {
168
168
  nftables: {
169
169
  name: "nftables",
170
170
  command: "nft"
171
+ },
172
+ podman: {
173
+ name: "podman",
174
+ command: "podman"
171
175
  }
172
176
  };
173
177
  var installSystemPackage = async (packageEnt, context) => {
@@ -395,6 +399,27 @@ var getCreateCommand = async (name) => {
395
399
  var loginPodman = async (address, login, password) => {
396
400
  return await execCommand(`echo "${password}" | podman login --username "${login}" --password-stdin ${address}`);
397
401
  };
402
+ var createPodmanCommand = (props) => {
403
+ const values = [];
404
+ if (props.name) {
405
+ values.push(`--name ${props.name}`);
406
+ }
407
+ if (props.replace) {
408
+ values.push("--replace");
409
+ }
410
+ if (props.background) {
411
+ values.push("-d");
412
+ }
413
+ if (props.network) {
414
+ values.push(`--network ${props.network}`);
415
+ }
416
+ for (const env of props.envs ?? []) {
417
+ values.push(`-e ${env.name}=${env.value}`);
418
+ }
419
+ for (const volume of props.volumes ?? []) {
420
+ values.push(`-v ${volume.from}:${volume.to}`);
421
+ }
422
+ };
398
423
  var runPodmanContainer = async (name, command) => {
399
424
  if (await getCreateCommand(name) !== command) {
400
425
  await $2`podman rm -f ${name}`;
@@ -571,6 +596,7 @@ export {
571
596
  enabledSystemdUnit,
572
597
  createSystemdUnit,
573
598
  createSystemdService,
599
+ createPodmanCommand,
574
600
  createCron,
575
601
  createAndAddSshKey,
576
602
  copyFilesBySsh,
@@ -1,11 +1,25 @@
1
1
  import type { Context } from "./context.ts";
2
2
  export declare const installPodman: () => Promise<void>;
3
- export declare const getCreateCommand: (name: string) => Promise<string>;
4
3
  export declare const loginPodman: (address: string, login: string, password: string) => Promise<{
5
4
  stderr: string;
6
5
  stdout: string;
7
6
  spawnResult: import("bun").Subprocess<"inherit", "pipe", "pipe">;
8
7
  }>;
8
+ export declare const createPodmanCommand: (props: {
9
+ name?: string;
10
+ replace?: boolean;
11
+ background?: boolean;
12
+ network?: string;
13
+ envs?: {
14
+ name: string;
15
+ value: string;
16
+ }[];
17
+ volumes?: {
18
+ from: string;
19
+ to: string;
20
+ }[];
21
+ command: string;
22
+ }) => void;
9
23
  export declare const runPodmanContainer: (name: string, command: string) => Promise<void>;
10
24
  export declare const runPodmanContainerService: (name: string, command: string, context?: Context) => Promise<void>;
11
25
  export declare const addNftPodmanRule: () => Promise<void>;
@@ -1,8 +1,7 @@
1
1
  export { execCommandOverSsh, execCommand, execCommandMayError, copyFilesBySsh, execCommandRaw, } from "./base/base.ts";
2
2
  export { Context } from "./context.ts";
3
3
  export { installBunOverSsh } from "./init.ts";
4
- export { installPodman, runPodmanContainer, loginPodman } from "./podman.ts";
5
- export { runPodmanContainerService, addNftPodmanRule } from "./podman.ts";
4
+ export { installPodman, runPodmanContainer, loginPodman, runPodmanContainerService, addNftPodmanRule, createPodmanCommand, } from "./podman.ts";
6
5
  export { startSystemdUnit, enabledSystemdUnit, restartSystemdUnit, createSystemdService, getSystemdPathToUnit as getSystemdPathToService, createSystemdUnit, reloadSystemd, } from "./systemd.ts";
7
6
  export { installSystemPackage } from "./packages.ts";
8
7
  export { printBlock } from "./print.ts";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ramm",
3
3
  "type": "module",
4
- "version": "0.0.56",
4
+ "version": "0.0.58",
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"