From 079ec9a7765660238d47a235aa1e404cda95ed93 Mon Sep 17 00:00:00 2001 From: Danilo Tuler Date: Fri, 8 Nov 2024 12:43:42 -0500 Subject: [PATCH] feat(cli): set default ram-image to always be /usr/share/cartesi-machine/images/linux.bin --- .changeset/perfect-news-compare.md | 5 +++++ apps/cli/src/config.ts | 19 +++---------------- 2 files changed, 8 insertions(+), 16 deletions(-) create mode 100644 .changeset/perfect-news-compare.md diff --git a/.changeset/perfect-news-compare.md b/.changeset/perfect-news-compare.md new file mode 100644 index 00000000..e88e70c9 --- /dev/null +++ b/.changeset/perfect-news-compare.md @@ -0,0 +1,5 @@ +--- +"@cartesi/cli": major +--- + +set default ram-image to always be '/usr/share/cartesi-machine/images/linux.bin' diff --git a/apps/cli/src/config.ts b/apps/cli/src/config.ts index 573c9ecb..6ecbfe08 100644 --- a/apps/cli/src/config.ts +++ b/apps/cli/src/config.ts @@ -1,5 +1,4 @@ import bytes from "bytes"; -import os from "os"; import { extname } from "path"; import { TomlPrimitive, parse as parseToml } from "smol-toml"; @@ -74,10 +73,7 @@ export class InvalidStringArrayError extends Error { */ const DEFAULT_FORMAT = "ext2"; const DEFAULT_RAM = "128Mi"; -const DEFAULT_RAM_IMAGE_DOCKER = "/usr/share/cartesi-machine/images/linux.bin"; -const DEFAULT_RAM_IMAGE_LINUX = "/usr/share/cartesi-machine/images/linux.bin"; -const DEFAULT_RAM_IMAGE_MAC = - "/opt/homebrew/share/cartesi-machine/images/linux.bin"; +const DEFAULT_RAM_IMAGE = "/usr/share/cartesi-machine/images/linux.bin"; export const DEFAULT_SDK = "cartesi/sdk:0.12.0-alpha.1"; type Builder = "directory" | "docker" | "empty" | "none" | "tar"; @@ -172,15 +168,6 @@ export const defaultRootDriveConfig = (): DriveConfig => ({ tags: [], }); -export const defaultRamImage = (): string => { - switch (os.platform()) { - case "darwin": - return DEFAULT_RAM_IMAGE_MAC; - default: - return DEFAULT_RAM_IMAGE_LINUX; - } -}; - export const defaultMachineConfig = (): MachineConfig => ({ assertRollingTemplate: undefined, bootargs: [], @@ -190,7 +177,7 @@ export const defaultMachineConfig = (): MachineConfig => ({ maxMCycle: undefined, noRollup: undefined, ramLength: DEFAULT_RAM, - ramImage: defaultRamImage(), + ramImage: DEFAULT_RAM_IMAGE, store: "image", user: undefined, }); @@ -368,7 +355,7 @@ const parseMachine = (value: TomlPrimitive): MachineConfig => { maxMCycle: parseOptionalNumber(toml["max-mcycle"]), noRollup: parseBoolean(toml["no-rollup"], false), ramLength: parseString(toml["ram-length"], DEFAULT_RAM), - ramImage: parseString(toml["ram-image"], defaultRamImage()), + ramImage: parseString(toml["ram-image"], DEFAULT_RAM_IMAGE), store: "image", user: parseOptionalString(toml.user), };