blob: f47ea011567d7f1d8363a67824760d28344fe369 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
#!/bin/bash
set -e
case "$1" in
configure)
# Create system user/group
if ! getent passwd witryna >/dev/null; then
adduser --system --group --no-create-home --home /var/lib/witryna witryna
fi
# Create data + log directories
install -d -o witryna -g witryna -m 0755 /var/lib/witryna
install -d -o witryna -g witryna -m 0755 /var/lib/witryna/clones
install -d -o witryna -g witryna -m 0755 /var/lib/witryna/builds
install -d -o witryna -g witryna -m 0755 /var/lib/witryna/cache
install -d -o witryna -g witryna -m 0755 /var/log/witryna
# Config file is installed by dpkg from the asset.
# Fix ownership so the witryna service can read it (Group=witryna in unit).
chown root:witryna /etc/witryna/witryna.toml
chmod 640 /etc/witryna/witryna.toml
# Auto-detect and configure container runtime
if command -v docker >/dev/null 2>&1 && docker info >/dev/null 2>&1; then
# Docker: add to docker group + install override
if getent group docker >/dev/null; then
usermod -aG docker witryna || true
fi
mkdir -p /etc/systemd/system/witryna.service.d
cp /usr/share/doc/witryna/examples/systemd/docker.conf \
/etc/systemd/system/witryna.service.d/10-runtime.conf
chmod 644 /etc/systemd/system/witryna.service.d/10-runtime.conf
systemctl daemon-reload >/dev/null 2>&1 || true
echo "witryna: Docker detected and configured."
elif command -v podman >/dev/null 2>&1 && podman info >/dev/null 2>&1; then
# Podman: subuids + lingering + override
if ! grep -q "^witryna:" /etc/subuid 2>/dev/null; then
usermod --add-subuids 100000-165535 witryna || true
fi
if ! grep -q "^witryna:" /etc/subgid 2>/dev/null; then
usermod --add-subgids 100000-165535 witryna || true
fi
loginctl enable-linger witryna >/dev/null 2>&1 || true
mkdir -p /etc/systemd/system/witryna.service.d
cp /usr/share/doc/witryna/examples/systemd/podman.conf \
/etc/systemd/system/witryna.service.d/10-runtime.conf
chmod 644 /etc/systemd/system/witryna.service.d/10-runtime.conf
systemctl daemon-reload >/dev/null 2>&1 || true
echo "witryna: Podman detected and configured."
else
echo "witryna: WARNING — no container runtime (docker/podman) detected."
echo " Install one, then reinstall this package or copy an override from"
echo " /usr/share/doc/witryna/examples/systemd/ manually."
fi
;;
esac
#DEBHELPER#
exit 0
|