package-pipelines-miscellan.../woodpecker-agent/debian.postinst

22 lines
589 B
Text
Raw Normal View History

2023-12-05 23:40:22 +01:00
#!/bin/bash
set -e
if [[ "$1" == "configure" ]]; then
if ! getent group woodpecker >/dev/null; then
groupadd --system woodpecker
fi
if ! getent passwd woodpecker >/dev/null; then
useradd --system --gid woodpecker --groups docker --home-dir /var/lib/woodpecker --shell /bin/sh woodpecker
fi
chown woodpecker:woodpecker /var/lib/woodpecker /etc/woodpecker /etc/woodpecker/agent.conf
chmod 0750 /var/lib/woodpecker /etc/woodpecker
deb-systemd-helper enable woodpecker-agent.service
deb-systemd-invoke restart woodpecker-agent.service
fi