Recently Written · git

waybase

Bootable installer: KISS, Gentoo, Arch or Alpine + Nix + a Wayland compositor (sway, river, labwc, dwl)

git clone https://github.com/equwal/waybase

Log | Files | Refs


backends/gentoo.sh (2857 bytes)

1 # Gentoo: desktop OpenRC stage3, then binary packages only (getbinpkg,
2 # usepkgonly), so nothing compiles. A package without a binary comes from Nix.
3 # OpenRC, elogind, dbus, dhcpcd, gentoo-kernel-bin + dracut.
4 # shellcheck shell=sh disable=SC2034
5 GENTOO_MIRROR=${GENTOO_MIRROR:-https://distfiles.gentoo.org}
6 E="emerge --quiet --getbinpkgonly --usepkgonly --binpkg-respect-use=y --noreplace"
7 bootstrap() {
8     b=$GENTOO_MIRROR/releases/amd64/autobuilds
9     f=$(curl -fsSL "$b/latest-stage3-amd64-desktop-openrc.txt" | grep -o '^[^# ]*stage3[^ ]*\.tar\.xz' | head -1)
10     f=$(fetch "$b/$f") && tar -xJpf "$f" -C $M --xattrs-include='*.*' --numeric-owner && rm "$f"
11     chroot_mounts
12     printf 'FEATURES="getbinpkg binpkg-request-signature"\nACCEPT_LICENSE="*"\n' >> $M/etc/portage/make.conf
13     mkdir -p $M/etc/portage/package.use $M/etc/dracut.conf.d
14     echo 'sys-kernel/installkernel dracut' > $M/etc/portage/package.use/waybase
15     printf 'hostonly="no"\nadd_dracutmodules+=" crypt "\n' > $M/etc/dracut.conf.d/waybase.conf
16     ch "emerge-webrsync -q" >/dev/null 2>&1
17     ch "getuto" >/dev/null 2>&1 || true
18     ch "$E sys-fs/cryptsetup net-misc/dhcpcd sys-auth/elogind sys-apps/dbus app-admin/sudo"
19     ch "rc-update -q add elogind boot; rc-update -q add dbus default; rc-update -q add dhcpcd default"
20 }
21 pkg() {
22     case $1 in
23     sway | labwc | dwl) echo "gui-wm/$1" ;; # river: 0.4+ is not monolithic; Nix has river-classic
24     foot | fuzzel | wmenu) echo "gui-apps/$1" ;;
25     pipewire | wireplumber) echo "media-video/$1" ;;
26     esac
27 }
28 pkg_install() { ch "$E $*"; }
29 extra_pkgs() { :; }
30 user_add() { ch "useradd -m -G wheel,video,input,audio,usb -s /bin/bash $1"; }
31 serial_getty() { echo 's0:12345:respawn:/sbin/agetty -L 115200 ttyS0 vt100' >> $M/etc/inittab; }
32 nix_native() { return 1; }
33 nix_service() {
34     printf '#!/sbin/openrc-run\ncommand=/nix/var/nix/profiles/default/bin/nix-daemon\ncommand_background=yes\npidfile=/run/nix-daemon.pid\n' \
35         > $M/etc/init.d/nix-daemon
36     chmod 755 $M/etc/init.d/nix-daemon
37     ch "rc-update -q add nix-daemon default"
38 }
39 boot_cmd() {
40     printf '#!/bin/sh\n%s\n' "$1" >> $M/etc/local.d/waybase.start
41     chmod 755 $M/etc/local.d/waybase.start
42     ch "rc-update -q add local default"
43 }
44 kernel() {
45     fw=sys-kernel/linux-firmware; [ "${FIRMWARE:-}" = no ] && fw=""
46     # No binhost build of installkernel[dracut] or gentoo-kernel-bin; both only unpack prebuilt files, so nothing compiles.
47     ch "emerge --quiet --getbinpkg --usepkg --binpkg-respect-use=y --noreplace sys-kernel/installkernel" >/dev/null
48     ch "emerge --quiet --getbinpkg --usepkg --binpkg-respect-use=y --noreplace $fw sys-kernel/gentoo-kernel-bin" >/dev/null
49     KERNEL=$(cd $M/boot && ls vmlinuz-* | tail -1)
50     INITRD=$(cd $M/boot && ls initramfs-* | tail -1)
51     KARGS=""
52     CRYPTARGS="rd.luks.uuid=$UL rd.luks.name=$UL=root"
53 }