coturn/debian/coturn.postinst
Mészáros Mihály 6e53eb3bba Import Debian changes 4.5.2-3
coturn (4.5.2-3) unstable; urgency=medium
.
  [ Ferenc Wágner ]
  * [50ab417] Don't rely on the documentation being present for creating the DB.
    Dpkg may be configured to omit installing files under /usr/share/doc.
    Since the database schema is shipped in a private directory as well,
    switch to using that instance instead. (Closes: #985054)
  * [6f94ecb] Let the purge go through under unforeseen circumstances
  * [d8f0a0a] Let debhelper do its business before the final cleanup
  * [4033c69] Make the SQLite database writable by the turnserver user and
    group.
    File permissions alone aren't enough, the containing directory needs to
    be writable as well.
  * [81731d8] Ship the empty /var/lib/turndb directory for better
    discoverability
  * [34a2b34] Split up our autopkgtest into several tests
.
  [ Mészáros Mihály ]
  * [1666988] Add forwarded not-needed to
    Fix-undefinded-OPENSSL_VERSION_1_1_1.patch
2024-04-13 13:23:53 +00:00

78 lines
2.4 KiB
Bash

#!/bin/sh
set -e
# summary of how this script can be called:
# * <postinst> `configure' <most-recently-configured-version>
# * <old-postinst> `abort-upgrade' <new version>
# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
# <new-version>
# * <postinst> `abort-remove'
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
# <failed-install-package> <version> `removing'
# <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
# $1 = version of the package being upgraded.
install() {
TURNSERVER_GROUP=turnserver
if ! getent group "$TURNSERVER_GROUP" >/dev/null; then
addgroup --system "$TURNSERVER_GROUP" || exit 1
fi
TURNSERVER_USER=turnserver
if ! getent passwd "$TURNSERVER_USER" >/dev/null; then
adduser --system \
--home / \
--shell /bin/false \
--no-create-home \
--ingroup "$TURNSERVER_GROUP" \
--disabled-password \
--disabled-login \
--gecos "turnserver daemon" \
"$TURNSERVER_USER" || exit 1
fi
# Don't ship the empty database; generate it on-demand. (#929269)
TURNDB_DIR=/var/lib/turn
TURNDB_SQLITE=$TURNDB_DIR/turndb
TURNDB_SCHEMA=/usr/share/coturn/schema.sql
if [ ! -e "$TURNDB_SQLITE" ] && [ -e "$TURNDB_SCHEMA" ]; then
echo "I: Creating $TURNDB_SQLITE from $TURNDB_SCHEMA" >&2
( umask 007 && sqlite3 "$TURNDB_SQLITE" < "$TURNDB_SCHEMA" )
chown "$TURNSERVER_USER":"$TURNSERVER_GROUP" "$TURNDB_SQLITE"
fi
if ! dpkg-statoverride --list "$TURNDB_DIR" >/dev/null 2>&1; then
dpkg-statoverride --update --add "$TURNSERVER_USER" "$TURNSERVER_GROUP" 775 "$TURNDB_DIR"
fi
TURNSERVER_CONFIG=/etc/turnserver.conf
if ! dpkg-statoverride --list "$TURNSERVER_CONFIG" >/dev/null 2>&1; then
dpkg-statoverride --update --add root "$TURNSERVER_GROUP" 640 "$TURNSERVER_CONFIG"
fi
}
case "$1" in
configure)
install "$2"
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0