forked from Mirrors/freeswitch
3b4b839ed4
When the "freeswitch" package was installed directly on Debian, i.e. without one of the meta packages pulling in the vanilla configuration (freeswitch-conf-vanilla), the "postinst" script failed: $ apt-get install freeswitch … Setting up freeswitch (1.6.6~13~d2d0b32-1~jessie+1) ... cp: cannot stat ‘/usr/share/freeswitch/conf/vanilla/*’: No such file or directory … With this change the code tests for "freeswitch.xml" before attempting to copy the configuration files.
53 lines
1.2 KiB
Bash
53 lines
1.2 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/
|
|
if [ -e /usr/share/freeswitch/conf/vanilla/freeswitch.xml ]; then
|
|
cp -a /usr/share/freeswitch/conf/vanilla/* /etc/freeswitch/
|
|
fi
|
|
fi
|
|
if [ ! -d "/etc/freeswitch/tls" ]; then
|
|
mkdir -p /etc/freeswitch/tls/
|
|
chown freeswitch:freeswitch /etc/freeswitch/tls
|
|
fi
|
|
;;
|
|
abort-upgrade|abort-remove|abort-deconfigure)
|
|
;;
|
|
*)
|
|
echo "postinst called with unknown argument \`$1'" >&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
#DEBHELPER#
|
|
exit 0
|