summarylogtreecommitdiffstats
path: root/freeswitch.install
diff options
context:
space:
mode:
authorbrent s2015-06-08 13:44:58 -0400
committerbrent s2015-06-08 13:44:58 -0400
commitafa675ea8da20244d55d41823062dbf2d7294fbe (patch)
tree29bdecd7ec9d60d58c1668db6bb053198b67e4ae /freeswitch.install
downloadaur-afa675ea8da20244d55d41823062dbf2d7294fbe.tar.gz
initial commit
Diffstat (limited to 'freeswitch.install')
-rw-r--r--freeswitch.install47
1 files changed, 47 insertions, 0 deletions
diff --git a/freeswitch.install b/freeswitch.install
new file mode 100644
index 000000000000..40f860e7462a
--- /dev/null
+++ b/freeswitch.install
@@ -0,0 +1,47 @@
+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 -d /usr/share/freeswitch -r -g freeswitch 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 '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'
+ 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
+ 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
+}