summarylogtreecommitdiffstats
path: root/freeswitch.install
blob: c30c2e46df70baf899bd48b28815a4f2b1124ba1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
pre_install() {
  getent group freeswitch > /dev/null
  if [ $? -ne 0 ];then
    echo 'Adding group freeswitch'
    groupadd  -r freeswitch
  fi
  id freeswitch > /dev/null 2>&1
  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/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
  #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
}