#!/bin/bash # Removes what install.sh set up: the systemd service and the venv it # created. The project folder itself (whatever you SFTP'd over) and any # config.json with your settings are left alone -- delete manually if you # want those gone too. # # Does NOT touch SPI/I2C config.txt settings or re-install/re-enable # anything else -- Paperwall doesn't depend on or manage other software. # # Usage: sudo bash uninstall.sh set -euo pipefail if [ "$EUID" -ne 0 ]; then echo "Run as root (sudo bash uninstall.sh)" >&2 exit 1 fi SOURCE="${BASH_SOURCE[0]}" while [ -h "$SOURCE" ]; do DIR=$(cd -P "$(dirname "$SOURCE")" >/dev/null 2>&1 && pwd) SOURCE=$(readlink "$SOURCE") [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" done APP_DIR=$(cd -P "$(dirname "$SOURCE")" >/dev/null 2>&1 && pwd) SERVICE_NAME="paperwall.service" echo "==> Stopping and disabling $SERVICE_NAME" systemctl disable --now "$SERVICE_NAME" 2>/dev/null || echo " (not running/installed, skipping)" echo "==> Removing systemd unit" rm -f "/etc/systemd/system/$SERVICE_NAME" systemctl daemon-reload echo "==> Removing virtual environment ($APP_DIR/venv)" rm -rf "$APP_DIR/venv" echo echo "==> Paperwall service and venv removed." echo " Project files at $APP_DIR are untouched -- delete the folder yourself if you want it fully gone." echo " If InkyPi was stopped by install.sh and you want it back:" echo " sudo systemctl enable --now inkypi.service"