diff --git a/debian/install.sh b/debian/install.sh index 4876fd7..795356c 100755 --- a/debian/install.sh +++ b/debian/install.sh @@ -3,89 +3,16 @@ #move to script directory so all relative paths work cd "$(dirname "$0")" +#includes +. ./resources/config.sh . ./resources/colors.sh -. ./resources/arguments.sh - -if [ .$CPU_CHECK = .true ] && [ .$USE_SWITCH_SOURCE = .false ]; then - #check what the CPU and OS are - OS_test=$(uname -m) - CPU_arch='unknown' - OS_bits='unknown' - CPU_bits='unknown' - if [ .$OS_test = .'armv7l' ]; then - OS_bits='32' - CPU_bits='32' - # RaspberryPi 3 is actually armv8l but current Raspbian reports the cpu as armv7l and no Raspbian 64Bit has been released at this time - CPU_arch='arm' - elif [ .$OS_test = .'armv8l' ]; then - # We currently have no test case for armv8l - OS_bits='unknown' - CPU_bits='64' - CPU_arch='arm' - elif [ .$OS_test = .'i386' ]; then - OS_bits='32' - if [ .$(grep -o -w 'lm' /proc/cpuinfo | head -n 1) = .'lm' ]; then - CPU_bits='64' - else - CPU_bits='32' - fi - CPU_arch='x86' - elif [ .$OS_test = .'i686' ]; then - OS_bits='32' - if [ .$(grep -o -w 'lm' /proc/cpuinfo | head -n 1) = .'lm' ]; then - CPU_bits='64' - else - CPU_bits='32' - fi - CPU_arch='x86' - elif [ .$OS_test = .'x86_64' ]; then - OS_bits='64' - if [ .$(grep -o -w 'lm' /proc/cpuinfo | head -n 1) = .'lm' ]; then - CPU_bits='64' - else - CPU_bits='32' - fi - CPU_arch='x86' - fi - - if [ .$CPU_arch = .'arm' ]; then - if [ .$OS_bits = .'32' ]; then - export USE_SWITCH_PACKAGE_UNOFFICIAL_ARM=true - verbose "Correct CPU/OS detected, using unofficial arm repo" - elif [ .$OS_bits = .'64' ]; then - error "You are using a 64bit arm OS this is unsupported" - warning " please rerun with --use-switch-source" - exit 3 - else - error "Unknown OS_bits $OS_bits this is unsupported" - warning " please rerun with --use-switch-source" - exit 3 - fi - elif [ .$CPU_arch = .'x86' ]; then - if [ .$OS_bits = .'32' ]; then - error "You are using a 32bit OS this is unsupported" - if [ .$CPU_bits = .'64' ]; then - warning " Your CPU is 64bit you should consider reinstalling with a 64bit OS" - fi - warning " please rerun with --use-switch-source" - exit 3 - elif [ .$OS_bits = .'64' ]; then - verbose "Correct CPU/OS detected" - else - error "Unknown OS_bits $OS_bits this is unsupported" - warning " please rerun with --use-switch-source" - exit 3 - fi - else - error "You are using a unsupported architecture $CPU_arch" - fi -fi +. ./resources/environment.sh # removes the cd img from the /etc/apt/sources.list file (not needed after base install) sed -i '/cdrom:/d' /etc/apt/sources.list -#Update Debian -verbose "Update Debian" +#Update to latest packages +verbose "Update installed packages" apt-get upgrade && apt-get update -y --force-yes #Add dependencies @@ -107,47 +34,7 @@ resources/php.sh resources/fail2ban.sh #FreeSWITCH -if [ .$USE_SWITCH_SOURCE = .true ]; then - if [ .$USE_SWITCH_MASTER = .true ]; then - resources/switch/source-master.sh - else - resources/switch/source-release.sh - fi - - #copy the switch conf files to /etc/freeswitch - resources/switch/conf-copy.sh - - #set the file permissions - resources/switch/source-permissions.sh - - #systemd service - resources/switch/source-systemd.sh - -else - if [ .$USE_SWITCH_MASTER = .true ]; then - if [ .$USE_SWITCH_PACKAGE_ALL = .true ]; then - resources/switch/package-master-all.sh - else - resources/switch/package-master.sh - fi - else - if [ .$USE_SWITCH_PACKAGE_ALL = .true ]; then - resources/switch/package-all.sh - else - resources/switch/package-release.sh - fi - fi - - #copy the switch conf files to /etc/freeswitch - resources/switch/conf-copy.sh - - #set the file permissions - resources/switch/package-permissions.sh - - #systemd service - resources/switch/package-systemd.sh - -fi +resources/switch.sh #Postgres resources/postgres.sh @@ -157,9 +44,10 @@ server_address=$(hostname -I) #restart services systemctl daemon-reload -if [ .$USE_PHP5_PACKAGE = .true ]; then +if [ ."$php_version" = ."5" ]; then systemctl restart php5-fpm -else +fi +if [ ."$php_version" = ."7" ]; then systemctl restart php7.0-fpm fi systemctl restart nginx diff --git a/debian/resources/backup/fusionpbx-backup.sh b/debian/resources/backup/fusionpbx-backup.sh old mode 100644 new mode 100755 diff --git a/debian/resources/config.sh b/debian/resources/config.sh new file mode 100755 index 0000000..5711a8b --- /dev/null +++ b/debian/resources/config.sh @@ -0,0 +1,14 @@ + +# FusionPBX Settings +system_branch=stable # master, stable + +# FreeSWITCH Settings +switch_branch=stable # master, stable +switch_source=false # true or false +switch_package=true # true or false + +# General Settings +php_version=5 # PHP version 5 or 7 +database_repo=official # PostgresSQL official, system, 2ndquadrant +database_backup=false # true or false +web_server_name=nginx # nginx diff --git a/debian/resources/environment.sh b/debian/resources/environment.sh new file mode 100755 index 0000000..5ec856b --- /dev/null +++ b/debian/resources/environment.sh @@ -0,0 +1,79 @@ +#!/bin/sh + +#operating system details +os_name=$(lsb_release -is) +os_codename=$(lsb_release -cs) +os_mode='unknown' + +#cpu details +cpu_name=$(uname -m) +cpu_architecture='unknown' +cpu_mode='unknown' + +if [ .$cpu_name = .'armv7l' ]; then + # RaspberryPi 3 is actually armv8l but current Raspbian reports the cpu as armv7l and no Raspbian 64Bit has been released at this time + os_mode='32' + cpu_mode='32' + cpu_architecture='arm' +elif [ .$cpu_name = .'armv8l' ]; then + # No test case for armv8l + os_mode='unknown' + cpu_mode='64' + cpu_architecture='arm' +elif [ .$cpu_name = .'i386' ]; then + os_mode='32' + if [ .$(grep -o -w 'lm' /proc/cpuinfo | head -n 1) = .'lm' ]; then + cpu_mode='64' + else + cpu_mode='32' + fi + cpu_architecture='x86' +elif [ .$cpu_name = .'i686' ]; then + os_mode='32' + if [ .$(grep -o -w 'lm' /proc/cpuinfo | head -n 1) = .'lm' ]; then + cpu_mode='64' + else + cpu_mode='32' + fi + cpu_architecture='x86' +elif [ .$cpu_name = .'x86_64' ]; then + os_mode='64' + if [ .$(grep -o -w 'lm' /proc/cpuinfo | head -n 1) = .'lm' ]; then + cpu_mode='64' + else + cpu_mode='32' + fi + cpu_architecture='x86' +fi + +if [ .$cpu_architecture = .'arm' ]; then + if [ .$os_mode = .'32' ]; then + verbose "Correct CPU and Operating System detected, using the ARM repo" + elif [ .$os_mode = .'64' ]; then + error "You are using a 64bit arm OS this is unsupported" + switch_source=true + switch_package=false + else + error "Unknown OS mode $os_mode this is unsupported" + switch_source=true + switch_package=false + fi +elif [ .$cpu_architecture = .'x86' ]; then + if [ .$os_mode = .'32' ]; then + error "You are using a 32bit OS this is unsupported" + if [ .$cpu_mode = .'64' ]; then + warning " Your CPU is 64bit you should consider reinstalling with a 64bit OS" + fi + switch_source=true + switch_package=false + elif [ .$os_mode = .'64' ]; then + verbose "Correct CPU and Operating System detected" + else + error "Unknown Operating System mode $os_mode is unsupported" + switch_source=true + switch_package=false + fi +else + error "You are using a unsupported architecture $cpu_architecture" + exit 3 +fi diff --git a/debian/resources/fail2ban.sh b/debian/resources/fail2ban.sh index b6247e0..c673734 100755 --- a/debian/resources/fail2ban.sh +++ b/debian/resources/fail2ban.sh @@ -3,8 +3,10 @@ #move to script directory so all relative paths work cd "$(dirname "$0")" +#includes +. ./config.sh . ./colors.sh -. ./arguments.sh +. ./environment.sh #send a message verbose "Installing Fail2ban" @@ -23,7 +25,7 @@ cp fail2ban/nginx-dos.conf /etc/fail2ban/filter.d/nginx-dos.conf cp fail2ban/jail.local /etc/fail2ban/jail.local #update config if source is being used -if [ .$USE_FREESWITCH_SOURCE = .true ]; then +if [ .$switch_source = .true ]; then sed 's#var/log/freeswitch#usr/local/freeswitch/log#g' -i /etc/fail2ban/jail.local fi diff --git a/debian/resources/fail2ban/freeswitch-404.conf b/debian/resources/fail2ban/freeswitch-404.conf old mode 100644 new mode 100755 diff --git a/debian/resources/fail2ban/freeswitch-dos.conf b/debian/resources/fail2ban/freeswitch-dos.conf old mode 100644 new mode 100755 diff --git a/debian/resources/fail2ban/freeswitch-ip.conf b/debian/resources/fail2ban/freeswitch-ip.conf old mode 100644 new mode 100755 diff --git a/debian/resources/fail2ban/freeswitch.conf b/debian/resources/fail2ban/freeswitch.conf old mode 100644 new mode 100755 diff --git a/debian/resources/fail2ban/fusionpbx.conf b/debian/resources/fail2ban/fusionpbx.conf old mode 100644 new mode 100755 diff --git a/debian/resources/fail2ban/jail.local b/debian/resources/fail2ban/jail.local old mode 100644 new mode 100755 diff --git a/debian/resources/fail2ban/nginx-404.conf b/debian/resources/fail2ban/nginx-404.conf old mode 100644 new mode 100755 diff --git a/debian/resources/fail2ban/nginx-dos.conf b/debian/resources/fail2ban/nginx-dos.conf old mode 100644 new mode 100755 diff --git a/debian/resources/finish.sh b/debian/resources/finish.sh index 50f64dd..d534203 100755 --- a/debian/resources/finish.sh +++ b/debian/resources/finish.sh @@ -4,8 +4,9 @@ cd "$(dirname "$0")" #includes +. ./config.sh . ./colors.sh -. ./arguments.sh +. ./environment.sh #database details database_host=127.0.0.1 @@ -93,10 +94,11 @@ echo " If you need to login to a different domain then use username@domain." echo " username: $user_name@$domain_name"; echo "" echo " Official FusionPBX Training" -echo " Admin Training 24 - 26 Jan (3 Days)" -echo " Advanced Training 31 Jan - Feb 2 (3 Days)" +echo " Fastest way to learn FusionPBX. For more information https://www.fusionpbx.com." +echo " Admin Training 27 - 28 March (2 Days)" +echo " Advanced Training 29 - 30 March (2 Days)" echo " Timezone: https://www.timeanddate.com/worldclock/usa/boise" -echo " For more info visit https://www.fusionpbx.com" +echo " Available online and in person. Includes documentation and recording." echo "" echo " Additional information." echo " https://fusionpbx.com/support.php" diff --git a/debian/resources/fusionpbx.sh b/debian/resources/fusionpbx.sh index 51180d1..3d880c6 100755 --- a/debian/resources/fusionpbx.sh +++ b/debian/resources/fusionpbx.sh @@ -3,8 +3,9 @@ #move to script directory so all relative paths work cd "$(dirname "$0")" +. ./config.sh . ./colors.sh -. ./arguments.sh +. ./environment.sh #send a message verbose "Installing FusionPBX" @@ -13,18 +14,18 @@ verbose "Installing FusionPBX" apt-get install -y --force-yes vim git dbus haveged ssl-cert apt-get install -y --force-yes ghostscript libtiff5-dev libtiff-tools -if [ .$USE_SYSTEM_MASTER = .true ]; then +if [ .$system_branch = "master" ]; then verbose "Using master" - BRANCH="" + branch="" else - FUSION_MAJOR=$(git ls-remote --heads https://github.com/fusionpbx/fusionpbx.git | cut -d/ -f 3 | grep -P '^\d+\.\d+' | sort | tail -n 1 | cut -d. -f1) - FUSION_MINOR=$(git ls-remote --tags https://github.com/fusionpbx/fusionpbx.git $FUSION_MAJOR.* | cut -d/ -f3 | grep -P '^\d+\.\d+' | sort | tail -n 1 | cut -d. -f2) - FUSION_VERSION=$FUSION_MAJOR.$FUSION_MINOR - verbose "Using version $FUSION_VERSION" - BRANCH="-b $FUSION_VERSION" + system_major=$(git ls-remote --heads https://github.com/fusionpbx/fusionpbx.git | cut -d/ -f 3 | grep -P '^\d+\.\d+' | sort | tail -n 1 | cut -d. -f1) + system_minor=$(git ls-remote --tags https://github.com/fusionpbx/fusionpbx.git $system_major.* | cut -d/ -f3 | grep -P '^\d+\.\d+' | sort | tail -n 1 | cut -d. -f2) + system_version=$system_major.$system_minor + verbose "Using version $system_version" + branch="-b $system_version" fi #get the source code -git clone $BRANCH https://github.com/fusionpbx/fusionpbx.git /var/www/fusionpbx +git clone $branch https://github.com/fusionpbx/fusionpbx.git /var/www/fusionpbx chown -R www-data:www-data /var/www/fusionpbx chmod -R 755 /var/www/fusionpbx/secure diff --git a/debian/resources/fusionpbx/config.php b/debian/resources/fusionpbx/config.php old mode 100644 new mode 100755 diff --git a/debian/resources/iptables.sh b/debian/resources/iptables.sh index 188e024..ff5afc0 100755 --- a/debian/resources/iptables.sh +++ b/debian/resources/iptables.sh @@ -3,8 +3,8 @@ #move to script directory so all relative paths work cd "$(dirname "$0")" +. ./config.sh . ./colors.sh -. ./arguments.sh #send a message verbose "Configuring IPTables" diff --git a/debian/resources/letsencrypt.sh b/debian/resources/letsencrypt.sh old mode 100644 new mode 100755 index 00e2194..3017911 --- a/debian/resources/letsencrypt.sh +++ b/debian/resources/letsencrypt.sh @@ -1,5 +1,11 @@ #!/bin/sh +#move to script directory so all relative paths work +cd "$(dirname "$0")" + +#includes +. ./config.sh + #request the domain and email read -p 'Domain Name: ' domain_name read -p 'Email Address: ' email_address diff --git a/debian/resources/letsencrypt/domain_name.conf b/debian/resources/letsencrypt/domain_name.conf old mode 100644 new mode 100755 diff --git a/debian/resources/nginx.sh b/debian/resources/nginx.sh index a4797d4..2452d8c 100755 --- a/debian/resources/nginx.sh +++ b/debian/resources/nginx.sh @@ -3,40 +3,35 @@ #move to script directory so all relative paths work cd "$(dirname "$0")" +#includes +. ./config.sh . ./colors.sh -. ./arguments.sh +. ./environment.sh #send a message verbose "Installing the web server" -arch=$(uname -m) -real_os=$(lsb_release -is) -codename=$(lsb_release -cs) -if [ .$USE_SWITCH_PACKAGE_UNOFFICIAL_ARM = .true ]; then +#if [ ."$cpu_architecture" = ."arm" ]; then #9.x - */stretch/ #8.x - */jessie/ - if [ .$codename = .'jessie' ]; then - USE_PHP5_PACKAGE = true - fi -fi -if [ .$USE_PHP5_PACKAGE = .true ]; then - #don't add php7.0 repository - verbose "Switching forcefully to php5* packages" +#fi +if [ ."$php_version" = ."5" ]; then + #verbose "Switching forcefully to php5* packages" which add-apt-repository || apt-get install -y software-properties-common - LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php - LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php5-compat -elif [ .$real_os = .'Ubuntu' ]; then + #LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php + #LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php5-compat +elif [ ."$os_name" = ."Ubuntu" ]; then #16.10.x - */yakkety/ #16.04.x - */xenial/ #14.04.x - */trusty/ - if [ .$codename = .'trusty' ]; then + if [ ."$os_codename" = ."trusty" ]; then which add-apt-repository || apt-get install -y software-properties-common LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php fi else #9.x - */stretch/ #8.x - */jessie/ - if [ .$codename = .'jessie' ]; then + if [ ."$os_codename" = ."jessie" ]; then echo "deb http://packages.dotdeb.org $codename all" > /etc/apt/sources.list.d/dotdeb.list echo "deb-src http://packages.dotdeb.org $codename all" >> /etc/apt/sources.list.d/dotdeb.list wget -O - https://www.dotdeb.org/dotdeb.gpg | apt-key add - @@ -44,20 +39,28 @@ else fi apt-get update +#use php version 5 for arm +if [ .$cpu_architecture = .'arm' ]; then + php_version=5 +fi + #install dependencies apt-get install -y nginx -if [ .$USE_PHP5_PACKAGE = .true ]; then +if [ ."$php_version" = ."5" ]; then apt-get install -y php5 php5-cli php5-fpm php5-pgsql php5-sqlite php5-odbc php5-curl php5-imap php5-mcrypt -else +fi +if [ ."$php_version" = ."7" ]; then apt-get install -y php7.0 php7.0-cli php7.0-fpm php7.0-pgsql php7.0-sqlite3 php7.0-odbc php7.0-curl php7.0-imap php7.0-mcrypt php7.0-xml fi #enable fusionpbx nginx config cp nginx/fusionpbx /etc/nginx/sites-available/fusionpbx + #prepare socket name -if [ .$USE_PHP5_PACKAGE = .true ]; then +if [ ."$php_version" = ."5" ]; then sed -i /etc/nginx/sites-available/fusionpbx -e 's#unix:.*;#unix:/var/run/php5-fpm.sock;#g' -else +fi +if [ ."$php_version" = ."7" ]; then sed -i /etc/nginx/sites-available/fusionpbx -e 's#unix:.*;#unix:/var/run/php/php7.0-fpm.sock;#g' fi ln -s /etc/nginx/sites-available/fusionpbx /etc/nginx/sites-enabled/fusionpbx diff --git a/debian/resources/nginx/fusionpbx b/debian/resources/nginx/fusionpbx old mode 100644 new mode 100755 diff --git a/debian/resources/php.sh b/debian/resources/php.sh index d9232c5..3427f80 100755 --- a/debian/resources/php.sh +++ b/debian/resources/php.sh @@ -3,17 +3,19 @@ #move to script directory so all relative paths work cd "$(dirname "$0")" +#includes +. ./config.sh . ./colors.sh -. ./arguments.sh #send a message verbose "Configuring PHP" #update config if source is being used -if [ .$USE_PHP5_PACKAGE = .true ]; then +if [ ."$php_version" = ."5" ]; then verbose "version 5.x" php_ini_file='/etc/php5/fpm/php.ini' -else +fi +if [ ."$php_version" = ."7" ]; then verbose "version 7.0" php_ini_file='/etc/php/7.0/fpm/php.ini' fi @@ -22,11 +24,13 @@ sed 's#upload_max_filesize = .*#upload_max_filesize = 80M#g' -i $php_ini_file #restart php-fpm #systemd -if [ .$USE_PHP5_PACKAGE = .true ]; then +if [ ."$php_version" = ."5" ]; then systemctl restart php5-fpm -else +fi +if [ ."$php_version" = ."7" ]; then systemctl restart php7.0-fpm fi #init.d +#/usr/sbin/service php5-fpm restart #/usr/sbin/service php7.0-fpm restart diff --git a/debian/resources/postgres.sh b/debian/resources/postgres.sh index 2dece12..9e2160a 100755 --- a/debian/resources/postgres.sh +++ b/debian/resources/postgres.sh @@ -1,5 +1,13 @@ #!/bin/sh +#move to script directory so all relative paths work +cd "$(dirname "$0")" + +#includes +. ./config.sh +. ./colors.sh +. ./environment.sh + #send a message echo "Install PostgreSQL" @@ -9,22 +17,33 @@ password=$(dd if=/dev/urandom bs=1 count=20 2>/dev/null | base64) #install message echo "Install PostgreSQL and create the database and users\n" +#use the system database repo for arm +if [ .$cpu_architecture = .'arm' ]; then + database_repo="system" +fi + #included in the distribution -#apt-get install -y --force-yes sudo postgresql +if [ ."$database_repo" = ."system" ]; then + apt-get install -y --force-yes sudo postgresql +fi #postgres official repository -echo 'deb http://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main' > /etc/apt/sources.list.d/pgdg.list -wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - -apt-get update && apt-get upgrade -y -apt-get install -y --force-yes sudo postgresql +if [ ."$database_repo" = ."official" ]; then + echo 'deb http://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main' > /etc/apt/sources.list.d/pgdg.list + wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - + apt-get update && apt-get upgrade -y + apt-get install -y --force-yes sudo postgresql +fi #Add PostgreSQL and BDR REPO -#echo 'deb http://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main' >> /etc/apt/sources.list.d/postgresql.list -#echo 'deb http://packages.2ndquadrant.com/bdr/apt/ jessie-2ndquadrant main' >> /etc/apt/sources.list.d/2ndquadrant.list -#/usr/bin/wget --quiet -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | apt-key add - -#/usr/bin/wget --quiet -O - http://packages.2ndquadrant.com/bdr/apt/AA7A6805.asc | apt-key add - -#apt-get update && apt-get upgrade -y -#apt-get install -y --force-yes sudo postgresql-bdr-9.4 postgresql-bdr-9.4-bdr-plugin postgresql-bdr-contrib-9.4 +if [ ."$database_repo" = ."2ndquadrant" ]; then + echo 'deb http://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main' >> /etc/apt/sources.list.d/postgresql.list + echo 'deb http://packages.2ndquadrant.com/bdr/apt/ jessie-2ndquadrant main' >> /etc/apt/sources.list.d/2ndquadrant.list + /usr/bin/wget --quiet -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | apt-key add - + /usr/bin/wget --quiet -O - http://packages.2ndquadrant.com/bdr/apt/AA7A6805.asc | apt-key add - + apt-get update && apt-get upgrade -y + apt-get install -y --force-yes sudo postgresql-bdr-9.4 postgresql-bdr-9.4-bdr-plugin postgresql-bdr-contrib-9.4 +fi #systemd systemctl daemon-reload @@ -33,12 +52,19 @@ systemctl restart postgresql #init.d #/usr/sbin/service postgresql restart +#install the database backup +cp backup/fusionpbx-backup.sh /etc/cron.daily +chmod 755 /etc/cron.daily/fusionpbx-backup.sh +sed -i "s/zzz/$password/g" /etc/cron.daily/fusionpbx-backup.sh + #move to /tmp to prevent a red herring error when running sudo with psql cwd=$(pwd) cd /tmp #add the databases, users and grant permissions to them -sudo -u postgres psql -c "CREATE DATABASE fusionpbx"; -sudo -u postgres psql -c "CREATE DATABASE freeswitch"; +sudo -u postgres psql -c "DROP SCHEMA public cascade;"; +sudo -u postgres psql -c "CREATE SCHEMA public;"; +sudo -u postgres psql -c "CREATE DATABASE fusionpbx;"; +sudo -u postgres psql -c "CREATE DATABASE freeswitch;"; sudo -u postgres psql -c "CREATE ROLE fusionpbx WITH SUPERUSER LOGIN PASSWORD '$password';" sudo -u postgres psql -c "CREATE ROLE freeswitch WITH SUPERUSER LOGIN PASSWORD '$password';" sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE fusionpbx to fusionpbx;" diff --git a/debian/resources/reboot_phones.sh b/debian/resources/reboot_phones.sh old mode 100644 new mode 100755 diff --git a/debian/resources/sngrep.sh b/debian/resources/sngrep.sh new file mode 100644 index 0000000..9c9bbde --- /dev/null +++ b/debian/resources/sngrep.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +#add sngrep +if [ ."$cpu_architecture" != ."arm" ]; then + echo 'deb http://packages.irontec.com/debian jessie main' > /etc/apt/sources.list.d/sngrep.list + wget http://packages.irontec.com/public.key -q -O - | apt-key add - + apt-get update + apt-get install sngrep +fi diff --git a/debian/resources/switch.sh b/debian/resources/switch.sh new file mode 100755 index 0000000..a7d47f1 --- /dev/null +++ b/debian/resources/switch.sh @@ -0,0 +1,49 @@ +#!/bin/sh + +#move to script directory so all relative paths work +cd "$(dirname "$0")" + +#includes +. ./config.sh + +if [ .$switch_source = .true ]; then + if [ ."$switch_branch" = "master" ]; then + switch/source-master.sh + else + switch/source-release.sh + fi + + #copy the switch conf files to /etc/freeswitch + switch/conf-copy.sh + + #set the file permissions + switch/source-permissions.sh + + #systemd service + switch/source-systemd.sh +fi + +if [ .$switch_package = .true ]; then + if [ ."$switch_branch" = "master" ]; then + if [ .$switch_package_all = .true ]; then + switch/package-master-all.sh + else + switch/package-master.sh + fi + else + if [ .$switch_package_all = .true ]; then + switch/package-all.sh + else + switch/package-release.sh + fi + fi + + #copy the switch conf files to /etc/freeswitch + switch/conf-copy.sh + + #set the file permissions + switch/package-permissions.sh + + #systemd service + switch/package-systemd.sh +fi diff --git a/debian/resources/switch/package-all.sh b/debian/resources/switch/package-all.sh index a21042b..5573fba 100755 --- a/debian/resources/switch/package-all.sh +++ b/debian/resources/switch/package-all.sh @@ -1,11 +1,13 @@ #!/bin/sh -#initialize variable encase we are called directly -[ -z $USE_SWITCH_PACKAGE_UNOFFICIAL_ARM ] && USE_SWITCH_PACKAGE_UNOFFICIAL_ARM=false +. ../config.sh +. ../colors.sh +. ../environment.sh +. ../arguments.sh apt-get update && apt-get install -y --force-yes ntp curl memcached haveged -arch=$(uname -m) -if [ $arch = 'armv7l' ] && [ $USE_SWITCH_PACKAGE_UNOFFICIAL_ARM = true ]; then + +if [ ."$cpu_architecture" = ."arm" ]; then echo "deb http://repo.sip247.com/debian/freeswitch-stable-armhf/ jessie main" > /etc/apt/sources.list.d/freeswitch.list curl http://repo.sip247.com/debian/sip247.com.gpg.key | apt-key add - else diff --git a/debian/resources/switch/package-release.sh b/debian/resources/switch/package-release.sh index 11861e8..eb63e14 100755 --- a/debian/resources/switch/package-release.sh +++ b/debian/resources/switch/package-release.sh @@ -3,12 +3,12 @@ #move to script directory so all relative paths work cd "$(dirname "$0")" +. ../config.sh . ../colors.sh -. ../arguments.sh +. ../environment.sh apt-get update && apt-get install -y --force-yes curl memcached haveged -arch=$(uname -m) -if [ $arch = 'armv7l' ] && [ $USE_SWITCH_PACKAGE_UNOFFICIAL_ARM = true ]; then +if [ ."$cpu_architecture" = ."arm" ]; then echo "deb http://repo.sip247.com/debian/freeswitch-stable-armhf/ jessie main" > /etc/apt/sources.list.d/freeswitch.list curl http://repo.sip247.com/debian/sip247.com.gpg.key | apt-key add - else diff --git a/debian/resources/switch/source/etc.default.freeswitch b/debian/resources/switch/source/etc.default.freeswitch old mode 100644 new mode 100755 diff --git a/debian/resources/switch/source/freeswitch.service.package b/debian/resources/switch/source/freeswitch.service.package old mode 100644 new mode 100755 diff --git a/debian/resources/switch/source/freeswitch.service.source b/debian/resources/switch/source/freeswitch.service.source old mode 100644 new mode 100755