persistir /persist en qemu
This commit is contained in:
parent
497e915167
commit
07a9a95b10
2 changed files with 10 additions and 6 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -3,3 +3,4 @@ build-javascript
|
||||||
cache/
|
cache/
|
||||||
artifacts/
|
artifacts/
|
||||||
secrets/
|
secrets/
|
||||||
|
tmp.ext4
|
9
qemu.ts
9
qemu.ts
|
@ -1,7 +1,7 @@
|
||||||
import { mkdtemp, rm } from "node:fs/promises";
|
import { mkdtemp, rm } from "node:fs/promises";
|
||||||
import { tmpdir } from "node:os";
|
import { tmpdir } from "node:os";
|
||||||
import path from "node:path";
|
import path from "node:path";
|
||||||
import { execFile } from "./helpers/better-api.js";
|
import { canAccess, execFile } from "./helpers/better-api.js";
|
||||||
import { sudoChownToRunningUser } from "./helpers/sudo.js";
|
import { sudoChownToRunningUser } from "./helpers/sudo.js";
|
||||||
|
|
||||||
export async function runQemu(
|
export async function runQemu(
|
||||||
|
@ -17,9 +17,12 @@ export async function runQemu(
|
||||||
await sudoChownToRunningUser(squashfs);
|
await sudoChownToRunningUser(squashfs);
|
||||||
const tmp = await mkdtemp(path.join(tmpdir(), "define-alpine-qemu-"));
|
const tmp = await mkdtemp(path.join(tmpdir(), "define-alpine-qemu-"));
|
||||||
try {
|
try {
|
||||||
const disk = path.join(tmp, "tmp.ext4");
|
// const disk = path.join(tmp, "tmp.ext4");
|
||||||
|
const disk = "tmp.ext4";
|
||||||
|
if (!(await canAccess(disk))) {
|
||||||
await execFile("fallocate", ["--length", "1G", disk]);
|
await execFile("fallocate", ["--length", "1G", disk]);
|
||||||
await execFile("mkfs.ext4", ["-F", disk]);
|
await execFile("mkfs.ext4", ["-F", disk]);
|
||||||
|
}
|
||||||
|
|
||||||
let kernelAppend = [
|
let kernelAppend = [
|
||||||
"root=/dev/sda",
|
"root=/dev/sda",
|
||||||
|
@ -69,5 +72,5 @@ await runQemu(
|
||||||
initramfs: "artifacts/kernel/initramfs",
|
initramfs: "artifacts/kernel/initramfs",
|
||||||
vmlinuz: "artifacts/kernel/vmlinuz",
|
vmlinuz: "artifacts/kernel/vmlinuz",
|
||||||
},
|
},
|
||||||
{ graphic: true }
|
{ graphic: true, noShutdown: true }
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue