PKGBUILDs/aur/freeswitch-git/freeswitch.install
2012-04-22 18:19:39 -04:00

52 lines
2 KiB
Text

pre_install() {
getent group freeswitch > /dev/null
if [ $? -ne 0 ];then
echo 'Adding group freeswitch'
groupadd -r freeswitch
fi
id freeswitch > /dev/null
if [ $? -ne 0 ];then
echo 'Adding user freeswitch'
useradd -r freeswitch -g freeswitch
fi
}
post_install() {
echo "FreeSWITCH is installed!"
echo "<<<WARNING>>> You MUST change the default_password in /etc/freeswitch/vars.xml
Failure to do so will leave your default extension 1000 vulnerable"
echo "FreeSWITCH's default configuration is available in
/usr/share/doc/freeswitch/examples/conf.default, with this package's modified
version in /usr/share/doc/freeswitch/examples/conf.archlinux"
post_upgrade
}
post_upgrade() {
if [ -d /etc/freeswitch -a ! -L /etc/freeswitch ];then
echo "Moving your old configs (/etc/freeswitch) to /usr/share/freeswitch/conf/local"
mv /etc/freeswitch /usr/share/freeswitch/conf/local
ln -s /usr/share/freeswitch/conf/local /etc/freeswitch
fi
[ -d /usr/share/freeswitch/conf/pbx ] || cp -a /usr/share/doc/freeswitch/examples/conf.archlinux/ /usr/share/freeswitch/conf/pbx
chown -R freeswitch:freeswitch /usr/share/freeswitch/conf/pbx
if [ ! -L /etc/freeswitch ];then
echo "Linking /usr/share/freeswitch/conf/pbx to /etc/freeswitch"
ln -s /usr/share/freeswitch/conf/pbx /etc/freeswitch
fi
chown -R freeswitch:freeswitch /var/{run,spool,log}/freeswitch
chown -R freeswitch:freeswitch /etc/sv/freeswitch
echo "The running configuration directory is symlinked as /etc/freeswitch"
echo
echo "FreeSWITCH can be started with rc.d freeswitch start or /etc/sv/freeswitch/run"
echo "To start on boot add freeswitch to /etc/rc.conf or supervise the /etc/sv/freeswitch directory"
}
post_remove() {
rm /etc/freeswitch
echo "Not removing /usr/share/freeswitch/conf/ config directories!! If you do not want to keep them, rm -rf them away"
userdel freeswitch
getent group freeswitch &> /dev/null && groupdel freeswitch
true
}
# vim:set ts=2 sw=2 et: