debian: add postinst script

Fixes #54
This commit is contained in:
Reynir Björnsson 2021-11-12 11:18:40 +01:00
parent 16748b8995
commit 3fa6e9c174
2 changed files with 18 additions and 0 deletions

View file

@ -31,6 +31,7 @@ install -m 0644 $basedir/packaging/debian/builder-web.service $systemddir/builde
install -m 0644 $basedir/packaging/debian/control $debiandir/control install -m 0644 $basedir/packaging/debian/control $debiandir/control
install -m 0644 $basedir/packaging/debian/changelog $debiandir/changelog install -m 0644 $basedir/packaging/debian/changelog $debiandir/changelog
install -m 0644 $basedir/packaging/debian/copyright $debiandir/copyright install -m 0644 $basedir/packaging/debian/copyright $debiandir/copyright
install $basedir/packaging/debian/postinst $debiandir/postinst
dpkg-deb --build $rootdir $basedir/builder-web.deb dpkg-deb --build $rootdir $basedir/builder-web.deb
echo 'bin: [ "builder-web.deb" ]' > $basedir/builder-web.install echo 'bin: [ "builder-web.deb" ]' > $basedir/builder-web.install

17
packaging/debian/postinst Normal file
View file

@ -0,0 +1,17 @@
#!/bin/sh
set -e
BUILDER_WEB_USER=builder
if ! getent passwd "$BUILDER_WEB_USER" >/dev/null; then
groupadd -g 497 $BUILDER_WEB_USER
fi
if ! getent group "$BUILDER_WEB_USER" >/dev/null; then
useradd -g 497 -u 497 -d /nonexistent -s /usr/sbin/nologin $BUILDER_WEB_USER
fi
mkdir -p /var/lib/builder-web
chown "$BUILDER_WEB_USER:$BUILDER_WEB_USER" /var/lib/builder-web
if [ -d /run/systemd/system ]; then
systemctl --system daemon-reload >/dev/null || true
fi