pre_install() { getent group freeswitch > /dev/null 2>&1 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 -d /usr/share/freeswitch -r -g freeswitch freeswitch fi } post_install() { echo 'FreeSWITCH is installed!' echo '<<>> You MUST change the default_password in /etc/freeswitch/private/passwords.xml Failure to do so will leave your default extension 1000 vulnerable' echo 'The FreeSWITCH default configuration is available in /usr/share/doc/freeswitch/examples/conf.default, with Arch-specific modifications version in /usr/share/doc/freeswitch/examples/conf.archlinux (these may be the same).' 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 /usr/share/freeswitch echo "The running configuration directory is symlinked as /etc/freeswitch" } post_remove() { #rm -rf /etc/freeswitch # uncommend for /etc path fix #echo 'Not removing /usr/share/freeswitch/conf/ config directories!! If you do not want to keep them, rm -rf them away' # "" userdel -rf freeswitch getent group freeswitch &> /dev/null && groupdel freeswitch true }