mejorar/arreglar rootfs

This commit is contained in:
Cat /dev/Nulo 2023-06-03 12:16:12 -03:00
parent 9dcd3c7279
commit 5bc228f7ab
4 changed files with 32 additions and 11 deletions

1
.gitignore vendored
View file

@ -3,3 +3,4 @@ rootfs.qcow2
fireactions
*.ext4
vmlinux.bin
node_modules/

View file

@ -15,7 +15,7 @@ import { join } from "node:path";
import { promisify } from "node:util";
const execFile = promisify(_execFile);
const root = await mkdtemp(join(tmpdir(), "tmp.fireactions-rootfs."));
const root = await mkdtemp(join(tmpdir(), "fireactions-rootfs."));
const alpine = await init(root);
await alpine.install(["dropbear", "util-linux", "dropbear-dbclient", "dhcpcd"]);
@ -23,20 +23,25 @@ await alpine.install(["dropbear", "util-linux", "dropbear-dbclient", "dhcpcd"]);
await append(r("/etc/rc.conf"), 'rc_parallel="YES"');
await mkdirp(r("/usr/local/sbin"));
await execFile("go", [
"build",
"-tags=netgo",
"-o",
r("/usr/local/sbin/fireactions-agent"),
"./agent",
]);
console.debug(
await execFile("go", [
"build",
"-tags=netgo",
"-o",
r("/usr/local/sbin/fireactions-agent"),
"./agent",
])
);
// https://github.com/OpenRC/openrc/blob/master/service-script-guide.md
await writeFile(
r("/etc/init.d/fireactions-agent"),
`#!/sbin/openrc-run
pidfile="/run/\${RC_SVCNAME}.pid"
command_background=true
command=/usr/local/sbin/fireactions-agent`
command=/usr/local/sbin/fireactions-agent
output_log=/dev/stdout
error_log=/dev/stdout
`
);
await chmod(r("/etc/init.d/fireactions-agent"), 0o700);
await alpine.rcUpdate("default", "fireactions-agent");

View file

@ -11,7 +11,7 @@
"author": "",
"license": "ISC",
"dependencies": {
"@nulo/apkit": "https://gitea.nulo.in/Nulo/apkit"
"@nulo/apkit": "https://gitea.nulo.in/Nulo/apkit/archive/hackyshit.tar.gz"
},
"devDependencies": {
"@tsconfig/node16": "^1.0.4",

View file

@ -1,4 +1,13 @@
lockfileVersion: '6.0'
lockfileVersion: '6.1'
settings:
autoInstallPeers: true
excludeLinksFromLockfile: false
dependencies:
'@nulo/apkit':
specifier: https://gitea.nulo.in/Nulo/apkit/archive/hackyshit.tar.gz
version: '@gitea.nulo.in/Nulo/apkit/archive/hackyshit.tar.gz'
devDependencies:
'@tsconfig/node16':
@ -17,3 +26,9 @@ packages:
/@types/node@20.2.5:
resolution: {integrity: sha512-JJulVEQXmiY9Px5axXHeYGLSjhkZEnD+MDPDGbCbIAbMslkKwmygtZFy1X6s/075Yo94sf8GuSlFfPzysQrWZQ==}
dev: true
'@gitea.nulo.in/Nulo/apkit/archive/hackyshit.tar.gz':
resolution: {tarball: https://gitea.nulo.in/Nulo/apkit/archive/hackyshit.tar.gz}
name: '@nulo/apkit'
version: 0.0.1
dev: false