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


build-image.sh (1745 bytes)

1 #!/bin/sh
2 # build-image.sh - build waybase.img: the official Alpine "standard" ISO with
3 # the installer added under /waybase. The result is a hybrid image (BIOS and
4 # UEFI, CD or USB/SD). Needs docker, or run it on Alpine as root with DOCKER=0.
5 #   sh build-image.sh [OUT_DIR]        (default: ./out)
6 set -eu
7 here=$(cd "$(dirname "$0")" && pwd)
8 mkdir -p "${1:-$here/out}"; OUT=$(cd "${1:-$here/out}" && pwd)
9 build() {
10     set -eu
11     apk add -q xorriso
12     V=$(cut -d. -f1,2 /etc/alpine-release) R=$(cat /etc/alpine-release)
13     ISO=$OUT/alpine-standard-$R-x86_64.iso
14     [ -s "$ISO" ] || wget -q -O "$ISO" "https://dl-cdn.alpinelinux.org/alpine/v$V/releases/x86_64/${ISO##*/}"
15     W=$(mktemp -d); mkdir -p "$W/waybase"
16     cp -r "$SRC/install.sh" "$SRC/firmware.sh" "$SRC/firmware.example" "$SRC/answers.example" "$SRC/backends" "$W/waybase/"
17     # serial console as well as the screen, so the installer runs headless too
18     xorriso -osirrox on -indev "$ISO" -extract /boot/grub/grub.cfg "$W/grub.cfg" \
19         -extract /boot/syslinux/syslinux.cfg "$W/syslinux.cfg" 2>/dev/null
20     chmod u+w "$W"/*.cfg
21     sed -i '/modules=/s/$/ console=ttyS0,115200 console=tty0/' "$W/grub.cfg" "$W/syslinux.cfg"
22     rm -f "$OUT/waybase.img"
23     xorriso -indev "$ISO" -outdev "$OUT/waybase.img" -map "$W/waybase" /waybase \
24         -map "$W/grub.cfg" /boot/grub/grub.cfg -map "$W/syslinux.cfg" /boot/syslinux/syslinux.cfg \
25         -boot_image any replay 2>&1 | grep -E 'Written to|FAILURE' || true
26     rm -rf "$W"
27     ls -l "$OUT/waybase.img"
28 }
29 if [ "${DOCKER:-1}" = 0 ]; then
30     SRC=$here; build
31 else
32     docker run --rm -i -v "$here:/src:ro" -v "$OUT:/out" alpine:latest sh -c \
33         "$(sed -n '/^build() {/,/^}/p' "$0"); SRC=/src OUT=/out build"
34 fi