Restore Homebrew and Debian package manager support

- Add Homebrew formula (brew_dist/archivebox.rb) using virtualenv pattern
  with auto-generation via homebrew-pypi-poet in bin/build_brew.sh
- Add Debian packaging via nFPM (pkg/debian/) with thin .deb that pip-installs
  archivebox into /opt/archivebox/venv on postinstall
- Add build/release scripts: bin/{build,release}_{brew,deb}.sh
- Update CI workflows to build packages on release and test them
- Update README apt/brew install instructions with working commands
- Update bin/setup.sh to use .deb download instead of old Launchpad PPA

https://claude.ai/code/session_01Vx1EsNrNySgsc8Y67dGzCn
This commit is contained in:
Claude committed 2026-03-15 00:19:50 +00:00
1 parent fdef1f991e
commit f3fcc1584c
17 files changed
+552 -122

No files matched your search

+13
View File
@@ -0,0 +1,13 @@
#!/bin/bash
# /usr/bin/archivebox - wrapper script installed by the archivebox .deb package
# Activates the pip-installed virtualenv and runs archivebox CLI
ARCHIVEBOX_VENV="/opt/archivebox/venv"
if [ ! -f "$ARCHIVEBOX_VENV/bin/archivebox" ]; then
echo "Error: ArchiveBox is not installed in $ARCHIVEBOX_VENV"
echo "Try running: sudo /opt/archivebox/install.sh"
exit 1
fi
exec "$ARCHIVEBOX_VENV/bin/archivebox" "$@"
+16
View File
@@ -0,0 +1,16 @@
[Unit]
Description=ArchiveBox Web Archiving Server
After=network.target
[Service]
Type=simple
User=archivebox
Group=archivebox
WorkingDirectory=/var/lib/archivebox
ExecStartPre=/opt/archivebox/venv/bin/archivebox init --setup
ExecStart=/opt/archivebox/venv/bin/archivebox server 0.0.0.0:8000
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target
+33
View File
@@ -0,0 +1,33 @@
#!/bin/bash
# /opt/archivebox/install.sh - installs/upgrades archivebox into its virtualenv
# Called by the postinstall script and can be run manually to upgrade
set -e
ARCHIVEBOX_VENV="/opt/archivebox/venv"
ARCHIVEBOX_VERSION="${ARCHIVEBOX_VERSION:-}"
echo "[+] Setting up ArchiveBox virtualenv in $ARCHIVEBOX_VENV..."
# Create the virtualenv if it doesn't exist
if [ ! -d "$ARCHIVEBOX_VENV" ]; then
python3 -m venv "$ARCHIVEBOX_VENV"
fi
# Upgrade pip inside the virtualenv
"$ARCHIVEBOX_VENV/bin/python3" -m pip install --quiet --upgrade pip setuptools
# Install or upgrade archivebox
if [ -n "$ARCHIVEBOX_VERSION" ]; then
echo "[+] Installing archivebox==$ARCHIVEBOX_VERSION..."
"$ARCHIVEBOX_VENV/bin/pip" install --quiet --upgrade "archivebox==$ARCHIVEBOX_VERSION"
else
echo "[+] Installing latest archivebox..."
"$ARCHIVEBOX_VENV/bin/pip" install --quiet --upgrade archivebox
fi
echo "[+] Installing archivebox runtime dependencies..."
"$ARCHIVEBOX_VENV/bin/archivebox" install --binproviders pip,npm 2>/dev/null || true
echo "[√] ArchiveBox installed successfully."
echo " Run 'archivebox version' to verify."
+67
View File
@@ -0,0 +1,67 @@
# nFPM configuration for building ArchiveBox .deb packages
# Docs: https://nfpm.goreleaser.com/configuration/
# Usage: nfpm package --config pkg/debian/nfpm.yaml --packager deb --target dist/
name: archivebox
arch: "${ARCH:-amd64}"
platform: linux
version: "${VERSION}"
version_schema: semver
maintainer: "Nick Sweeting <nfpm@archivebox.io>"
description: |
Self-hosted internet archiving solution.
Save pages from the web including HTML, PDF, screenshots, media, and more.
Install with: sudo apt install archivebox && archivebox init --setup
vendor: "ArchiveBox"
homepage: "https://archivebox.io"
license: "MIT"
section: "web"
priority: "optional"
depends:
- python3 (>= 3.11)
- python3-pip
- python3-venv
- nodejs
- npm
- git
- wget
- curl
- ripgrep
recommends:
- yt-dlp
- ffmpeg
- chromium | chromium-browser | google-chrome-stable
contents:
# Wrapper script for /usr/bin/archivebox
- src: pkg/debian/archivebox
dst: /usr/bin/archivebox
file_info:
mode: 0755
# Install helper script
- src: pkg/debian/install.sh
dst: /opt/archivebox/install.sh
file_info:
mode: 0755
# Systemd service file
- src: pkg/debian/archivebox.service
dst: /usr/lib/systemd/system/archivebox.service
file_info:
mode: 0644
# Create data directory
- dst: /var/lib/archivebox
type: dir
file_info:
mode: 0755
scripts:
postinstall: pkg/debian/scripts/postinstall.sh
preremove: pkg/debian/scripts/preremove.sh
deb:
compression: zstd
+5
View File
@@ -0,0 +1,5 @@
#!/bin/bash
# postinstall script for archivebox .deb package
set -e
/opt/archivebox/install.sh
+9
View File
@@ -0,0 +1,9 @@
#!/bin/bash
# preremove script for archivebox .deb package
set -e
echo "[+] Removing ArchiveBox virtualenv..."
rm -rf /opt/archivebox/venv
echo "[i] Your ArchiveBox data directories have NOT been removed."
echo " Remove them manually if you no longer need them."