libretime/install_minimal/airtime-install

92 lines
3.1 KiB
Bash
Executable File

#!/bin/bash -e
#-e Causes bash script to exit if any of the installers
#return with a non-zero return value.
set +e
DEB=$(dpkg -s airtime 2> /dev/null | grep Status)
set -e
if [[ "$DEB" = "Status: install ok installed" ]]; then
echo -e "\nDebian package of Airtime detected. Please use the debian package to upgrade.\n"
exit 1
fi
echo -e "\n******************************** Install Begin *********************************"
# Absolute path to this script
SCRIPT=`readlink -f $0`
# Absolute directory this script is in
SCRIPTPATH=`dirname $SCRIPT`
VIRTUAL_ENV_DIR="/usr/lib/airtime/airtime_virtualenv"
VIRTUAL_ENV_SHARE="/usr/share/python-virtualenv/"
if [ ! -d "$VIRTUAL_ENV_DIR" ]; then
echo -e "\n*** Creating Virtualenv for Airtime ***"
set +e
virtualenv --help | grep extra-search-dir
EXTRAOPTION=$?
set -e
if [ $EXTRAOPTION -eq "0" ]; then
virtualenv --extra-search-dir=${SCRIPTPATH}/3rd_party --no-site-package -p /usr/bin/python2.6 /usr/lib/airtime/airtime_virtualenv
else
# copy distribute-0.6.10.tar.gz to /usr/share/python-virtualenv/
# this is due to the bug in virtualenv 1.4.9
if [ -d "$VIRTUAL_ENV_SHARE" ]; then
cp ${SCRIPTPATH}/3rd_party/distribute-0.6.10.tar.gz /usr/share/python-virtualenv/
fi
virtualenv --no-site-package -p /usr/bin/python2.6 /usr/lib/airtime/airtime_virtualenv
fi
echo -e "\n*** Installing Python Libraries ***"
/usr/lib/airtime/airtime_virtualenv/bin/pip install ${SCRIPTPATH}/airtime_virtual_env.pybundle -E /usr/lib/airtime/airtime_virtualenv
echo -e "\n*** Patching Python Libraries ***"
PACHES=${SCRIPTPATH}/patches/*
for file in $(find $PACHES -print); do
if [ -d $file ]; then
DIRNAME=$(basename $file)
echo -e "\n ---Applying Patches for $DIRNAME---"
else
patch -N -p0 -i $file
fi
done
else
echo -e "\n*** Existing Airtime Virtualenv Found ***"
fi
virtualenv_bin="/usr/lib/airtime/airtime_virtualenv/bin/"
. ${virtualenv_bin}activate
echo -e "\n*** Creating Pypo User ***"
python ${SCRIPTPATH}/../python_apps/create-pypo-user.py
set +e
php --php-ini ${SCRIPTPATH}/airtime-php.ini --file ${SCRIPTPATH}/include/airtime-install.php $@
result=$?
if [ "$result" -eq "2" ]; then
#We've just finished an upgrade, so let's exit
exit 0
elif [ "$result" -ne "0" ]; then
#There was an error, exit with error code.
exit 1
fi
set -e
echo -e "\n*** API Client Installation ***"
python ${SCRIPTPATH}/../python_apps/api_clients/install/api_client_install.py
echo -e "\n*** Pypo Installation ***"
python ${SCRIPTPATH}/../python_apps/pypo/install/pypo-install.py
echo -e "\n*** Recorder Installation ***"
python ${SCRIPTPATH}/../python_apps/show-recorder/install/recorder-install.py
echo -e "\n*** Media Monitor Installation ***"
python ${SCRIPTPATH}/../python_apps/media-monitor/install/media-monitor-install.py
sleep 4
echo -e "\n*** Verifying your system environment ***"
airtime-check-system
echo -e "\n******************************* Install Complete *******************************"