diff options
| author | Danilo M. <danix@danix.xyz> | 2026-10-19 20:53:05 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-10-19 20:53:05 +0200 |
| commit | e6ac42e158ed5ceee2c58eaf2f23a0ad3bb82f41 (patch) | |
| tree | af12ae932e9cbbf774f5a03cceeba0dc20c4b1c0 /sb-publish | |
| parent | 30c6bc22a445105e7e7f37fb00ca054de1ecf3ad (diff) | |
| download | slackrepo_setup-e6ac42e158ed5ceee2c58eaf2f23a0ad3bb82f41.tar.gz slackrepo_setup-e6ac42e158ed5ceee2c58eaf2f23a0ad3bb82f41.zip | |
Track the slackrepo config; add sb-publish and publish gates
slackrepo_SBo-danix.conf is now kept here. Site values (rsync target,
Gotify URL and key) moved to the root-only SBo-danix.local it sources;
make-local.py migrates them out of an old inline config. The rsync push
moved into sb-publish; rsync_push_hook calls it and holds back when
SBB_PUBLISH=n, so sb-builder can build without publishing and publish
later. --preview does not set OPT_DRY_RUN, so the hooks now also check
OPT_PREVIEW: previews no longer notify Gotify or run manage-packages.sh
for real. gpg-agent.conf adds allow-preset-passphrase so sb-builder can
unlock the signing key for jobs without a tty.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'sb-publish')
| -rwxr-xr-x | sb-publish | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/sb-publish b/sb-publish new file mode 100755 index 0000000..9f53c5f --- /dev/null +++ b/sb-publish @@ -0,0 +1,35 @@ +#!/bin/bash +# Copyright (C) 2026 Danilo M. <danix@danix.xyz> +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 as published +# by the Free Software Foundation. See the LICENSE file for details. + +# sb-publish: push the local package repository to the public mirror. +# +# Usage: sb-publish [PKGREPO] (default /repo) +# +# Called by rsync_push_hook in slackrepo_SBo-danix.conf after a build, unless +# the build ran with SBB_PUBLISH=n; run it by hand (or from sb-builder's +# Publish action) to push such builds later. Settings come from the root-only +# SB_LOCAL file (default /etc/slackrepo/SBo-danix.local): +# SB_RSYNC_TARGET rsync destination (required) +# SB_RSYNC_PASSWORD_FILE --password-file, if the file exists +# SB_RSYNC_EXCLUDES --exclude-from, if the file exists + +set -euo pipefail + +SB_LOCAL=${SB_LOCAL:-/etc/slackrepo/SBo-danix.local} +[ -r "$SB_LOCAL" ] && . "$SB_LOCAL" +: "${SB_RSYNC_TARGET:?SB_RSYNC_TARGET is not set in $SB_LOCAL}" + +pkgrepo=${1:-/repo} +args=( -havz --delete-after --stats ) +[ -n "${SB_RSYNC_EXCLUDES:-}" ] && [ -f "$SB_RSYNC_EXCLUDES" ] && \ + args+=( --exclude-from="$SB_RSYNC_EXCLUDES" ) +[ -n "${SB_RSYNC_PASSWORD_FILE:-}" ] && [ -f "$SB_RSYNC_PASSWORD_FILE" ] && \ + args+=( --password-file="$SB_RSYNC_PASSWORD_FILE" ) + +echo "sb-publish: pushing $pkgrepo to $SB_RSYNC_TARGET ..." +rsync "${args[@]}" "$pkgrepo"/ "$SB_RSYNC_TARGET" +echo "sb-publish: rsync push complete." |
