2023-09-24 20:10:09 -06:00
|
|
|
#!/bin/bash
|
Merging wrolpi-portable into debian-live-config; unifying Postgres on /media/wrolpi/config/postgresql.
Two parallel live-build configs (debian-live-config/ for the installer
ISO and wrolpi-portable/ for the Live USB) carry the same chroot hook
with subtly different fixes — the portable side had accumulated the
better implementation (npm build, SHA-pinned blobs, dynamic Postgres
version, partition-by-start-sector, controller.yaml sentinel, autologin,
branding). This commit folds those improvements into debian-live-config/
and retires wrolpi-portable/.
The Postgres data + config directories now bind-mount to
/media/wrolpi/config/postgresql/{data,config} regardless of deployment
shape (Live USB, Calamares-installed system with external drive,
Calamares-installed system with no external drive). Result: pulling
a WROLPi external drive from one host and plugging into another
brings the entire indexed library along — no re-indexing. Previously
the DB lived on /mnt/persistence/postgresql-{data,config} on Portable
and on /var/lib/postgresql (root) everywhere else; moving a drive
required rebuilding the DB on the new host.
Single wrolpi-bootstrap.{sh,service} replaces wrolpi-portable-bootstrap.
The script detects deployment by probing for a live-boot medium mount:
present → Live (create persistence partition if missing); absent →
Installed (skip partition step; Postgres bind-mount and cluster init
still run). --debian-installer is dropped from lb config; Calamares
will land in a follow-up commit as the graphical installer.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-24 12:07:36 -06:00
|
|
|
# Build the WROLPi Debian Live + installer ISO.
|
|
|
|
|
#
|
|
|
|
|
# Output: an iso-hybrid image that boots into a full WROLPi system on any
|
|
|
|
|
# x86 PC. Users can run WROLPi directly off the USB (persistence partition
|
|
|
|
|
# created on first boot) or install to disk via the Calamares launcher on
|
|
|
|
|
# the desktop. Calamares wiring lands in phase 2; phase 1 ships the
|
|
|
|
|
# live-only flow.
|
|
|
|
|
#
|
2023-10-09 12:00:51 -06:00
|
|
|
# https://live-team.pages.debian.net/live-manual/html/live-manual/index.en.html
|
2023-09-24 20:10:09 -06:00
|
|
|
|
|
|
|
|
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
Debian 13 (trixie) rebase: docker, debian-live-config, and pi-gen builds.
All three build targets move from Debian 12/bookworm to Debian 13/trixie
for fresh installs; existing Debian 12 systems remain supported in place.
Docker: api/help on python:3.13-trixie, controller on 3.13-slim-trixie,
app on node:20-trixie (matches trixie's nodejs 20), samba/zim on
debian:13. Full backend suite passes on Python 3.13 in the api container.
debian-live-config: --distribution trixie; postgres teardown for the
SQLite cutover (pg_dropcluster hook block removed, wrolpi-bootstrap.sh no
longer creates a cluster or calls the deleted initialize_api_db.sh — the
API creates wrolpi.db itself on first start). README documents the
SQLite layout and drops Etcher recommendations.
pi-gen: upstream has no trixie branch — the arm64 branch now defaults to
RELEASE=trixie; KEYBOARD_KEYMAP=en_US is rejected by trixie's
console-setup (ckbcomp validates), use 'us'; stop stamping a Postgres
.pgpass into /etc/skel.
Package lists (both targets): postgresql-15/postgresql-doc/libpq-dev
deleted; libtiff5-dev renamed to libtiff-dev; software-properties-common
and cpufrequtils removed from trixie (Controller CPU throttle falls back
to sysfs, dead cpufreq-set sudoers rule removed); locales and gnupg added
(no longer arrive transitively under --apt-recommends false); sqlite3 CLI
added for reset_tags.sh.
help.sh: replace the Postgres service/port/socket/cluster/psql checks
(all false FAILEDs after the SQLite cutover) with SQLite checks:
wrolpi.db exists, PRAGMA quick_check, file_group table + row count, run
as the wrolpi user so root never creates the -shm sidecar.
Both build scripts take a WROLPI_BUILD_DIR override so development builds
can run beside the release pipeline's build trees; the sudo re-exec
passes it through explicitly (a plain sudo would drop it).
test_common.py: the truncate tests hard-coded sys.getsizeof results from
the 3.11 object layout (str/list shrank in 3.12); assert the contract
(fits budget, prefix, monotonic in budget) so they pass on 3.11 and 3.13.
Verified: trixie ISO (3.7G) and pi-gen desktop image (4.3G) both built
from scratch and passed their sanity checks.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-13 15:16:00 -06:00
|
|
|
# Overridable so a development build can run beside the release pipeline's
|
|
|
|
|
# build tree without colliding with it.
|
|
|
|
|
BUILD_DIR="${WROLPI_BUILD_DIR:-/var/tmp/wrolpi-build-debian}"
|
2023-09-24 20:10:09 -06:00
|
|
|
|
2026-02-22 15:09:15 -07:00
|
|
|
Help() {
|
|
|
|
|
echo "Build WROLPi Debian Live ISO image."
|
|
|
|
|
echo
|
|
|
|
|
echo "Syntax: build.sh [-h] [-b BRANCH]"
|
|
|
|
|
echo "options:"
|
|
|
|
|
echo "h Print this help."
|
|
|
|
|
echo "b Build from this git BRANCH (default: 'release')."
|
|
|
|
|
echo
|
Debian 13 (trixie) rebase: docker, debian-live-config, and pi-gen builds.
All three build targets move from Debian 12/bookworm to Debian 13/trixie
for fresh installs; existing Debian 12 systems remain supported in place.
Docker: api/help on python:3.13-trixie, controller on 3.13-slim-trixie,
app on node:20-trixie (matches trixie's nodejs 20), samba/zim on
debian:13. Full backend suite passes on Python 3.13 in the api container.
debian-live-config: --distribution trixie; postgres teardown for the
SQLite cutover (pg_dropcluster hook block removed, wrolpi-bootstrap.sh no
longer creates a cluster or calls the deleted initialize_api_db.sh — the
API creates wrolpi.db itself on first start). README documents the
SQLite layout and drops Etcher recommendations.
pi-gen: upstream has no trixie branch — the arm64 branch now defaults to
RELEASE=trixie; KEYBOARD_KEYMAP=en_US is rejected by trixie's
console-setup (ckbcomp validates), use 'us'; stop stamping a Postgres
.pgpass into /etc/skel.
Package lists (both targets): postgresql-15/postgresql-doc/libpq-dev
deleted; libtiff5-dev renamed to libtiff-dev; software-properties-common
and cpufrequtils removed from trixie (Controller CPU throttle falls back
to sysfs, dead cpufreq-set sudoers rule removed); locales and gnupg added
(no longer arrive transitively under --apt-recommends false); sqlite3 CLI
added for reset_tags.sh.
help.sh: replace the Postgres service/port/socket/cluster/psql checks
(all false FAILEDs after the SQLite cutover) with SQLite checks:
wrolpi.db exists, PRAGMA quick_check, file_group table + row count, run
as the wrolpi user so root never creates the -shm sidecar.
Both build scripts take a WROLPI_BUILD_DIR override so development builds
can run beside the release pipeline's build trees; the sudo re-exec
passes it through explicitly (a plain sudo would drop it).
test_common.py: the truncate tests hard-coded sys.getsizeof results from
the 3.11 object layout (str/list shrank in 3.12); assert the contract
(fits budget, prefix, monotonic in budget) so they pass on 3.11 and 3.13.
Verified: trixie ISO (3.7G) and pi-gen desktop image (4.3G) both built
from scratch and passed their sanity checks.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-13 15:16:00 -06:00
|
|
|
echo "Set WROLPI_BUILD_DIR to build somewhere other than the default"
|
|
|
|
|
echo "(${BUILD_DIR}), e.g. beside the release pipeline's tree."
|
|
|
|
|
echo
|
2026-02-22 15:09:15 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BRANCH="release"
|
|
|
|
|
while getopts ":hb:" option; do
|
|
|
|
|
case $option in
|
|
|
|
|
h) Help; exit ;;
|
|
|
|
|
b) BRANCH="${OPTARG}" ;;
|
|
|
|
|
*) echo "Error: Invalid option"; exit 1 ;;
|
|
|
|
|
esac
|
|
|
|
|
done
|
|
|
|
|
|
Merging wrolpi-portable into debian-live-config; unifying Postgres on /media/wrolpi/config/postgresql.
Two parallel live-build configs (debian-live-config/ for the installer
ISO and wrolpi-portable/ for the Live USB) carry the same chroot hook
with subtly different fixes — the portable side had accumulated the
better implementation (npm build, SHA-pinned blobs, dynamic Postgres
version, partition-by-start-sector, controller.yaml sentinel, autologin,
branding). This commit folds those improvements into debian-live-config/
and retires wrolpi-portable/.
The Postgres data + config directories now bind-mount to
/media/wrolpi/config/postgresql/{data,config} regardless of deployment
shape (Live USB, Calamares-installed system with external drive,
Calamares-installed system with no external drive). Result: pulling
a WROLPi external drive from one host and plugging into another
brings the entire indexed library along — no re-indexing. Previously
the DB lived on /mnt/persistence/postgresql-{data,config} on Portable
and on /var/lib/postgresql (root) everywhere else; moving a drive
required rebuilding the DB on the new host.
Single wrolpi-bootstrap.{sh,service} replaces wrolpi-portable-bootstrap.
The script detects deployment by probing for a live-boot medium mount:
present → Live (create persistence partition if missing); absent →
Installed (skip partition step; Postgres bind-mount and cluster init
still run). --debian-installer is dropped from lb config; Calamares
will land in a follow-up commit as the graphical installer.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-24 12:07:36 -06:00
|
|
|
# Get version from the target git branch (not local checkout) so output
|
|
|
|
|
# filename matches actual content. Strip whitespace so stray newlines or
|
|
|
|
|
# spaces in version.txt do not corrupt the lb config metadata strings.
|
|
|
|
|
VERSION=$(curl -sL "https://raw.githubusercontent.com/lrnselfreliance/wrolpi/${BRANCH}/wrolpi/version.txt" | tr -d '[:space:]')
|
2026-02-26 17:45:39 -07:00
|
|
|
if [ -z "${VERSION}" ]; then
|
|
|
|
|
echo "ERROR: Could not fetch version from branch '${BRANCH}'"
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
echo "Building WROLPi version: ${VERSION} from branch: ${BRANCH}"
|
|
|
|
|
|
Debian 13 (trixie) rebase: docker, debian-live-config, and pi-gen builds.
All three build targets move from Debian 12/bookworm to Debian 13/trixie
for fresh installs; existing Debian 12 systems remain supported in place.
Docker: api/help on python:3.13-trixie, controller on 3.13-slim-trixie,
app on node:20-trixie (matches trixie's nodejs 20), samba/zim on
debian:13. Full backend suite passes on Python 3.13 in the api container.
debian-live-config: --distribution trixie; postgres teardown for the
SQLite cutover (pg_dropcluster hook block removed, wrolpi-bootstrap.sh no
longer creates a cluster or calls the deleted initialize_api_db.sh — the
API creates wrolpi.db itself on first start). README documents the
SQLite layout and drops Etcher recommendations.
pi-gen: upstream has no trixie branch — the arm64 branch now defaults to
RELEASE=trixie; KEYBOARD_KEYMAP=en_US is rejected by trixie's
console-setup (ckbcomp validates), use 'us'; stop stamping a Postgres
.pgpass into /etc/skel.
Package lists (both targets): postgresql-15/postgresql-doc/libpq-dev
deleted; libtiff5-dev renamed to libtiff-dev; software-properties-common
and cpufrequtils removed from trixie (Controller CPU throttle falls back
to sysfs, dead cpufreq-set sudoers rule removed); locales and gnupg added
(no longer arrive transitively under --apt-recommends false); sqlite3 CLI
added for reset_tags.sh.
help.sh: replace the Postgres service/port/socket/cluster/psql checks
(all false FAILEDs after the SQLite cutover) with SQLite checks:
wrolpi.db exists, PRAGMA quick_check, file_group table + row count, run
as the wrolpi user so root never creates the -shm sidecar.
Both build scripts take a WROLPI_BUILD_DIR override so development builds
can run beside the release pipeline's build trees; the sudo re-exec
passes it through explicitly (a plain sudo would drop it).
test_common.py: the truncate tests hard-coded sys.getsizeof results from
the 3.11 object layout (str/list shrank in 3.12); assert the contract
(fits budget, prefix, monotonic in budget) so they pass on 3.11 and 3.13.
Verified: trixie ISO (3.7G) and pi-gen desktop image (4.3G) both built
from scratch and passed their sanity checks.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-13 15:16:00 -06:00
|
|
|
# Re-execute this script if it wasn't called with sudo. Pass BUILD_DIR
|
|
|
|
|
# through explicitly — a plain `sudo "$0"` drops WROLPI_BUILD_DIR from the
|
|
|
|
|
# environment and the build would silently land on the default path.
|
2023-09-24 20:10:09 -06:00
|
|
|
if [ $EUID != 0 ]; then
|
Debian 13 (trixie) rebase: docker, debian-live-config, and pi-gen builds.
All three build targets move from Debian 12/bookworm to Debian 13/trixie
for fresh installs; existing Debian 12 systems remain supported in place.
Docker: api/help on python:3.13-trixie, controller on 3.13-slim-trixie,
app on node:20-trixie (matches trixie's nodejs 20), samba/zim on
debian:13. Full backend suite passes on Python 3.13 in the api container.
debian-live-config: --distribution trixie; postgres teardown for the
SQLite cutover (pg_dropcluster hook block removed, wrolpi-bootstrap.sh no
longer creates a cluster or calls the deleted initialize_api_db.sh — the
API creates wrolpi.db itself on first start). README documents the
SQLite layout and drops Etcher recommendations.
pi-gen: upstream has no trixie branch — the arm64 branch now defaults to
RELEASE=trixie; KEYBOARD_KEYMAP=en_US is rejected by trixie's
console-setup (ckbcomp validates), use 'us'; stop stamping a Postgres
.pgpass into /etc/skel.
Package lists (both targets): postgresql-15/postgresql-doc/libpq-dev
deleted; libtiff5-dev renamed to libtiff-dev; software-properties-common
and cpufrequtils removed from trixie (Controller CPU throttle falls back
to sysfs, dead cpufreq-set sudoers rule removed); locales and gnupg added
(no longer arrive transitively under --apt-recommends false); sqlite3 CLI
added for reset_tags.sh.
help.sh: replace the Postgres service/port/socket/cluster/psql checks
(all false FAILEDs after the SQLite cutover) with SQLite checks:
wrolpi.db exists, PRAGMA quick_check, file_group table + row count, run
as the wrolpi user so root never creates the -shm sidecar.
Both build scripts take a WROLPI_BUILD_DIR override so development builds
can run beside the release pipeline's build trees; the sudo re-exec
passes it through explicitly (a plain sudo would drop it).
test_common.py: the truncate tests hard-coded sys.getsizeof results from
the 3.11 object layout (str/list shrank in 3.12); assert the contract
(fits budget, prefix, monotonic in budget) so they pass on 3.11 and 3.13.
Verified: trixie ISO (3.7G) and pi-gen desktop image (4.3G) both built
from scratch and passed their sanity checks.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-13 15:16:00 -06:00
|
|
|
sudo WROLPI_BUILD_DIR="${BUILD_DIR}" "$0" "$@"
|
2023-09-24 20:10:09 -06:00
|
|
|
exit $?
|
|
|
|
|
fi
|
|
|
|
|
|
Merging wrolpi-portable into debian-live-config; unifying Postgres on /media/wrolpi/config/postgresql.
Two parallel live-build configs (debian-live-config/ for the installer
ISO and wrolpi-portable/ for the Live USB) carry the same chroot hook
with subtly different fixes — the portable side had accumulated the
better implementation (npm build, SHA-pinned blobs, dynamic Postgres
version, partition-by-start-sector, controller.yaml sentinel, autologin,
branding). This commit folds those improvements into debian-live-config/
and retires wrolpi-portable/.
The Postgres data + config directories now bind-mount to
/media/wrolpi/config/postgresql/{data,config} regardless of deployment
shape (Live USB, Calamares-installed system with external drive,
Calamares-installed system with no external drive). Result: pulling
a WROLPi external drive from one host and plugging into another
brings the entire indexed library along — no re-indexing. Previously
the DB lived on /mnt/persistence/postgresql-{data,config} on Portable
and on /var/lib/postgresql (root) everywhere else; moving a drive
required rebuilding the DB on the new host.
Single wrolpi-bootstrap.{sh,service} replaces wrolpi-portable-bootstrap.
The script detects deployment by probing for a live-boot medium mount:
present → Live (create persistence partition if missing); absent →
Installed (skip partition step; Postgres bind-mount and cluster init
still run). --debian-installer is dropped from lb config; Calamares
will land in a follow-up commit as the graphical installer.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-24 12:07:36 -06:00
|
|
|
# Clear out old builds. Strip immutable flag from blob files first — the
|
|
|
|
|
# chroot hook applies chattr +i to /opt/wrolpi-blobs/*; without removing
|
|
|
|
|
# that here, rm -rf leaves them behind and the next lb build's
|
|
|
|
|
# chroot_includes_after_packages rsync fails with "Operation not permitted"
|
|
|
|
|
# trying to overwrite them.
|
|
|
|
|
if [ -d "${BUILD_DIR}" ]; then
|
|
|
|
|
find "${BUILD_DIR}" -path '*/opt/wrolpi-blobs/*' -type f -exec chattr -i {} + 2>/dev/null || true
|
|
|
|
|
rm -rf "${BUILD_DIR}"
|
|
|
|
|
fi
|
|
|
|
|
mkdir -p "${BUILD_DIR}"
|
2023-09-24 20:10:09 -06:00
|
|
|
cd "${BUILD_DIR}" || (echo "Work directory must exist" && exit 1)
|
|
|
|
|
set -e
|
|
|
|
|
|
2026-05-24 17:05:31 -06:00
|
|
|
# Live + Debian Installer. The installer is the stock Debian d-i with
|
|
|
|
|
# `--debian-installer live`, which copies the running squashfs onto the
|
|
|
|
|
# target disk (much faster than a network-based install) and presents the
|
|
|
|
|
# usual graphical/text installer flow. GRUB gets "Install" + "Graphical
|
|
|
|
|
# install" + "Live" entries. noswap prevents the live system from
|
|
|
|
|
# activating swap partitions found on the host machine's internal disks.
|
2026-10-14 15:42:37 -06:00
|
|
|
# ca-certificates must be in the bootstrap so apt can reach the HTTPS
|
|
|
|
|
# repositories in config/archives/ before the package lists are installed.
|
2023-09-24 20:10:09 -06:00
|
|
|
lb config \
|
|
|
|
|
--binary-images iso-hybrid \
|
|
|
|
|
--mode debian \
|
|
|
|
|
--architectures amd64 \
|
|
|
|
|
--linux-flavours amd64 \
|
Debian 13 (trixie) rebase: docker, debian-live-config, and pi-gen builds.
All three build targets move from Debian 12/bookworm to Debian 13/trixie
for fresh installs; existing Debian 12 systems remain supported in place.
Docker: api/help on python:3.13-trixie, controller on 3.13-slim-trixie,
app on node:20-trixie (matches trixie's nodejs 20), samba/zim on
debian:13. Full backend suite passes on Python 3.13 in the api container.
debian-live-config: --distribution trixie; postgres teardown for the
SQLite cutover (pg_dropcluster hook block removed, wrolpi-bootstrap.sh no
longer creates a cluster or calls the deleted initialize_api_db.sh — the
API creates wrolpi.db itself on first start). README documents the
SQLite layout and drops Etcher recommendations.
pi-gen: upstream has no trixie branch — the arm64 branch now defaults to
RELEASE=trixie; KEYBOARD_KEYMAP=en_US is rejected by trixie's
console-setup (ckbcomp validates), use 'us'; stop stamping a Postgres
.pgpass into /etc/skel.
Package lists (both targets): postgresql-15/postgresql-doc/libpq-dev
deleted; libtiff5-dev renamed to libtiff-dev; software-properties-common
and cpufrequtils removed from trixie (Controller CPU throttle falls back
to sysfs, dead cpufreq-set sudoers rule removed); locales and gnupg added
(no longer arrive transitively under --apt-recommends false); sqlite3 CLI
added for reset_tags.sh.
help.sh: replace the Postgres service/port/socket/cluster/psql checks
(all false FAILEDs after the SQLite cutover) with SQLite checks:
wrolpi.db exists, PRAGMA quick_check, file_group table + row count, run
as the wrolpi user so root never creates the -shm sidecar.
Both build scripts take a WROLPI_BUILD_DIR override so development builds
can run beside the release pipeline's build trees; the sudo re-exec
passes it through explicitly (a plain sudo would drop it).
test_common.py: the truncate tests hard-coded sys.getsizeof results from
the 3.11 object layout (str/list shrank in 3.12); assert the contract
(fits budget, prefix, monotonic in budget) so they pass on 3.11 and 3.13.
Verified: trixie ISO (3.7G) and pi-gen desktop image (4.3G) both built
from scratch and passed their sanity checks.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-13 15:16:00 -06:00
|
|
|
--distribution trixie \
|
2026-05-24 17:05:31 -06:00
|
|
|
--debian-installer live \
|
|
|
|
|
--debian-installer-gui true \
|
2023-09-24 20:10:09 -06:00
|
|
|
--archive-areas "main contrib non-free non-free-firmware" \
|
|
|
|
|
--updates true \
|
|
|
|
|
--security true \
|
|
|
|
|
--apt-recommends false \
|
2026-10-14 15:42:37 -06:00
|
|
|
--debootstrap-options "--include=ca-certificates" \
|
2023-09-24 20:10:09 -06:00
|
|
|
--firmware-binary true \
|
|
|
|
|
--firmware-chroot true \
|
|
|
|
|
--win32-loader false \
|
|
|
|
|
--checksums sha512 \
|
|
|
|
|
--clean \
|
|
|
|
|
--color \
|
|
|
|
|
--linux-packages "linux-image linux-headers" \
|
|
|
|
|
--memtest memtest86+ \
|
2026-10-14 18:23:40 -06:00
|
|
|
--bootappend-live "boot=live components quiet splash noswap persistence persistence-storage=filesystem persistence-media=removable persistence-label=persistence live-config.username=user live-config.user-fullname=WROLPi live-config.hostname=wrolpi" \
|
2023-10-09 08:44:48 -06:00
|
|
|
--iso-volume "WROLPi v${VERSION}" \
|
|
|
|
|
--iso-application "WROLPi v${VERSION}" \
|
2023-09-24 20:10:09 -06:00
|
|
|
--iso-preparer WROLPi \
|
|
|
|
|
--iso-publisher https://wrolpi.org
|
|
|
|
|
|
|
|
|
|
rsync -a "${SCRIPT_DIR}/config" "${BUILD_DIR}/"
|
|
|
|
|
|
2026-02-22 15:09:15 -07:00
|
|
|
# Write branch config for hook script.
|
2026-03-29 18:58:31 -06:00
|
|
|
mkdir -p "${BUILD_DIR}/config/includes.chroot/opt/wrolpi-blobs"
|
2026-02-22 15:09:15 -07:00
|
|
|
echo "${BRANCH}" > "${BUILD_DIR}/config/includes.chroot/opt/wrolpi-branch"
|
|
|
|
|
|
2026-03-29 18:58:31 -06:00
|
|
|
# Cache directory for downloaded blobs (persists across builds).
|
|
|
|
|
BLOB_CACHE="${SCRIPT_DIR}/files"
|
|
|
|
|
mkdir -p "${BLOB_CACHE}"
|
|
|
|
|
|
|
|
|
|
# Download map fonts (skip if cached).
|
|
|
|
|
if [ ! -f "${BLOB_CACHE}/map-fonts.tar.gz" ]; then
|
|
|
|
|
echo "Downloading map fonts..."
|
|
|
|
|
mkdir -p /tmp/map-fonts-dl
|
|
|
|
|
curl -fsSL https://github.com/protomaps/basemaps-assets/archive/refs/heads/main.tar.gz \
|
|
|
|
|
| tar -xz --strip-components=1 -C /tmp/map-fonts-dl basemaps-assets-main/fonts
|
|
|
|
|
tar -czf "${BLOB_CACHE}/map-fonts.tar.gz" -C /tmp/map-fonts-dl fonts
|
|
|
|
|
rm -rf /tmp/map-fonts-dl
|
|
|
|
|
fi
|
|
|
|
|
[[ -f "${BLOB_CACHE}/map-fonts.tar.gz" && -s "${BLOB_CACHE}/map-fonts.tar.gz" ]] || \
|
|
|
|
|
(echo "ERROR: Failed to download map fonts!" && exit 1)
|
|
|
|
|
|
|
|
|
|
# Download map overview (skip if cached).
|
|
|
|
|
if [ ! -f "${BLOB_CACHE}/map-overview.pmtiles" ]; then
|
|
|
|
|
echo "Downloading map overview..."
|
|
|
|
|
curl -fsSL https://wrolpi.nyc3.cdn.digitaloceanspaces.com/maps/map-overview.pmtiles \
|
|
|
|
|
-o "${BLOB_CACHE}/map-overview.pmtiles"
|
|
|
|
|
fi
|
|
|
|
|
[[ -f "${BLOB_CACHE}/map-overview.pmtiles" && -s "${BLOB_CACHE}/map-overview.pmtiles" ]] || \
|
|
|
|
|
(echo "ERROR: Failed to download map overview!" && exit 1)
|
|
|
|
|
|
|
|
|
|
# Copy cached blobs into the live image.
|
|
|
|
|
cp "${BLOB_CACHE}/map-fonts.tar.gz" "${BUILD_DIR}/config/includes.chroot/opt/wrolpi-blobs/"
|
|
|
|
|
cp "${BLOB_CACHE}/map-overview.pmtiles" "${BUILD_DIR}/config/includes.chroot/opt/wrolpi-blobs/"
|
|
|
|
|
|
Merging wrolpi-portable into debian-live-config; unifying Postgres on /media/wrolpi/config/postgresql.
Two parallel live-build configs (debian-live-config/ for the installer
ISO and wrolpi-portable/ for the Live USB) carry the same chroot hook
with subtly different fixes — the portable side had accumulated the
better implementation (npm build, SHA-pinned blobs, dynamic Postgres
version, partition-by-start-sector, controller.yaml sentinel, autologin,
branding). This commit folds those improvements into debian-live-config/
and retires wrolpi-portable/.
The Postgres data + config directories now bind-mount to
/media/wrolpi/config/postgresql/{data,config} regardless of deployment
shape (Live USB, Calamares-installed system with external drive,
Calamares-installed system with no external drive). Result: pulling
a WROLPi external drive from one host and plugging into another
brings the entire indexed library along — no re-indexing. Previously
the DB lived on /mnt/persistence/postgresql-{data,config} on Portable
and on /var/lib/postgresql (root) everywhere else; moving a drive
required rebuilding the DB on the new host.
Single wrolpi-bootstrap.{sh,service} replaces wrolpi-portable-bootstrap.
The script detects deployment by probing for a live-boot medium mount:
present → Live (create persistence partition if missing); absent →
Installed (skip partition step; Postgres bind-mount and cluster init
still run). --debian-installer is dropped from lb config; Calamares
will land in a follow-up commit as the graphical installer.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-24 12:07:36 -06:00
|
|
|
# pipefail so an lb build failure isn't masked by tee's success exit code.
|
|
|
|
|
set -o pipefail
|
2023-10-12 18:33:51 -06:00
|
|
|
time nice -n 18 lb build 2>&1 | tee "${SCRIPT_DIR}/build.log"
|
Merging wrolpi-portable into debian-live-config; unifying Postgres on /media/wrolpi/config/postgresql.
Two parallel live-build configs (debian-live-config/ for the installer
ISO and wrolpi-portable/ for the Live USB) carry the same chroot hook
with subtly different fixes — the portable side had accumulated the
better implementation (npm build, SHA-pinned blobs, dynamic Postgres
version, partition-by-start-sector, controller.yaml sentinel, autologin,
branding). This commit folds those improvements into debian-live-config/
and retires wrolpi-portable/.
The Postgres data + config directories now bind-mount to
/media/wrolpi/config/postgresql/{data,config} regardless of deployment
shape (Live USB, Calamares-installed system with external drive,
Calamares-installed system with no external drive). Result: pulling
a WROLPi external drive from one host and plugging into another
brings the entire indexed library along — no re-indexing. Previously
the DB lived on /mnt/persistence/postgresql-{data,config} on Portable
and on /var/lib/postgresql (root) everywhere else; moving a drive
required rebuilding the DB on the new host.
Single wrolpi-bootstrap.{sh,service} replaces wrolpi-portable-bootstrap.
The script detects deployment by probing for a live-boot medium mount:
present → Live (create persistence partition if missing); absent →
Installed (skip partition step; Postgres bind-mount and cluster init
still run). --debian-installer is dropped from lb config; Calamares
will land in a follow-up commit as the graphical installer.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-24 12:07:36 -06:00
|
|
|
set +o pipefail
|
2023-09-24 20:10:09 -06:00
|
|
|
|
2023-11-25 09:30:36 -07:00
|
|
|
grep "9999-wrolpi.hook.chroot completed" "${SCRIPT_DIR}/build.log" >/dev/null 2>&1 || (echo "build hook failed!" && exit 1)
|
|
|
|
|
|
2026-05-30 20:27:11 -06:00
|
|
|
# Copy the freshly built ISO directly to its final name. Take the single ISO
|
|
|
|
|
# out of BUILD_DIR (which is wiped each build, so it holds exactly one) rather
|
|
|
|
|
# than globbing SCRIPT_DIR -- a leftover ISO from a previous build would
|
|
|
|
|
# otherwise make a `*.iso` glob match multiple files and break the move.
|
2023-10-09 12:00:51 -06:00
|
|
|
DEST="${SCRIPT_DIR}/WROLPi-v${VERSION}-amd64.iso"
|
2026-05-30 20:27:11 -06:00
|
|
|
shopt -s nullglob
|
|
|
|
|
BUILT_ISOS=("${BUILD_DIR}"/*.iso)
|
|
|
|
|
shopt -u nullglob
|
|
|
|
|
if [ "${#BUILT_ISOS[@]}" -eq 0 ]; then
|
|
|
|
|
echo "Build failed. No ISOs were found!"
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
rm -f "${DEST}"
|
|
|
|
|
cp "${BUILT_ISOS[0]}" "${DEST}"
|
|
|
|
|
chmod 644 "${DEST}"
|
|
|
|
|
chown "${SUDO_UID:-1000}:${SUDO_GID:-1000}" "${DEST}"
|
2023-10-09 12:00:51 -06:00
|
|
|
|
2026-05-29 11:02:32 -06:00
|
|
|
# Sanity-check the resulting ISO before declaring success, so a truncated or
|
|
|
|
|
# corrupt build never ships.
|
|
|
|
|
MIN_ISO_BYTES=$((1024 * 1024 * 1024)) # 1 GiB floor; a real ISO is ~3 GiB.
|
|
|
|
|
ISO_BYTES=$(stat -c%s "${DEST}")
|
|
|
|
|
if [ "${ISO_BYTES}" -lt "${MIN_ISO_BYTES}" ]; then
|
|
|
|
|
echo "ERROR: ISO is only ${ISO_BYTES} bytes (< ${MIN_ISO_BYTES}); build likely truncated." >&2
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
# The ISO 9660 primary volume descriptor carries the "CD001" magic at byte
|
|
|
|
|
# offset 32769. It is present even in iso-hybrid images, where `file` reports
|
|
|
|
|
# the leading MBR instead.
|
|
|
|
|
if [ "$(dd if="${DEST}" bs=1 skip=32769 count=5 2>/dev/null)" != "CD001" ]; then
|
|
|
|
|
echo "ERROR: ${DEST} is not a valid ISO 9660 image (missing CD001 magic)." >&2
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
# Cross-check with blkid when available.
|
|
|
|
|
if command -v blkid >/dev/null 2>&1; then
|
|
|
|
|
ISO_FSTYPE=$(blkid -o value -s TYPE "${DEST}" 2>/dev/null || true)
|
|
|
|
|
if [ -n "${ISO_FSTYPE}" ] && [ "${ISO_FSTYPE}" != "iso9660" ]; then
|
|
|
|
|
echo "ERROR: blkid reports filesystem '${ISO_FSTYPE}', expected iso9660." >&2
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
echo "ISO sanity checks passed ($(numfmt --to=iec "${ISO_BYTES}" 2>/dev/null || echo "${ISO_BYTES} bytes"), iso9660)."
|
|
|
|
|
|
2026-10-14 15:42:37 -06:00
|
|
|
# Problems that only appear once the Debian installer has run (e.g. packages it
|
|
|
|
|
# would purge from the installed system).
|
|
|
|
|
"${SCRIPT_DIR}/check-iso.sh" "${DEST}" || exit 1
|
|
|
|
|
|
2023-10-09 12:00:51 -06:00
|
|
|
echo "Build has completed. ISO output ${DEST}"
|