#!/bin/bash echo "Starting Gonk node..." echo " ______ /______\\ | [==] | |______| \\______/ | | | |/\|/\|" if [ -f /var/gonk ]; then echo "Gonk has already been provisioned" else echo "Running first time provisioning..." echo " Adding gonk user..." useradd -d /var/lib/asterisk/ -c "Gonk asterisk user" -r -s /sbin/nologin gonk echo " Setting permissions..." chown -R gonk:gonk /var/lib/asterisk chown -R gonk:gonk /var/log/asterisk chown -R gonk:gonk /var/spool/asterisk echo " Pulling config files for the first time..." curl -o /etc/asterisk/asterisk.conf https://api.gonk.nicolor.tech/asterisk/$HOSTNAME/$GONK_KEY curl -o /etc/asterisk/pjsip.conf https://api.gonk.nicolor.tech/pjsip/$HOSTNAME/$GONK_KEY curl -o /etc/asterisk/modules.conf https://api.gonk.nicolor.tech/modules/$HOSTNAME/$GONK_KEY touch /var/gonk fi echo "Starting Asterisk..." asterisk -U gonk -G gonk -f