#!/usr/bin/env bash # Installs scan.sh, env template, and cleanup cron. Run as root from the repo root. # Does NOT edit /etc/scanbd/scanbd.conf: merge config/scanbd-actions.conf by hand. set -euo pipefail if [ "$(id -u)" -ne 0 ]; then echo "run as root: sudo ./install.sh" >&2 exit 1 fi HERE="$(cd "$(dirname "$0")" && pwd)" mkdir -p /etc/scanbd/scripts /etc/scan-station \ /var/lib/scan-station/failed /var/lib/scan-station/archive install -m 755 "$HERE/scripts/scan.sh" /etc/scanbd/scripts/scan.sh if [ ! -f /etc/scan-station/env ]; then install -m 640 -o root -g scanner "$HERE/config/env.example" /etc/scan-station/env echo "created /etc/scan-station/env: edit it and set PAPERLESS_TOKEN" else echo "keeping existing /etc/scan-station/env" fi install -m 644 "$HERE/config/scan-station-cleanup.cron" /etc/cron.d/scan-station-cleanup chown saned:scanner /var/lib/scan-station/failed /var/lib/scan-station/archive echo "done. next: merge config/scanbd-actions.conf into /etc/scanbd/scanbd.conf, then: systemctl restart scanbd"