Compare commits

..

3 commits

Author SHA1 Message Date
ff95f2fdfc dhcpcd
fixes #2
2023-02-08 15:06:01 -03:00
265b3843bf arreglar esbuild 2023-02-08 15:05:48 -03:00
436c1a0f76 mover forgejo a services 2023-02-08 11:50:07 -03:00
7 changed files with 28 additions and 10 deletions

View file

@ -3,13 +3,14 @@ import { tmpdir } from "node:os";
import path from "node:path"; import path from "node:path";
import { cwd, exit } from "node:process"; import { cwd, exit } from "node:process";
import { Alpine } from "./alpine.js"; import { Alpine } from "./alpine.js";
import { setupForgejo } from "./forgejo/index.js"; import { setupForgejo } from "./services/forgejo/index.js";
import { generateForgejoSecretsFile } from "./forgejo/secrets.js"; import { generateForgejoSecretsFile } from "./services/forgejo/secrets.js";
import { execFile } from "./helpers/better-api.js"; import { execFile } from "./helpers/better-api.js";
import { sudoChownToRunningUser } from "./helpers/sudo.js"; import { sudoChownToRunningUser } from "./helpers/sudo.js";
import { setupKernel } from "./kernel.js"; import { setupKernel } from "./kernel.js";
import { runQemu } from "./qemu.js"; import { runQemu } from "./qemu.js";
import { Runit } from "./runit/index.js"; import { Runit } from "./runit/index.js";
import { setupDhcpcd } from "./services/dhcpcd.js";
if (process.argv[2] === "generate-secrets") { if (process.argv[2] === "generate-secrets") {
await generateForgejoSecretsFile(); await generateForgejoSecretsFile();
@ -30,6 +31,7 @@ if (process.argv[2] === "generate-secrets") {
await alpine.addPackages(["helix", "iproute2-ss", "socat"]); await alpine.addPackages(["helix", "iproute2-ss", "socat"]);
const runit = await Runit.setup(alpine); const runit = await Runit.setup(alpine);
await setupDhcpcd(alpine, runit);
await setupForgejo(alpine, runit); await setupForgejo(alpine, runit);
const kernel = await setupKernel(alpine, kernelDir); const kernel = await setupKernel(alpine, kernelDir);

View file

@ -5,7 +5,7 @@
"description": "", "description": "",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
"build": "esbuild --log-level=warning --target=node18 --sourcemap --outdir=build-javascript --outbase=. *.ts **/*.ts", "build": "esbuild --log-level=warning --target=node18 --sourcemap --outdir=build-javascript --outbase=. *.ts **/*.ts **/**/*.ts",
"run": "pnpm build && node --enable-source-maps build-javascript/index.js", "run": "pnpm build && node --enable-source-maps build-javascript/index.js",
"test": "pnpm build && node --enable-source-maps build-javascript/**/*.test.js", "test": "pnpm build && node --enable-source-maps build-javascript/**/*.test.js",
"tsc:check": "tsc --noEmit" "tsc:check": "tsc --noEmit"

16
services/dhcpcd.ts Normal file
View file

@ -0,0 +1,16 @@
import { Alpine } from "../alpine.js";
import { Runit } from "../runit/index.js";
export async function setupDhcpcd(alpine: Alpine, runit: Runit) {
await alpine.addPackages(["dhcpcd"]);
await alpine.symlink("/run/resolv.conf", "/etc/resolv.conf");
await alpine.fstab.addTmpfs("/var/lib/dhcpcd");
await runit.addService(
"dhcpcd",
`#!/bin/sh
exec dhcpcd --nobackground
`
);
}

View file

@ -1,6 +1,6 @@
import { chmod, mkdir, readFile, writeFile } from "node:fs/promises"; import { chmod, mkdir, readFile, writeFile } from "node:fs/promises";
import { join } from "node:path"; import { join } from "node:path";
import { reproRun } from "../helpers/repro-run.js"; import { reproRun } from "../../helpers/repro-run.js";
const FORGEJO_VERSION = "v1.18.3-0"; const FORGEJO_VERSION = "v1.18.3-0";

View file

@ -1,10 +1,10 @@
import { buildForgejo } from "./build.js"; import { buildForgejo } from "./build.js";
import { Alpine } from "../alpine.js"; import { Alpine } from "../../alpine.js";
import { Runit } from "../runit/index.js"; import { Runit } from "../../runit/index.js";
import { constants, writeFile } from "node:fs/promises"; import { writeFile } from "node:fs/promises";
import { join } from "node:path"; import { join } from "node:path";
import { loadForgejoSecretsFile } from "./secrets.js"; import { loadForgejoSecretsFile } from "./secrets.js";
import { sudoChmod, sudoChown, sudoCopy } from "../helpers/sudo.js"; import { sudoChown, sudoCopy } from "../../helpers/sudo.js";
export async function setupForgejo(alpine: Alpine, runit: Runit) { export async function setupForgejo(alpine: Alpine, runit: Runit) {
const bin = await buildForgejo(); const bin = await buildForgejo();

View file

@ -1,5 +1,5 @@
import { execFile } from "../helpers/better-api.js"; import { execFile } from "../../helpers/better-api.js";
import { generateSecretsFile, loadSecretsFile } from "../helpers/secrets.js"; import { generateSecretsFile, loadSecretsFile } from "../../helpers/secrets.js";
import { buildForgejo } from "./build.js"; import { buildForgejo } from "./build.js";
export interface ForgejoSecrets { export interface ForgejoSecrets {