2023-07-18 01:26:17 +01:00
|
|
|
#!/bin/sh
|
|
|
|
|
2024-02-12 23:41:07 +00:00
|
|
|
set -e
|
|
|
|
|
2023-07-18 01:26:17 +01:00
|
|
|
if [ "$1" = configure ]; then
|
2023-08-28 21:41:31 +01:00
|
|
|
|
|
|
|
# if ! getent group linbpq >/dev/null; then
|
|
|
|
# addgroup --system --force-badname linbpq || true
|
|
|
|
# fi
|
|
|
|
|
|
|
|
echo "Creating/updating linbpq user account..."
|
|
|
|
adduser --system --group --home /opt/oarc/bpq \
|
|
|
|
--gecos "linbpq system user" --shell /bin/false \
|
|
|
|
--quiet --disabled-password linbpq || {
|
|
|
|
# adduser failed. Why?
|
|
|
|
if getent passwd linbpq >/dev/null ; then
|
|
|
|
echo "Non-system user linbpq found. I will not overwrite a non-system" >&2
|
|
|
|
echo "user. Remove the user and reinstall linbpq." >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
# unknown adduser error, simply exit
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
adduser linbpq dialout
|
2024-08-30 12:06:42 +01:00
|
|
|
adduser linbpq plugdev
|
2023-08-28 21:41:31 +01:00
|
|
|
chown :linbpq /opt/oarc/bpq
|
|
|
|
chmod 775 /opt/oarc/bpq
|
2024-04-08 22:21:31 +01:00
|
|
|
|
2023-07-18 01:26:17 +01:00
|
|
|
# If we have setcap is installed, set the requirements
|
|
|
|
# which allows us to install our binaries without the setuid
|
|
|
|
# bit.
|
|
|
|
if command -v setcap > /dev/null; then
|
2023-12-16 14:40:33 +00:00
|
|
|
setcap "CAP_NET_ADMIN=ep CAP_NET_RAW=ep CAP_NET_BIND_SERVICE=ep" /usr/sbin/linbpq
|
2023-07-18 01:26:17 +01:00
|
|
|
else
|
|
|
|
echo "Setcap failed on /usr/sbin/linbpq, Features may be limited" >&2
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo "Setcap is not installed, Features may be limited" >&2
|
2023-08-28 21:41:31 +01:00
|
|
|
|
|
|
|
|
2023-07-18 01:26:17 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
#DEBHELPER#
|