forked from Mirrors/freeswitch
b2bcc8b2dd
freeswitch-systemd.freeswitch.service: * starting the daemon as root and switchig to freeswitch user * respecting the options in /etc/default/freeswitch * RuntimeDirectory parameter is replaced with a tmpfiles.d entry because /run/freeswitch has to be owned by freeswitch user * instructions how to start it as non-root debian/freeswitch-systemd.freeswitch.tmpfile: * this defines the PID directory with correct permissions debian/bootstrap.sh, debian/rules: * proper handling of freeswitch.service * deleted debian/freeswitch-systemd.install because it caused an error in dh_install because it's run before dh_installinit * renamed: freeswitch-sysvinit.freeswitch.default -> freeswitch-systemd.freeswitch.default because sysvinit support will eventually die out debian/freeswitch.postinst: * run "systemctl enable freeswitch" if systemctl is available CAVEAT: only one option is supported in /etc/default/freeswitch because the variable ${DAEMON_OPTS} is expanded as a single token. This will be fixed as soon as freeswitch-sysvinit is removed from freeswitch-all.
54 lines
1.3 KiB
Bash
54 lines
1.3 KiB
Bash
#!/bin/sh
|
|
set -e
|
|
|
|
case "$1" in
|
|
configure)
|
|
if ! getent group freeswitch >/dev/null; then
|
|
groupadd --system freeswitch
|
|
fi
|
|
if ! getent passwd freeswitch >/dev/null; then
|
|
useradd --system -g freeswitch -Gaudio \
|
|
-d /var/lib/freeswitch \
|
|
-s /bin/false \
|
|
-e '' \
|
|
-c 'FreeSWITCH' \
|
|
freeswitch
|
|
fi
|
|
for x in \
|
|
/var/lib/freeswitch \
|
|
/var/lib/freeswitch/db \
|
|
/var/lib/freeswitch/recordings \
|
|
/var/lib/freeswitch/storage \
|
|
/var/log/freeswitch \
|
|
/var/run/freeswitch;
|
|
do
|
|
if ! test -d $x; then
|
|
mkdir -p $x
|
|
chown freeswitch:freeswitch $x
|
|
chmod o-rwx,g+u $x
|
|
fi
|
|
chown freeswitch $x
|
|
done
|
|
if [ ! -d "/etc/freeswitch" ]; then
|
|
mkdir -p /etc/freeswitch/
|
|
cp -a /usr/share/freeswitch/conf/vanilla/* /etc/freeswitch/
|
|
fi
|
|
if [ ! -d "/etc/freeswitch/tls" ]; then
|
|
mkdir -p /etc/freeswitch/tls/
|
|
chown freeswitch:freeswitch /etc/freeswitch/tls
|
|
fi
|
|
if [ -x /bin/systemctl -a x`systemctl is-enabled freeswitch` != "xenabled" ]; then
|
|
systemctl enable freeswitch
|
|
fi
|
|
;;
|
|
abort-upgrade|abort-remove|abort-deconfigure)
|
|
;;
|
|
*)
|
|
echo "postinst called with unknown argument \`$1'" >&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
#DEBHELPER#
|
|
exit 0
|