lokinet/debian/lokinet-bin.postinst
Jason Rhinelander 1c34ed97fa Rename split packages to lokinet{,-bin,-router}
- lokinet is the package that configures a lokinet client
- lokinet-router configures a lokinet router
- lokinet-bin contains the binaries both of the above require
2019-10-29 16:16:55 -03:00

33 lines
959 B
Bash

#!/bin/sh -e
set -e
if [ "$1" = configure ]; then
# Create the loki_ group (shared with lokid)
if ! getent group _loki >/dev/null; then
addgroup --force-badname --system --quiet _loki
fi
# Create _lokinet user if it doesn't exist
if ! getent passwd _lokinet >/dev/null; then
adduser --force-badname --system --quiet --home /var/lib/lokinet --ingroup _loki --gecos "Lokinet system user" _lokinet
fi
# Make sure the _lokinet user is part of the _loki group (in case it already existed)
if ! id -Gn _lokinet | grep -qw _loki; then
adduser --force-badname --quiet _lokinet _loki
fi
if ! dpkg-statoverride --list /usr/bin/lokinet >/dev/null 2>&1; then
dpkg-statoverride --update --add root _loki 750 /usr/bin/lokinet
fi
if ! setcap cap_net_admin,cap_net_bind_service=+eip /usr/bin/lokinet; then
echo "failed to setcap lokinet" >&2
exit 1
fi
fi
#DEBHELPER#