So, I know bash scripts aren’t allowed here so what i post is not one but with a simple modification it might help those who boldly go (this works on DO/Buster)
#!/bin/nofuckingwayits a scriptforbash, if i was it would just be #!bin/bash, but it's not ;-)
# stage 1 setup base environment for DO, maybe others
#make as swap file for the needy
dd if=/dev/zero of=/.swapfile bs=1M count=1000
chmod 600 /.swapfile
mkswap /.swapfile
echo -e "/.swapfile\tswap\tswap" >> /etc/fstab
swapon -a
# get apt ready to apt
apt-get -y update
apt-get -y upgrade
# get php7.0 ready
apt install -y software-properties-common ca-certificates apt-transport-https curl gnupg2
wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
echo "deb https://packages.sury.org/php/ buster main" > /etc/apt/sources.list.d/php.list
# install node/npm , (don't use 10+)
curl -sL https://deb.nodesource.com/setup_10.x | bash -
apt-get install -y nodejs
#fix the Cementos/Debian libicu thingy
echo 'icuinfo 2>/dev/null|grep "\"version\""|sed "s/.*\">\(.*\)<.*/\1/g"' > /usr/bin/icu-config
chmod +x /usr/bin/icu-config
#stage 2 install the needed debs
apt-get install -y mlocate asterisk apache2 libapache2-mod-fcgid build-essential openssh-server apache2 mariadb-server \
mariadb-client bison flex php7.0 php7.0-curl php7.0-cli php7.0-pdo php7.0-mysql php7.0-mbstring php7.0-xml \
sox libncurses5-dev libssl-dev mpg123 libxml2-dev libnewt-dev sqlite3 libsqlite3-dev pkg-config automake \
libtool autoconf git unixodbc-dev uuid uuid-dev libasound2-dev libogg-dev libvorbis-dev libicu-dev \
libcurl4-openssl-dev libical-dev libneon27-dev libsrtp2-dev libspandsp-dev sudo subversion libtool-bin \
python-dev unixodbc dirmngr postfix sudo mc traceroute rsync sngrep ffmpeg
#set a reduced security for defult freepbx keys
sed -i 's/^CipherString.*/CipherString = DEFAULT@SECLEVEL=1/' /etc/ssl/openssl.cnf
#stage 3 install FreePBX
systemctl stop asterisk
rm -rf /etc/asterisk
mkdir /etc/asterisk
touch /etc/asterisk/{modules,cdr}.conf
chown asterisk. /var/run/asterisk
chown -R asterisk. /etc/asterisk
chown -R asterisk. /var/{lib,log,spool}/asterisk
chown -R asterisk. /usr/lib/asterisk
rm -rf /var/www/html
sed -i 's/\(^upload_max_filesize = \).*/\120M/' /etc/php/7.0/apache2/php.ini
cp /etc/apache2/apache2.conf /etc/apache2/apache2.conf_orig
sed -i 's/^\(User\|Group\).*/\1 asterisk/' /etc/apache2/apache2.conf
sed -i 's/AllowOverride None/AllowOverride All/' /etc/apache2/apache2.conf
sed -i 's/^memory_limit.*$/memory_limit = 256M/g' /etc/php/7.0/apache2/php.ini
a2enmod rewrite
service apache2 restart
cd /usr/src
wget http://mirror.freepbx.org/modules/packages/freepbx/freepbx-15.0-latest.tgz
tar vxfz freepbx-15.0-latest.tgz
rm -f freepbx-15.0-latest.tgz
cd freepbx
./start_asterisk start
./install -n
#last stage get, the basic modules working for UCP
fwconsole ma upgradeall
fwconsole ma downloadinstall certman
fwconsole ma downloadinstall userman
fwconsole ma downloadinstall ucp
#fix notifications so oly the good guys remain
mysql asterisk -e 'delete from notifications'
fwconsole r
#should be ready go . . .
exit 0
Currently, there is a problem with pm2 on restaring the machine, I fix it with
fwconsole downloadinstall ucp,
a while after boot ( do the proper systemd enable rc-local thing )
wbrtc is dependent on ucp so include that disable/enable around the downloadinstall
(Thanks to all the behind the scenes dudes who got me going on this)