mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2026-04-06 07:47:53 +10:00
Fix remaining PR review comments across packaging files
- preremove.sh: Stop the systemd service during upgrades (not just remove/purge) so the running process doesn't use stale venv binaries while postinstall replaces them. Only disable + remove venv on full removal. - debian.yml: Fail loudly when release lookup fails during a release event (exit 1), but still skip gracefully for workflow_dispatch manual testing (exit 0). Prevents silently broken .deb publication. - archivebox.rb + build_brew.sh + homebrew.yml: Add post_install that initializes ArchiveBox in var/archivebox with DATA_DIR set, using correct Homebrew system() syntax (no env hash as first arg). https://claude.ai/code/session_01Vx1EsNrNySgsc8Y67dGzCn
This commit is contained in:
14
.github/workflows/debian.yml
vendored
14
.github/workflows/debian.yml
vendored
@@ -195,10 +195,16 @@ jobs:
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
# Verify the release exists before uploading (workflow_dispatch may not have one)
|
||||
if ! gh release view "${{ steps.tag.outputs.tag }}" >/dev/null 2>&1; then
|
||||
echo "[!] No GitHub Release found for tag ${{ steps.tag.outputs.tag }}, skipping upload."
|
||||
TAG="${{ steps.tag.outputs.tag }}"
|
||||
# Verify the release exists before uploading
|
||||
if ! gh release view "$TAG" >/dev/null 2>&1; then
|
||||
echo "[!] No GitHub Release found for tag $TAG."
|
||||
if [ -n "${{ github.event.release.tag_name }}" ]; then
|
||||
echo "[X] This was triggered by a release event — the release should exist. Failing."
|
||||
exit 1
|
||||
fi
|
||||
echo "[i] Skipping upload (workflow_dispatch without a release)."
|
||||
echo " Create a release first or trigger via the release event."
|
||||
exit 0
|
||||
fi
|
||||
gh release upload "${{ steps.tag.outputs.tag }}" *.deb --clobber
|
||||
gh release upload "$TAG" *.deb --clobber
|
||||
|
||||
7
.github/workflows/homebrew.yml
vendored
7
.github/workflows/homebrew.yml
vendored
@@ -94,6 +94,13 @@ ${RESOURCES}
|
||||
virtualenv_install_with_resources
|
||||
end
|
||||
|
||||
def post_install
|
||||
data_dir = var/"archivebox"
|
||||
data_dir.mkpath
|
||||
ENV["DATA_DIR"] = data_dir.to_s
|
||||
system bin/"archivebox", "init"
|
||||
end
|
||||
|
||||
test do
|
||||
assert_match version.to_s, shell_output("#{bin}/archivebox version")
|
||||
end
|
||||
|
||||
@@ -80,6 +80,14 @@ ${RESOURCES}
|
||||
virtualenv_install_with_resources
|
||||
end
|
||||
|
||||
def post_install
|
||||
# Initialize ArchiveBox data in the Homebrew-managed var directory
|
||||
data_dir = var/"archivebox"
|
||||
data_dir.mkpath
|
||||
ENV["DATA_DIR"] = data_dir.to_s
|
||||
system bin/"archivebox", "init"
|
||||
end
|
||||
|
||||
test do
|
||||
assert_match version.to_s, shell_output("#{bin}/archivebox version")
|
||||
end
|
||||
|
||||
@@ -23,6 +23,14 @@ class Archivebox < Formula
|
||||
virtualenv_install_with_resources
|
||||
end
|
||||
|
||||
def post_install
|
||||
# Initialize ArchiveBox data in the Homebrew-managed var directory
|
||||
data_dir = var/"archivebox"
|
||||
data_dir.mkpath
|
||||
ENV["DATA_DIR"] = data_dir.to_s
|
||||
system bin/"archivebox", "init"
|
||||
end
|
||||
|
||||
test do
|
||||
assert_match version.to_s, shell_output("#{bin}/archivebox version")
|
||||
end
|
||||
|
||||
@@ -2,13 +2,17 @@
|
||||
# preremove script for archivebox .deb package
|
||||
set -e
|
||||
|
||||
# Only clean up on full removal, not during upgrade.
|
||||
# dpkg passes "$1" as "remove", "purge", or "upgrade" — we skip cleanup on
|
||||
# upgrade so the venv and service persist across package version bumps.
|
||||
# dpkg passes "$1" as "remove", "purge", or "upgrade".
|
||||
|
||||
# Always stop the service before removing or upgrading, because postinstall
|
||||
# replaces the venv in-place — the running process would use stale binaries.
|
||||
if command -v systemctl >/dev/null 2>&1 && [ -d /run/systemd/system ]; then
|
||||
systemctl stop archivebox 2>/dev/null || true
|
||||
fi
|
||||
|
||||
# Only disable + clean up on full removal, not during upgrade.
|
||||
if [ "$1" = "remove" ] || [ "$1" = "purge" ]; then
|
||||
# Stop the service if running
|
||||
if command -v systemctl >/dev/null 2>&1 && [ -d /run/systemd/system ]; then
|
||||
systemctl stop archivebox 2>/dev/null || true
|
||||
systemctl disable archivebox 2>/dev/null || true
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user