stabilize, add daemon state, add base build script

This commit is contained in:
JOLIMAITRE Matthieu 2023-12-10 22:04:40 +01:00
parent a1963cf491
commit 241d50e42a
12 changed files with 512 additions and 46 deletions

View file

@ -0,0 +1,26 @@
import { Base, BaseContext } from "../../../src/lib.ts";
export { build };
const build: Base = async (c) => {
// installs base
await c.sh(`pacstrap -K -c '${c.root_dir}' base`);
await c.sh(`rm -fr '${c.root_dir}/etc/securetty' '${c.root_dir}/usr/share/factory/etc/securetty'`);
await c.sh_in(`printf 'root:noussommesdescrabes' | chpasswd --crypt-method DES`);
await pacman(c, "nano", "git", "base-devel");
await c.sh_in(`systemctl enable systemd-networkd.service`);
// ssh
await pacman(c, "openssh");
await c.sh_in(`
echo 'PermitRootLogin yes' >> /etc/ssh/sshd_config
systemctl enable sshd.service
`);
const port = c.available_port(2250);
c.redirect(port, 22);
};
async function pacman(c: BaseContext, ...packages: string[]) {
await c.sh_in(`pacman -Syu --noconfirm '${packages.join("' '")}'`);
}