pi-gen: set HOME before git config --global in the chroot (systemd fix)

When the release runs under the wrolpi-release systemd service, HOME is unset,
so `git config --global --add safe.directory /opt/wrolpi` in the pi-gen chroot
aborts with "fatal: $HOME not set" and the build fails at stage 3. Manual
shell builds worked only because the shell provided HOME. Export HOME=/root in
the chroot hook (self-contained), and also set Environment=HOME=/root in the
service unit template.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Roland 2026-05-31 12:15:32 -06:00
parent dcfad8b4af
commit 5625f17b5b
No known key found for this signature in database
GPG key ID: 1BA620CE6C9A4680
2 changed files with 5 additions and 0 deletions

View file

@ -37,6 +37,9 @@ deno --version
# Put the latest WROLPi in /opt/wrolpi.
git clone -b "${WROLPI_BRANCH:-release}" https://github.com/lrnselfreliance/wrolpi.git /opt/wrolpi
# `git config --global` needs HOME, which is empty when the build runs under
# systemd (the release poller service has no HOME); set it to root's home.
export HOME=/root
git config --global --add safe.directory /opt/wrolpi
# Install Python requirements. Try multiple times because pypi may stop responding.

View file

@ -26,6 +26,8 @@ ExecStart=/opt/wrolpi/release/release-watch.sh
# Persistent state (failure markers, build lock): /var/lib/wrolpi-release
StateDirectory=wrolpi-release
Environment=STATE_DIR=/var/lib/wrolpi-release
# systemd leaves HOME unset; the pi-gen chroot's `git config --global` needs it.
Environment=HOME=/root
# Uncomment if the s3cmd config is not at /root/.s3cfg:
#Environment=S3CFG=/home/wrolpi/.s3cfg
# Optional: command to notify on release success/failure (gets one message arg).