Skip to content

Commit

Permalink
feat(cli): add method to create empty ext2 drives
Browse files Browse the repository at this point in the history
  • Loading branch information
tuler committed Oct 22, 2024
1 parent a4efd5b commit 88115a3
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions apps/cli/src/exec/genext2fs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,29 @@ const baseArgs = (options: { extraBlocks: number }) => [
`+${options.extraBlocks}`,
];

export const empty = async (
options: {
cwd?: string;
size: number;
output: string;
} & DockerFallbackOptions,
) => {
const { size, output } = options;
const blocks = Math.ceil(size / BLOCK_SIZE); // size in blocks
await execaDockerFallback(
"xgenext2fs",
[
"--block-size",
BLOCK_SIZE.toString(),
"--faketime",
"--size-in-blocks",
blocks.toString(),
output,
],
options,
);
};

export const fromDirectory = async (
options: {
cwd?: string;
Expand Down

0 comments on commit 88115a3

Please sign in to comment.