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/arch.sh (2620 bytes)

1 # Arch: the official bootstrap tarball as the new root, then pacman inside it.
2 # systemd, systemd-logind (no seatd needed), systemd-networkd.
3 # shellcheck shell=sh disable=SC2034
4 ARCH_MIRROR=${ARCH_MIRROR:-https://geo.mirror.pkgbuild.com}
5 bootstrap() {
6     f=$(fetch "$ARCH_MIRROR/iso/latest/archlinux-bootstrap-x86_64.tar.zst")
7     zstd -dc "$f" | tar -x -C $M --strip-components=1 --numeric-owner && rm "$f"
8     echo "Server = $ARCH_MIRROR/\$repo/os/\$arch" > $M/etc/pacman.d/mirrorlist
9     sed -i 's/^CheckSpace/#CheckSpace/' $M/etc/pacman.conf   # / is not a mount point in the chroot
10     chroot_mounts
11     ch "pacman-key --init && pacman-key --populate archlinux" >/dev/null 2>&1
12     fw=linux-firmware; [ "${FIRMWARE:-}" = no ] && fw=""
13     ch "pacman -Syu --noconfirm --needed base linux $fw mkinitcpio cryptsetup e2fsprogs sudo \
14         mesa ttf-dejavu" >/dev/null
15     echo LANG=C.UTF-8 > $M/etc/locale.conf
16     ln -sf /usr/share/zoneinfo/UTC $M/etc/localtime
17     echo KEYMAP=us > $M/etc/vconsole.conf
18     ch "systemd-machine-id-setup && systemctl mask systemd-firstboot" >/dev/null 2>&1  # no prompts on first boot
19     printf '[Match]\nName=en* eth*\n\n[Network]\nDHCP=yes\n' > $M/etc/systemd/network/20-wired.network
20     ch "systemctl enable systemd-networkd systemd-resolved" >/dev/null 2>&1
21 }
22 pkg() { case $1 in pipewire) echo "pipewire pipewire-pulse" ;; river) echo river-classic ;; *) echo "$1" ;; esac; }
23 pkg_install() { ch "pacman -S --noconfirm --needed $*" >/dev/null; }
24 extra_pkgs() { :; }
25 user_add() { ch "useradd -m -G wheel,video,input,audio -s /bin/bash $1"; }
26 serial_getty() { ch "systemctl enable serial-getty@ttyS0" >/dev/null 2>&1; }
27 nix_native() { return 1; }
28 nix_service() {
29     ch "cp /nix/var/nix/profiles/default/lib/systemd/system/nix-daemon.* /etc/systemd/system/ &&
30         systemctl enable nix-daemon.socket"
31 }
32 boot_cmd() {
33     printf '[Unit]\nDescription=waybase boot command\n[Service]\nType=oneshot\nExecStart=/bin/sh -c "%s"\n[Install]\nWantedBy=multi-user.target\n' \
34         "$1" > $M/etc/systemd/system/waybase-boot.service
35     ch "systemctl enable waybase-boot" >/dev/null 2>&1
36 }
37 kernel() {
38     # No autodetect hook: the disk may move to other hardware.
39     sed -i 's/^HOOKS=.*/HOOKS=(base udev modconf kms keyboard keymap block encrypt filesystems fsck)/' $M/etc/mkinitcpio.conf
40     ch "mkinitcpio -P" >/dev/null 2>&1
41     # last step that needs DNS in the chroot is done; hand resolv.conf to resolved
42     ln -sf /run/systemd/resolve/stub-resolv.conf $M/etc/resolv.conf
43     KERNEL=vmlinuz-linux INITRD=initramfs-linux.img KARGS=""
44     CRYPTARGS="cryptdevice=UUID=$UL:root"
45 }