Initial permission changes
added use of getopt to allow command line options to indicate to use different sources added +x
This commit is contained in:
parent
75fb2385eb
commit
bef7c9b4b2
|
|
@ -1,29 +1,78 @@
|
|||
#!/bin/sh
|
||||
|
||||
#Process command line options
|
||||
OPTS=`getopt -n 'install.sh' -o h -l help,use-freeswitch-source,use-freeswitch-package-all,use-freeswitch-master -- "$@"`
|
||||
eval set -- "$OPTS"
|
||||
|
||||
if [ $? != 0 ] ; then echo "Failed parsing options." >&2 ; exit 1 ; fi
|
||||
|
||||
USE_FREESWITCH_SOURCE=false
|
||||
USE_FREESWITCH_PACKAGE_ALL=false
|
||||
USE_FREESWITCH_MASTER=false
|
||||
HELP=false
|
||||
|
||||
while true; do
|
||||
case "$1" in
|
||||
--use-freeswitch-source ) USE_FREESWITCH_SOURCE=true; shift ;;
|
||||
--use-freeswitch-package-all ) USE_FREESWITCH_PACKAGE_ALL=true; shift ;;
|
||||
--use-freeswitch-master ) USE_FREESWITCH_MASTER=true; shift ;;
|
||||
-h | --help ) HELP=true; shift ;;
|
||||
-- ) shift; break ;;
|
||||
* ) break ;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ $HELP = true ]; then
|
||||
echo "Debian installer script"
|
||||
echo " --use-freeswitch-source will use freeswitch from source rather than (default:packages)"
|
||||
echo " --use-freeswitch-package-all if using packages use the meta-all package"
|
||||
echo " --use-freeswitch-master will use master branch/packages instead of (default:stable)"
|
||||
exit;
|
||||
fi
|
||||
|
||||
#Update Debian
|
||||
echo "Update Debian"
|
||||
apt-get upgrade && apt-get update -y --force-yes
|
||||
|
||||
#IPTables
|
||||
resources/./iptables.sh
|
||||
resources/iptables.sh
|
||||
|
||||
#FusionPBX
|
||||
resources/./fusionpbx.sh
|
||||
resources/fusionpbx.sh
|
||||
|
||||
#NGINX web server
|
||||
resources/./nginx.sh
|
||||
resources/nginx.sh
|
||||
|
||||
#Fail2ban
|
||||
resources/./fail2ban.sh
|
||||
resources/fail2ban.sh
|
||||
|
||||
#FreeSWITCH
|
||||
resources/switch/./package-release.sh
|
||||
#resources/switch/./package-master.sh
|
||||
#resources/switch/./source-release.sh
|
||||
resources/switch/./package-permissions.sh
|
||||
if [ $USE_FREESWITCH_SOURCE = true ]; then
|
||||
if [ $USE_FREESWITCH_MASTER = true ]; then
|
||||
resources/switch/source-master.sh
|
||||
else
|
||||
resources/switch/source-release.sh
|
||||
fi
|
||||
resources/switch/source-permissions.sh
|
||||
else
|
||||
if [ $USE_FREESWITCH_MASER = true ]; then
|
||||
if [ $USE_FREESWITCH_PACKAGE_ALL = true ]; then
|
||||
resources/switch/package-master-all.sh
|
||||
else
|
||||
resources/switch/package-master.sh
|
||||
fi
|
||||
else
|
||||
if [ $USE_FREESWITCH_PACKAGE_ALL = true ]; then
|
||||
resources/switch/package-all.sh
|
||||
else
|
||||
resources/switch/package-release.sh
|
||||
fi
|
||||
fi
|
||||
resources/switch/package-permissions.sh
|
||||
fi
|
||||
|
||||
#Postgres
|
||||
resources/./postgres.sh
|
||||
resources/postgres.sh
|
||||
|
||||
#set the ip address
|
||||
server_address=$(hostname -I)
|
||||
|
|
@ -32,10 +81,9 @@ server_address=$(hostname -I)
|
|||
/bin/systemctl daemon-reload
|
||||
/bin/systemctl try-restart freeswitch
|
||||
/bin/systemctl daemon-reload
|
||||
/bin/systemctl restart php-fpm
|
||||
/bin/systemctl restart nginx
|
||||
/bin/systemctl restart fail2ban
|
||||
#/usr/sbin/service nginx restart
|
||||
#/usr/sbin/service fail2ban restart
|
||||
|
||||
#Show database password
|
||||
echo "Complete the install by by going to the IP address of this server ";
|
||||
|
|
|
|||
|
|
@ -9,31 +9,7 @@ else
|
|||
echo "deb http://files.freeswitch.org/repo/deb/freeswitch-1.6/ jessie main" > /etc/apt/sources.list.d/freeswitch.list
|
||||
curl http://files.freeswitch.org/repo/deb/freeswitch-1.6/key.gpg | apt-key add -
|
||||
fi
|
||||
apt-get update && apt-get install -y --force-yes freeswitch-all freeswitch-all-dbg gdb
|
||||
#apt-get remove freeswitch-all freeswitch-all-dbg
|
||||
#rm /etc/apt/sources.list.d/freeswitch.list
|
||||
apt-get update && apt-get install -y --force-yes freeswitch-meta-all freeswitch-all-dbg gdb
|
||||
|
||||
#set the file permissions
|
||||
chown -R freeswitch:freeswitch /var/lib/freeswitch
|
||||
chmod -R g+s /var/lib/freeswitch
|
||||
setfacl -R -m u:www-data:rwx,g:www-data:rwx /var/lib/freeswitch
|
||||
setfacl -R -d -m u:www-data:rwx,g:www-data:rwx /var/lib/freeswitch
|
||||
|
||||
chown -R freeswitch:freeswitch /usr/share/freeswitch
|
||||
chmod -R g+s /usr/share/freeswitch
|
||||
setfacl -R -m u:www-data:rwx,g:www-data:rwx /usr/share/freeswitch
|
||||
setfacl -R -d -m u:www-data:rwx,g:www-data:rwx /usr/share/freeswitch
|
||||
|
||||
chown -R freeswitch:freeswitch /etc/freeswitch
|
||||
chmod -R g+s /etc/freeswitch
|
||||
setfacl -R -m u:www-data:rwx,g:www-data:rwx /etc/freeswitch
|
||||
setfacl -R -d -m u:www-data:rwx,g:www-data:rwx /etc/freeswitch
|
||||
|
||||
chown -R freeswitch:freeswitch /var/log/freeswitch
|
||||
setfacl -R -m u:www-data:rwx,g:www-data:rwx /var/log/freeswitch
|
||||
setfacl -R -d -m u:www-data:rwx,g:www-data:rwx /var/log/freeswitch
|
||||
|
||||
chown -R freeswitch:freeswitch /usr/share/freeswitch/sounds
|
||||
chmod -R g+s /usr/share/freeswitch/sounds
|
||||
setfacl -R -m u:www-data:rwx,g:www-data:rwx /usr/share/freeswitch/sounds
|
||||
setfacl -R -d -m u:www-data:rwx,g:www-data:rwx /usr/share/freeswitch/sounds
|
||||
#make sure that postgresql is started before starting freeswitch
|
||||
sed -i /lib/systemd/system/freeswitch.service -e s:'local-fs.target:local-fs.target postgresql.service:'
|
||||
|
|
|
|||
|
|
@ -0,0 +1,9 @@
|
|||
#!/bin/sh
|
||||
apt-get update && apt-get install -y --force-yes curl memcached haveged
|
||||
curl https://files.freeswitch.org/repo/deb/debian/freeswitch_archive_g0.pub | apt-key add -
|
||||
echo "deb http://files.freeswitch.org/repo/deb/freeswitch-1.6/ jessie main" > /etc/apt/sources.list.d/freeswitch.list
|
||||
echo "deb http://files.freeswitch.org/repo/deb/debian-unstable/ jessie main" >> /etc/apt/sources.list.d/freeswitch.list
|
||||
apt-get update && apt-get install -y --force-yes freeswitch-meta-all freeswitch-all-dbg gdb
|
||||
|
||||
#make sure that postgresql is started before starting freeswitch
|
||||
sed -i /lib/systemd/system/freeswitch.service -e s:'local-fs.target:local-fs.target postgresql.service:'
|
||||
|
|
@ -3,31 +3,17 @@ apt-get update && apt-get install -y --force-yes curl memcached haveged
|
|||
curl https://files.freeswitch.org/repo/deb/debian/freeswitch_archive_g0.pub | apt-key add -
|
||||
echo "deb http://files.freeswitch.org/repo/deb/freeswitch-1.6/ jessie main" > /etc/apt/sources.list.d/freeswitch.list
|
||||
echo "deb http://files.freeswitch.org/repo/deb/debian-unstable/ jessie main" >> /etc/apt/sources.list.d/freeswitch.list
|
||||
apt-get update && apt-get install -y --force-yes freeswitch-all freeswitch-all-dbg gdb
|
||||
#apt-get remove freeswitch-all freeswitch-all-dbg
|
||||
#rm /etc/apt/sources.list.d/freeswitch.list
|
||||
apt-get update
|
||||
apt-get install -y --force-yes gdb
|
||||
apt-get install -y --force-yes freeswitch-meta-bare freeswitch-conf-vanilla freeswitch-systemd freeswitch-mod-commands freeswitch-meta-codecs freeswitch-mod-console freeswitch-mod-logfile freeswitch-mod-distributor
|
||||
apt-get install -y --force-yes freeswitch-lang-en freeswitch-mod-say-en freeswitch-sounds-en-us-callie freeswitch-music-default
|
||||
apt-get install -y --force-yes freeswitch-mod-enum freeswitch-mod-cdr-csv freeswitch-mod-event-socket freeswitch-mod-sofia freeswitch-mod-sofia-dbg freeswitch-mod-loopback
|
||||
apt-get install -y --force-yes freeswitch-mod-conference freeswitch-mod-db freeswitch-mod-dptools freeswitch-mod-expr freeswitch-mod-fifo libyuv-dev freeswitch-mod-httapi
|
||||
apt-get install -y --force-yes freeswitch-mod-hash freeswitch-mod-esl freeswitch-mod-esf freeswitch-mod-fsv freeswitch-mod-valet-parking freeswitch-mod-dialplan-xml freeswitch-dbg
|
||||
apt-get install -y --force-yes freeswitch-mod-sndfile freeswitch-mod-native-file freeswitch-mod-local-stream freeswitch-mod-tone-stream freeswitch-mod-lua freeswitch-meta-mod-say
|
||||
apt-get install -y --force-yes freeswitch-mod-xml-cdr freeswitch-mod-verto freeswitch-mod-callcenter freeswitch-mod-rtc freeswitch-mod-png freeswitch-mod-json-cdr freeswitch-mod-shout
|
||||
apt-get install -y --force-yes freeswitch-mod-skypopen freeswitch-mod-skypopen-dbg freeswitch-mod-sms freeswitch-mod-sms-dbg freeswitch-mod-cidlookup freeswitch-mod-memcache
|
||||
apt-get install -y --force-yes freeswitch-mod-imagick freeswitch-mod-tts-commandline freeswitch-mod-directory freeswitch-mod-flite
|
||||
|
||||
#set the file permissions
|
||||
chown -R freeswitch:freeswitch /var/lib/freeswitch
|
||||
chmod -R g+s /var/lib/freeswitch
|
||||
setfacl -R -m u:www-data:rwx,g:www-data:rwx /var/lib/freeswitch
|
||||
setfacl -R -m d:u:www-data:rwx,d:g:www-data:rwx /var/lib/freeswitch
|
||||
|
||||
chown -R freeswitch:freeswitch /usr/share/freeswitch
|
||||
chmod -R g+s /usr/share/freeswitch
|
||||
setfacl -R -m u:www-data:rwx,g:www-data:rwx /usr/share/freeswitch
|
||||
setfacl -R -m d:u:www-data:rwx,d:g:www-data:rwx /usr/share/freeswitch
|
||||
|
||||
chown -R freeswitch:freeswitch /etc/freeswitch
|
||||
chmod -R g+s /etc/freeswitch
|
||||
setfacl -R -m u:www-data:rwx,g:www-data:rwx /etc/freeswitch
|
||||
setfacl -R -m d:u:www-data:rwx,d:g:www-data:rwx /etc/freeswitch
|
||||
|
||||
chown -R freeswitch:freeswitch /var/log/freeswitch
|
||||
setfacl -R -m u:www-data:rwx,g:www-data:rwx /var/log/freeswitch
|
||||
setfacl -R -m d:u:www-data:rwx,d:g:www-data:rwx /var/log/freeswitch
|
||||
|
||||
chown -R freeswitch:freeswitch /usr/share/freeswitch/sounds
|
||||
chmod -R g+s /usr/share/freeswitch/sounds
|
||||
setfacl -R -m u:www-data:rwx,g:www-data:rwx /usr/share/freeswitch/sounds
|
||||
setfacl -R -m d:u:www-data:rwx,d:g:www-data:rwx /usr/share/freeswitch/sounds
|
||||
#make sure that postgresql is started before starting freeswitch
|
||||
sed -i /lib/systemd/system/freeswitch.service -e s:'local-fs.target:local-fs.target postgresql.service:'
|
||||
|
|
|
|||
|
|
@ -4,19 +4,18 @@ usermod -a -G www-data freeswitch
|
|||
|
||||
#setup owner and group, permissions and sticky
|
||||
chown -R freeswitch:freeswitch /var/lib/freeswitch
|
||||
chmod -R 770 /var/lib/freeswitch
|
||||
chmod -R g+s /var/lib/freeswitch
|
||||
chmod -R ug+rw /var/lib/freeswitch
|
||||
find /var/lib/freeswitch -type d -exec chmod 2770 {} \;
|
||||
|
||||
mkdir /usr/share/freeswitch/scripts
|
||||
chown -R freeswitch:freeswitch /usr/share/freeswitch
|
||||
chmod -R 770 /usr/share/freeswitch
|
||||
#chmod -R 770 /usr/share/freeswitch/scripts
|
||||
#chmod -R 770 /usr/share/freeswitch/lang
|
||||
chmod -R g+s /usr/share/freeswitch
|
||||
chmod -R ug+rw /var/share/freeswitch
|
||||
find /var/share/freeswitch -type d -exec chmod 2770 {} \;
|
||||
|
||||
chown -R freeswitch:freeswitch /etc/freeswitch
|
||||
chmod -R 770 /etc/freeswitch
|
||||
chmod -R g+s /etc/freeswitch
|
||||
chmod -R ug+rw /etc/freeswitch
|
||||
find /etc/freeswitch -type d -exec chmod 2770 {} \;
|
||||
|
||||
chown -R freeswitch:freeswitch /var/log/freeswitch
|
||||
chmod -R 770 /var/log/freeswitch
|
||||
chmod -R g+s /var/log/freeswitch
|
||||
chmod -R ug+rw /var/log/freeswitch
|
||||
find /var/log/freeswitch -type d -exec chmod 2770 {} \;
|
||||
|
|
|
|||
|
|
@ -23,7 +23,3 @@ apt-get install -y --force-yes freeswitch-mod-imagick freeswitch-mod-tts-command
|
|||
|
||||
#make sure that postgresql is started before starting freeswitch
|
||||
sed -i /lib/systemd/system/freeswitch.service -e s:'local-fs.target:local-fs.target postgresql.service:'
|
||||
|
||||
#set the file permissions
|
||||
mkdir /usr/share/freeswitch/scripts
|
||||
chmod g+ws /usr/share/freeswitch/scripts
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
#add users to the groups
|
||||
usermod -a -G freeswitch www-data
|
||||
usermod -a -G www-data freeswitch
|
||||
|
||||
#setup owner and group, permissions and sticky
|
||||
chown -R freeswitch:freeswitch /usr/local/freeswitch
|
||||
chmod -R ug+rw /usr/local/freeswitch
|
||||
find /usr/local/freeswitch -type d -exec chmod 2770 {} \;
|
||||
|
|
@ -34,4 +34,3 @@ make install
|
|||
make sounds-install moh-install
|
||||
make hd-sounds-install hd-moh-install
|
||||
make cd-sounds-install cd-moh-install
|
||||
chown -R www-data:www-data /usr/local/freeswitch
|
||||
|
|
|
|||
Loading…
Reference in New Issue