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 /make-local.py | |
| 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 'make-local.py')
| -rw-r--r-- | make-local.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/make-local.py b/make-local.py new file mode 100644 index 0000000..366935c --- /dev/null +++ b/make-local.py @@ -0,0 +1,31 @@ +#!/usr/bin/env python3 +# 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. + +# Run on the VM, as root, BEFORE installing the new slackrepo_SBo-danix.conf: +# copies the site values out of the old config into SBo-danix.local (mode 600). +# Prints only which keys it found, never their values. +import os, re, sys +old, dest = sys.argv[1], sys.argv[2] +if os.path.exists(dest): + sys.exit(f"{dest} exists, left alone") +s = open(old).read() +found = { + "SB_RSYNC_TARGET": re.search(r"local rsync_target='([^']*)'", s), + "SB_RSYNC_EXCLUDES": re.search(r"local rsync_excludes='([^']*)'", s), + "SB_RSYNC_PASSWORD_FILE": re.search(r"local rsync_password_file='([^']*)'", s), + "SB_GOTIFY_KEY": re.search(r'X-Gotify-Key: ([^"]*)"', s), + "SB_GOTIFY_URL": re.search(r'\n\s*"(https?://[^"]*)" >/dev/null', s), +} +missing = [k for k, m in found.items() if not m] +if missing: + sys.exit(f"not found in {old}: {', '.join(missing)}") +fd = os.open(dest, os.O_WRONLY | os.O_CREAT | os.O_EXCL, 0o600) +with os.fdopen(fd, "w") as f: + f.write("# site settings for slackrepo_SBo-danix.conf and sb-publish (root-only)\n") + for k, m in found.items(): + f.write(f"{k}='{m.group(1)}'\n") +print(f"wrote {dest}: {', '.join(found)}") |
