- debian/control, changelog, conffiles — package metadata - debian/postinst — creates irc-bot system user, installs Python venv, symlinks runtime dirs, enables systemd services - debian/prerm/postrm — clean stop/uninstall with purge support - debian/systemd/ — hardened systemd units for bot and portal - build_deb.sh — assembles and builds the .deb via dpkg-deb - Path resolver in irc_client.py, memory.py, config_manager.py, portal/app.py: uses /etc/irc-bot + /var/lib/irc-bot when installed as .deb, relative paths otherwise (Docker/venv unchanged) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
26 lines
621 B
Bash
26 lines
621 B
Bash
#!/bin/bash
|
|
set -e
|
|
|
|
case "$1" in
|
|
purge)
|
|
# Remove data, logs, config only on purge (not plain remove)
|
|
rm -rf /var/lib/irc-bot /var/log/irc-bot /etc/irc-bot
|
|
# Remove system user
|
|
if getent passwd irc-bot > /dev/null 2>&1; then
|
|
deluser --system irc-bot 2>/dev/null || true
|
|
fi
|
|
if getent group irc-bot > /dev/null 2>&1; then
|
|
delgroup --system irc-bot 2>/dev/null || true
|
|
fi
|
|
if [ -d /run/systemd/system ]; then
|
|
systemctl daemon-reload
|
|
fi
|
|
;;
|
|
remove)
|
|
# Remove the venv on plain remove (can be rebuilt on reinstall)
|
|
rm -rf /opt/irc-bot/venv
|
|
;;
|
|
esac
|
|
|
|
exit 0
|