23 lines
821 B
Bash
23 lines
821 B
Bash
#!/usr/bin/env sh
|
|
set -eu
|
|
|
|
if [ "$(id -u)" -ne 0 ]; then
|
|
echo "Run as root: sudo sh deploy/systemd-install.sh" >&2
|
|
exit 1
|
|
fi
|
|
|
|
install -d -m 0755 /etc/importarr /var/lib/importarr
|
|
if ! id importarr >/dev/null 2>&1; then
|
|
useradd --system --home /var/lib/importarr --shell /usr/sbin/nologin importarr
|
|
fi
|
|
chown importarr:importarr /var/lib/importarr
|
|
if [ ! -f /etc/importarr/importarr.env ]; then
|
|
install -m 0600 deploy/importarr.env.example /etc/importarr/importarr.env
|
|
echo "Created /etc/importarr/importarr.env; edit it before starting the service."
|
|
fi
|
|
install -m 0644 deploy/importarr.service /etc/systemd/system/importarr.service
|
|
python3 -m pip install --upgrade .
|
|
systemctl daemon-reload
|
|
systemctl enable importarr.service
|
|
echo "Edit /etc/importarr/importarr.env, then run: systemctl start importarr.service"
|