2019-10-29 18:34:01 +00:00
|
|
|
#!/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
|
|
|
|
|
2020-01-14 21:16:12 +00:00
|
|
|
# Before 0.6.2-3 the deb's setcap'ed the binary and used restrictive permissions and ownership
|
|
|
|
# to protect invocation; from 0.6.2-3 onwards we do the capabilities via the systemd service
|
|
|
|
# file, so if we are upgrading from an older version remove the stat override. (Otherwise do
|
|
|
|
# nothing in case the local admin does a statoverride).
|
|
|
|
if dpkg --compare-versions "$2" lt '0.6.2-3~'; then
|
|
|
|
if dpkg-statoverride --list /usr/bin/lokinet >/dev/null 2>&1; then
|
|
|
|
dpkg-statoverride --remove /usr/bin/lokinet
|
|
|
|
chown root:root /usr/bin/lokinet
|
|
|
|
chmod 755 /usr/bin/lokinet
|
|
|
|
fi
|
2019-10-29 18:34:01 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
#DEBHELPER#
|