BlueGit

timfa bluegit

Files

bluegit / packaging / nfpm / bluegit-backup.postinstall.sh

bluegit-backup.postinstall.sh

bluegit-backup.postinstall.sh 1.1 KiB Download Raw
1#!/bin/sh
2# Na installeren of bijwerken (deb, rpm en archlinux). Maakt de gebruiker
3# bluegit-backup en /var/lib/bluegit-backup, zoals sysusers.d en tmpfiles.d. Zonder
4# systemd-sysusers (een kale container) doen useradd en install het.
5# De service wordt niet aangezet; een draaiende service herstart.
6set -e
7if command -v systemd-sysusers >/dev/null 2>&1; then
8 systemd-sysusers /usr/lib/sysusers.d/bluegit-backup.conf || true
9fi
10if ! getent group bluegit-backup >/dev/null 2>&1; then
11 groupadd --system bluegit-backup
12fi
13if ! getent passwd bluegit-backup >/dev/null 2>&1; then
14 useradd --system --gid bluegit-backup --home-dir /var/lib/bluegit-backup --no-create-home \
15 --shell /usr/sbin/nologin --comment "BlueGit backup server" bluegit-backup
16fi
17if command -v systemd-tmpfiles >/dev/null 2>&1; then
18 systemd-tmpfiles --create /usr/lib/tmpfiles.d/bluegit-backup.conf || true
19fi
20install -d -m 0750 -o bluegit-backup -g bluegit-backup /var/lib/bluegit-backup
21if [ -d /run/systemd/system ] && command -v systemctl >/dev/null 2>&1; then
22 systemctl daemon-reload || true
23 systemctl try-restart bluegit-backup.service || true
24fi
25exit 0