#!/bin/bash
echo "WARNING: This script is designed to update a fresh install of TrixBox 1.2.3."
echo "Use with other systems may lead to loss of data or system failure."
echo "To continue, press the Enter key. To abort, press Ctrl-C now..."
read
cd /tmp
echo "Installing libc-client library for use with PHP-Imap..."
wget http://nerdvittles.com/trixbox122/libc-client-2002e-14.i386.rpm
rpm -Uvh libc*
echo "Installing mod_ssl to support https web access..."
yum -y install mod_ssl
echo "Installing latest version of WebMin, the Linux Swiss Army Knife..."
yum -y install webmin
echo "Installing kernel source..."
yum -y --enablerepo=trixbox install kernel-devel
echo "Downloading Nerd Vittles PBX-in-a-Flash image..."
wget http://nerdvittles.com/trixbox123/backup.tar.gz
gunzip backup.tar.gz
cd /usr/src
echo "Downloading and installing version 2.1.3 of freePBX..."
svn co https://svn.sourceforge.net/svnroot/amportal/freepbx/tags/2.1.3 freepbx-2.1.3
cd freepbx-2.1.3
./install_amp
cd /usr/local/bin
echo "Installing the missing MIME-construct lookalike by Rob Thomas..."
wget http://nerdvittles.com/trixbox123/mime-construct
chmod +x mime-construct
cd /tmp
echo "Installing Nerd Vittles PBX-in-a-Flash image..."
tar xfv /tmp/backup.tar
cd /
rsync -avv /tmp/backup/ . > /var/log/pbx-in-a-flash.log
echo "Installation complete. For complete documentation..."
echo "Visit NerdVittles.com on the web. "
echo "Reboot your system now by pressing the Enter key..."
read
reboot
