More work on simple installer

This commit is contained in:
Duncan Sommerville 2014-11-26 17:00:59 -05:00
parent 51627e6270
commit 85d965055d
3 changed files with 15 additions and 198 deletions

View File

@ -1,111 +0,0 @@
#!/bin/bash -e
#-e Causes bash script to exit if any of the installers
#return with a non-zero return value.
if [[ $EUID -ne 0 ]]; then
echo "Please run as root user."
exit 1
fi
#copy files to
## /etc/airtime
#+ /etc/apache2/sites-available/airtime
#+ /etc/apache2/sites-enabled/airtime
## /etc/cron.d/
## /etc/init.d/
## /etc/monit/conf.d/
# /usr/lib/airtime/airtime_virtualenv
## /usr/lib/airtime/api_clients
## /usr/lib/airtime/media-monitor
# /srv/airtime/stor
## /usr/lib/airtime/pypo
## /usr/lib/airtime/show-recorder
## /usr/lib/airtime/utils
## /usr/bin/airtime-*
## /usr/share/airtime
## /var/log/airtime
## /var/tmp/airtime
# 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`
AIRTIMEROOT=$SCRIPTPATH/../../
echo "* Creating /etc/airtime"
mkdir -p /etc/airtime
if [ ! -e /etc/airtime/airtime.conf ]; then
#config file airtime.conf exists, but Airtime is not installed
cp $AIRTIMEROOT/airtime_mvc/build/airtime.conf /etc/airtime
fi
#if [ -e /etc/airtime/airtime.conf -a "$DO_UPGRADE" -eq "0" ]; then
#config file airtime.conf exists, but Airtime is not installed
# mv /etc/airtime/airtime.conf airtime.conf.bak
# cp $AIRTIMEROOT/airtime_mvc/build/airtime.conf /etc/airtime
#fi
echo "* Creating /etc/monit/conf.d/monit-airtime-generic.cfg"
mkdir -p /etc/monit/conf.d/
if [ ! -e /etc/monit/conf.d/monit-airtime-generic.cfg ]; then
rm -f /etc/monit/conf.d/*airtime*
cp $AIRTIMEROOT/python_apps/monit/monit-airtime-generic.cfg /etc/monit/conf.d/
fi
echo "* Creating /etc/cron.d/airtime-crons"
HOUR=$(($RANDOM%24))
MIN=$(($RANDOM%60))
echo "$MIN $HOUR * * * root /usr/lib/airtime/utils/phone_home_stat" > /etc/cron.d/airtime-crons
echo "* Creating /usr/lib/airtime"
if [ "$python_service" -eq "0" ]; then
python $AIRTIMEROOT/python_apps/api_clients/install/api_client_install.py
if [ "$mediamonitor" = "t" ]; then
python $AIRTIMEROOT/python_apps/media-monitor/install/media-monitor-copy-files.py
fi
if [ "$pypo" = "t" ]; then
python $AIRTIMEROOT/python_apps/pypo/install/pypo-copy-files.py
fi
fi
cp -R $AIRTIMEROOT/utils /usr/lib/airtime
cp -R $AIRTIMEROOT/python_apps/std_err_override /usr/lib/airtime
echo "* Creating symbolic links in /usr/bin"
#create symbolic links
ln -sf /usr/lib/airtime/utils/airtime-import/airtime-import /usr/bin/airtime-import
ln -sf /usr/lib/airtime/utils/airtime-update-db-settings /usr/bin/airtime-update-db-settings
ln -sf /usr/lib/airtime/utils/airtime-check-system /usr/bin/airtime-check-system
ln -sf /usr/lib/airtime/utils/airtime-log /usr/bin/airtime-log
ln -sf /usr/lib/airtime/utils/airtime-test-soundcard /usr/bin/airtime-test-soundcard
ln -sf /usr/lib/airtime/utils/airtime-test-stream /usr/bin/airtime-test-stream
ln -sf /usr/lib/airtime/utils/airtime-silan /usr/bin/airtime-silan
echo "* Creating /var/log/airtime"
mkdir -p /var/log/airtime
chmod a+x /var/log/airtime
chown www-data:www-data /var/log/airtime/
chown pypo:pypo /var/log/airtime/pypo
chown pypo:pypo /var/log/airtime/pypo-liquidsoap
if [ "$web" = "t" ]; then
echo "* Creating /usr/share/airtime"
rm -rf "/usr/share/airtime"
mkdir -p /usr/share/airtime
cp -R $AIRTIMEROOT/airtime_mvc/* /usr/share/airtime/
rm -f /etc/logrotate.d/airtime-php
cp $AIRTIMEROOT/airtime_mvc/build/airtime-php.logrotate /etc/logrotate.d/airtime-php
fi
echo "* Creating /var/log/airtime"
mkdir -p /var/log/airtime
echo "* Creating /var/tmp/airtime"
mkdir -p /var/tmp/airtime
#Finished copying files

View File

@ -1,67 +0,0 @@
#!/bin/bash -e
#-e Causes bash script to exit if any of the installers
#return with a non-zero return value.
if [[ $EUID -ne 0 ]]; then
echo "Please run as root user."
exit 1
fi
set +e
dist=`lsb_release -is`
echo "Generating locales"
for i in `ls /usr/share/airtime/locale | grep ".._.."`; do
if [ "$dist" = "Debian" ]; then
grep -qi "^$i" /etc/locale.gen
if [ $? -ne 0 ]; then
echo "$i.UTF-8 UTF-8" >> /etc/locale.gen
fi
else
locale-gen "$i.utf8"
fi
done
set -e
if [ "$dist" = "Debian" ]; then
/usr/sbin/locale-gen
fi
# 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`
AIRTIMEROOT=$SCRIPTPATH/../../
if [ "$mediamonitor" = "t" ]; then
python $AIRTIMEROOT/python_apps/media-monitor/install/media-monitor-initialize.py
fi
if [ "$pypo" = "t" ]; then
python $AIRTIMEROOT/python_apps/pypo/install/pypo-initialize.py
fi
chmod 600 /etc/monit/conf.d/monit-airtime-generic.cfg
chmod 600 /etc/monit/conf.d/monit-airtime-liquidsoap.cfg
chmod 600 /etc/monit/conf.d/monit-airtime-media-monitor.cfg
chmod 600 /etc/monit/conf.d/monit-airtime-playout.cfg
chmod 600 /etc/monit/conf.d/monit-airtime-liquidsoap.cfg
# Start monit if it is not running, or restart if it is.
# Need to ensure monit is running before Airtime daemons are run. This is
# so we can ensure they can register with monit to monitor them when they start.
# If monit is already running, this step is still useful as we need monit to
# reload its config files.
invoke-rc.d monit restart
#give monit some time to boot-up before issuing commands
sleep 1
set +e
if [ "$mediamonitor" = "t" ]; then
monit monitor airtime-media-monitor
fi
if [ "$pypo" = "t" ]; then
monit monitor airtime-playout
monit monitor airtime-liquidsoap
fi
set -e

View File

@ -27,7 +27,7 @@ done
dist=`lsb_release -is`
echo -e "\n ****************************************************************"
echo -e "\n ****************************************************************"
echo " * _____ .________________________.___ _____ ___________ *"
echo " * / _ \ | \______ \__ ___/| | / \ \_ _____/ *"
echo " * / /_\ \| || _/ | | | |/ \ / \ | __)_ *"
@ -36,17 +36,17 @@ echo " * \____|__ /___||____|_ / |____| |___\____|__ /__
echo " * \/ \/ \/ \/ *"
echo " ****************************************************************"
echo " ____ ______ ____ ____ __________ __ _________ ____ ____ "
echo " / _ \\____ \_/ __ \ / \ / ___/ _ \| | \_ __ \_/ ___\/ __ \ "
echo " ( <_> ) |_> > ___/| | \ \___ ( <_> ) | /| | \/\ \__\ ___/ "
echo " \____/| __/ \___ >___| / /____ >____/|____/ |__| \___ >___ >"
echo " |__| \/ \/ \/ \/ \/ "
echo " .___.__ __ __ .__ "
echo "____________ __| _/|__| ____ _____ __ ___/ |_ ____ _____ _____ _/ |_|__| ____ ____ "
echo "\_ __ \__ \ / __ | | |/ _ \ \__ \ | | \ __\/ _ \ / \\__ \\ __\ |/ _ \ / \ "
echo " | | \// __ \_/ /_/ | | ( <_> ) / __ \| | /| | ( <_> ) Y Y \/ __ \| | | ( <_> ) | \ "
echo " |__| (____ /\____ | |__|\____/ (____ /____/ |__| \____/|__|_| (____ /__| |__|\____/|___| / "
echo " \/ \/ \/ \/ \/ \/ "
echo " ____ ______ ____ ____ __________ __ _________ ____ ____ "
echo " / _ \\\\____ \_/ __ \ / \ / ___/ _ \| | \_ __ \_/ ___\/ __ \ "
echo " ( <_> ) |_> > ___/| | \ \___ ( <_> ) | /| | \/\ \__\ ___/ "
echo " \____/| __/ \___ >___| / /____ >____/|____/ |__| \___ >___ > "
echo " |__| \/ \/ \/ \/ \/ "
echo " .___.__ __ __ .__ "
echo "____________ __| _/|__| ____ _____ __ ___/ |_ ____ _____ _____ _/ |_|__| ____ ____ "
echo "\_ __ \__ \ / __ | | |/ _ \ \__ \ | | \ __\/ _ \ / \\\\__ \\\\ __\ |/ _ \ / \ "
echo " | | \// __ \_/ /_/ | | ( <_> ) / __ \| | /| | ( <_> ) Y Y \/ __ \| | | ( <_> ) | \ "
echo " |__| (____ /\____ | |__|\____/ (____ /____/ |__| \____/|__|_| (____ /__| |__|\____/|___| / "
echo " \/ \/ \/ \/ \/ \/ "
echo -e "\n-----------------------------------------------------"
echo " * Installing Apache * "
@ -115,26 +115,21 @@ echo "-----------------------------------------------------"
# Clear any previous configuration files
if [ -d "/etc/airtime/" ]; then
rm -rf "/etc/airtime"
rm -rf /etc/airtime/*
else
mkdir "/etc/airtime"
mkdir /etc/airtime
fi
cp airtime/airtime.conf /etc/airtime/airtime.conf
chown -R www-data:www-data /etc/airtime
if [ ! -d "/var/log/airtime" ]; then
mkdir "/var/log/airtime"
mkdir /var/log/airtime
fi
chown -R www-data:www-data /var/log/airtime
apt-get -y --force-yes install postgresql php5-pgsql php5-mysql
# Copy files to /usr/share/airtime
export airtime_service_start='t'
airtime/airtime-copy-files.sh $@
echo -e "\n-----------------------------------------------------"
echo " * Basic Setup DONE! * "
echo " "