#!/bin/sh
set -e
case "$1" in
configure)
# A system user with no login shell: the service account, not a
# person. Idempotent — an upgrade must not disturb an existing one.
if ! getent passwd gitgud >/dev/null; then
adduser --system --group --home /var/lib/gitgud \
--no-create-home --shell /usr/sbin/nologin \
--gecos "GitGud forge" gitgud
fi
for dir in /var/lib/gitgud /var/lib/gitgud/repos /var/lib/gitgud/storage /var/lib/gitgud/tmp; do
mkdir -p "$dir"
chown gitgud:gitgud "$dir"
chmod 0750 "$dir"
done
# The env file carries the database password and the secret key
# base; the service user reads it, nobody else does.
if [ -f /etc/gitgud/gitgud.env ]; then
chown root:gitgud /etc/gitgud/gitgud.env
chmod 0640 /etc/gitgud/gitgud.env
fi
;;
esac
# Enabled but not started: the shipped config has CHANGEME in it, and
# starting against that would only produce a crash loop in the journal.
# `systemctl start gitgud` is the last line of the install instructions.
if [ -d /run/systemd/system ]; then
systemctl daemon-reload >/dev/null 2>&1 || true
if [ "$1" = "configure" ] && [ -z "$2" ]; then
systemctl enable gitgud.service >/dev/null 2>&1 || true
fi
# An upgrade restarts what was already running, and leaves a stopped
# service stopped.
if [ -n "$2" ] && systemctl is-active --quiet gitgud.service; then
systemctl restart gitgud.service >/dev/null 2>&1 || true
fi
fi
exit 0
neiam
/gitgud
Git Gud
public · Issues · Pulls · Labels · Forks · Compare · Actions success · Badges · Packages
⭐
1
Log in to mark this repository.
1.5 KiB · text
History
b868907