ramm 0.0.5 → 0.0.6

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
@@ -218,6 +218,10 @@ var addNftPodmanRule = async () => {
218
218
  };
219
219
  // src/ssh.ts
220
220
  import { debug } from "console";
221
+ var getServerFingerprintBySsh = async (context) => {
222
+ const { output } = await execBySsh('ssh-keyscan -t ed25519 localhost | grep -v "^#"', context);
223
+ return output.replace("localhost", context.domain);
224
+ };
221
225
  async function createSshKey(pathToKey, comment) {
222
226
  const name = pathToKey.split("/").at(-1);
223
227
  const pathToKeyPub = `${pathToKey}.pub`;
@@ -253,6 +257,8 @@ export {
253
257
  installSystemPackage,
254
258
  installPodman,
255
259
  installBun,
260
+ getServerFingerprintBySsh,
261
+ execCommand,
256
262
  execBySsh,
257
263
  debugBlock,
258
264
  createAndAddSshKey,
@@ -8,5 +8,8 @@ export declare const execCommandSilent: (command: string) => Promise<{
8
8
  output: string;
9
9
  spawnResult: import("bun").Subprocess<"ignore", "pipe", "inherit">;
10
10
  }>;
11
- export declare const copyFiles: (from: string, to: string, context: Context) => Promise<void>;
12
- export declare const exec: (command: string, context: Context) => Promise<void>;
11
+ export declare const copyFilesBySsh: (from: string, to: string, context: Context) => Promise<void>;
12
+ export declare const execBySsh: (command: string, context: Context) => Promise<{
13
+ output: string;
14
+ spawnResult: import("bun").Subprocess<"inherit", "pipe", "inherit">;
15
+ }>;
@@ -3,11 +3,13 @@ export declare class Context {
3
3
  domain: string;
4
4
  userspace: boolean;
5
5
  sudo: boolean;
6
- constructor({ name, address, userspace, sudo, }: {
6
+ sshKey?: string;
7
+ constructor({ name, address, userspace, sudo, sshKey, }: {
7
8
  name: string;
8
9
  address: string;
9
10
  userspace?: boolean;
10
11
  sudo?: boolean;
12
+ sshKey?: string;
11
13
  });
12
14
  getAddress(): string;
13
15
  }
@@ -1,3 +1,4 @@
1
1
  export declare const debugSilentCommand: (command: string) => void;
2
2
  export declare const debugCommand: (command: string) => void;
3
+ export declare const debugBlock: (text: string) => void;
3
4
  export declare const debug: (text: string) => void;
@@ -1,9 +1,10 @@
1
- export { exec, copyFiles } from "./base.ts";
1
+ export { execBySsh, execCommand, copyFilesBySsh } from "./base.ts";
2
2
  export { Context } from "./context.ts";
3
3
  export { installBun } from "./init.ts";
4
4
  export { installPodman, runPodmanContainer } from "./podman.ts";
5
5
  export { runPodmanContainerService, addNftPodmanRule } from "./podman.ts";
6
6
  export { restartSystemdService } from "./systemd.ts";
7
7
  export { installSystemPackage } from "./packages.ts";
8
- export { debug } from "./debug.ts";
8
+ export { debugBlock } from "./debug.ts";
9
9
  export { setupNftable } from "./nft.ts";
10
+ export { createAndAddSshKey, getServerFingerprintBySsh } from "./ssh.ts";
@@ -0,0 +1,4 @@
1
+ import type { Context } from "./context.ts";
2
+ export declare const setupHostConfig: (address: string, pathToKey: string) => void;
3
+ export declare const getServerFingerprintBySsh: (context: Context) => Promise<string>;
4
+ export declare const createAndAddSshKey: (pathToKey: string, comment: 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.5",
4
+ "version": "0.0.6",
5
5
  "scripts": {
6
6
  "build": "bun build ./src/ramm.ts --target bun --outdir ./dist && cp ./src/bun.sh ./dist/bun.sh && bun run types",
7
7
  "types": "tsc --project tsconfig.types.json"