95 lines
2.7 KiB
Bash
Executable File
95 lines
2.7 KiB
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# Auto install script for airtime on Ubuntu
|
|
#
|
|
|
|
exec > >(tee install_log.txt)
|
|
exec 2>&1
|
|
|
|
if [ "$(id -u)" != "0" ]; then
|
|
echo "Please run as root user."
|
|
exit 1
|
|
fi
|
|
|
|
#Current dir
|
|
# Absolute path to this script, e.g. /home/user/bin/foo.sh
|
|
SCRIPT=`readlink -f $0`
|
|
# Absolute path this script is in, thus /home/user/bin
|
|
SCRIPTPATH=`dirname $SCRIPT`
|
|
|
|
#Prerequisite
|
|
echo "----------------------------------------------------"
|
|
echo " 1. Install Packages"
|
|
echo "----------------------------------------------------"
|
|
|
|
apt-get update
|
|
|
|
# Updated package list
|
|
apt-get -y install tar gzip curl apache2 php5-pgsql libapache2-mod-php5 \
|
|
php-pear php5-gd postgresql odbc-postgresql python2.6 libsoundtouch-ocaml \
|
|
libtaglib-ocaml libao-ocaml libmad-ocaml ecasound \
|
|
libesd0 libportaudio2 libsamplerate0 rabbitmq-server patch \
|
|
php5-curl mpg123 monit python-virtualenv multitail libcamomile-ocaml-data \
|
|
libvorbis-ocaml
|
|
|
|
#install packages with --force-yes option (this is useful in the case
|
|
#of Debian, where these packages are unauthorized)
|
|
apt-get -y --force-yes install libmp3lame-dev lame icecast2
|
|
|
|
if [ "$?" -ne "0" ]; then
|
|
echo ""
|
|
echo "There was a problem with apt-get. Please check the above error and try again."
|
|
echo ""
|
|
exit 1
|
|
fi
|
|
|
|
# Install phing
|
|
pear channel-discover pear.phing.info
|
|
pear install phing/phing-2.4.2
|
|
|
|
# Apache Config File
|
|
echo "----------------------------------------------------"
|
|
echo "2. Apache Config File"
|
|
echo "----------------------------------------------------"
|
|
if [ ! -f /etc/apache2/sites-available/airtime ]; then
|
|
cp $SCRIPTPATH/../apache/airtime-vhost /etc/apache2/sites-available/airtime
|
|
rm -rf /etc/apache2/sites-enabled/000-default
|
|
ln -s /etc/apache2/sites-available/airtime /etc/apache2/sites-enabled/airtime
|
|
a2enmod rewrite php5
|
|
service apache2 restart
|
|
else
|
|
echo "Apache config for Airtime already exists..."
|
|
fi
|
|
|
|
# Enable Icecast
|
|
echo "----------------------------------------------------"
|
|
echo "3. Enable Icecast"
|
|
echo "----------------------------------------------------"
|
|
cd /etc/default/
|
|
sed -i 's/ENABLE=false/ENABLE=true/g' icecast2
|
|
service icecast2 start
|
|
echo ""
|
|
|
|
# Enable Monit
|
|
echo "----------------------------------------------------"
|
|
echo "4. Enable Monit"
|
|
echo "----------------------------------------------------"
|
|
cd /etc/default/
|
|
sed -i 's/startup=0/startup=1/g' monit
|
|
|
|
grep -q "include /etc/monit/conf.d" /etc/monit/monitrc
|
|
RETVAL=$?
|
|
if [ $RETVAL -ne 0 ] ; then
|
|
mkdir -p /etc/monit/conf.d
|
|
echo "include /etc/monit/conf.d/*" >> /etc/monit/monitrc
|
|
fi
|
|
|
|
# Run Airtime Install
|
|
echo "----------------------------------------------------"
|
|
echo "5. Run Airtime Install"
|
|
echo "----------------------------------------------------"
|
|
cd $SCRIPTPATH/../../install_minimal
|
|
./airtime-install
|
|
|
|
|