fix(packaging): address code review findings
- Upgrade path restarts only fenris-collect.timer, not fenris-collect.service (spec §7: "a running oneshot finishes on its old interpreter") - Remove redundant deb depends override in nfpm.yaml (top-level is sufficient) - Remove common.sh sourcing — scripts are self-contained to avoid path dependency when dpkg/rpm run them from /var/lib/dpkg/info/ Co-authored-by: CommandCodeBot <noreply@commandcode.ai>
This commit is contained in:
co-authored by
CommandCodeBot
parent
babc8eeeb1
commit
8fa86c3bf8
+3
-11
@@ -1,8 +1,5 @@
|
||||
#!/bin/sh
|
||||
# RPM %post — post-install/upgrade scriptlet (spec §7).
|
||||
#
|
||||
# Fresh install: sysusers, tmpfiles, daemon-reload — nothing else (dormant).
|
||||
# Upgrade: snapshot, migration, daemon-reload, conditional timer restart.
|
||||
set -eu
|
||||
|
||||
STORE_DIR="/var/lib/fenris"
|
||||
@@ -16,11 +13,10 @@ if [ "$1" -eq 1 ]; then
|
||||
systemd-tmpfiles --create || true
|
||||
systemctl daemon-reload || true
|
||||
elif [ "$1" -ge 2 ]; then
|
||||
# Upgrade
|
||||
# Upgrade — snapshot, migration, daemon-reload, conditional timer restart
|
||||
if [ -f "${STORE_DB}" ]; then
|
||||
cp "${STORE_DB}" "${STORE_BAK}" 2>/dev/null || true
|
||||
fi
|
||||
|
||||
if [ -x "${VENV_PYTHON}" ] && [ -f "${STORE_DB}" ]; then
|
||||
"${VENV_PYTHON}" -c "
|
||||
from fenris.store import migrate_to_latest
|
||||
@@ -29,12 +25,8 @@ n = migrate_to_latest(Path('${STORE_DB}'))
|
||||
print(f'Fenris migration: {n} step(s) applied') if n else None
|
||||
" 2>&1 || echo "Fenris: migration skipped (store not yet initialized)"
|
||||
fi
|
||||
|
||||
systemd-sysusers || true
|
||||
systemd-tmpfiles --create || true
|
||||
systemctl daemon-reload || true
|
||||
|
||||
for unit in fenris-collect.timer fenris-collect.service; do
|
||||
systemctl daemon-reload 2>/dev/null || true
|
||||
for unit in fenris-collect.timer; do
|
||||
if systemctl is-active --quiet "${unit}" 2>/dev/null; then
|
||||
TMPFILE="$(mktemp)"
|
||||
systemctl cat "${unit}" > "${TMPFILE}" 2>/dev/null || true
|
||||
|
||||
Reference in New Issue
Block a user