mirror of https://github.com/coturn/coturn
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
69 lines
1.9 KiB
69 lines
1.9 KiB
#!/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_SQLITE=/var/lib/turn/turndb
|
|
TURNDB_SCHEMA=/usr/share/doc/coturn/schema.sql
|
|
|
|
if [ ! -e "$TURNDB_SQLITE" ] && [ -e "$TURNDB_SCHEMA" ]; then
|
|
echo "I: Creating $TURNDB_SQLITE from $TURNDB_SCHEMA" >&2
|
|
mkdir -p "$(dirname "$TURNDB_SQLITE")"
|
|
sqlite3 "$TURNDB_SQLITE" < "$TURNDB_SCHEMA"
|
|
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
|
|
|
|
|