wrolpi/release/wrolpi-release.service
Roland 5625f17b5b
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>
2026-05-31 12:15:32 -06:00

37 lines
1.6 KiB
Desktop File

# WROLPi release poller (oneshot, driven by wrolpi-release.timer).
#
# Checks GitHub for a newly-published release and builds + publishes it.
# This is OUTBOUND polling only -- GitHub never connects to this machine.
#
# Install (as root):
# cp release/wrolpi-release.service release/wrolpi-release.timer /etc/systemd/system/
# # edit paths/user below to match this host, then:
# systemctl daemon-reload
# systemctl enable --now wrolpi-release.timer
#
# The builds need root (chroot), so this runs as root. s3cmd therefore reads
# /root/.s3cfg by default -- either place the Spaces credentials there or point
# S3CFG at another location below.
[Unit]
Description=WROLPi release poller (build & publish new GitHub releases)
After=network-online.target
Wants=network-online.target
[Service]
Type=oneshot
# Adjust to wherever the WROLPi repo lives on this host (production: /opt/wrolpi).
WorkingDirectory=/opt/wrolpi/release
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).
# Keep the real path here on the host -- it is intentionally not in the repo.
#Environment=WROLPI_RELEASE_NOTIFY=/home/wrolpi/bin/notify
# A full release builds two images and can run for hours.
TimeoutStartSec=0