Add very basic uninstall script, move install script to root directory
This commit is contained in:
parent
ec601f916c
commit
674b8c69e4
4
README
4
README
|
@ -32,9 +32,7 @@ http://wiki.sourcefabric.org/display/CC/Airtime+Dev+Site
|
||||||
|
|
||||||
Basic installation has two steps:
|
Basic installation has two steps:
|
||||||
|
|
||||||
1) Run the install script, located in the Airtime/installer directory.
|
1) Run the install script, located in the Airtime root directory.
|
||||||
|
|
||||||
cd installer
|
|
||||||
|
|
||||||
For an interactive installation, run:
|
For an interactive installation, run:
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ if [[ $EUID -ne 0 ]]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"
|
SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"
|
||||||
AIRTIMEROOT="$( cd "$( dirname ${SCRIPT_DIR} )" && pwd )"
|
AIRTIMEROOT=${SCRIPT_DIR}
|
||||||
|
|
||||||
showhelp () {
|
showhelp () {
|
||||||
echo "Usage: sudo bash install [options]
|
echo "Usage: sudo bash install [options]
|
||||||
|
@ -281,7 +281,7 @@ if [ "$apache" = "t" ]; then
|
||||||
|
|
||||||
if [ ! -f /etc/apache2/sites-available/${airtimeconfigfile} ]; then
|
if [ ! -f /etc/apache2/sites-available/${airtimeconfigfile} ]; then
|
||||||
verbose "\n * Creating Apache config for Airtime..."
|
verbose "\n * Creating Apache config for Airtime..."
|
||||||
sed -e "s@WEB_ROOT@${web_root}@g" ${SCRIPT_DIR}/apache/airtime-vhost > /etc/apache2/sites-available/${airtimeconfigfile}
|
sed -e "s@WEB_ROOT@${web_root}@g" ${SCRIPT_DIR}/installer/apache/airtime-vhost > /etc/apache2/sites-available/${airtimeconfigfile}
|
||||||
loudCmd "a2dissite 000-default"
|
loudCmd "a2dissite 000-default"
|
||||||
loudCmd "a2ensite airtime"
|
loudCmd "a2ensite airtime"
|
||||||
else
|
else
|
||||||
|
@ -344,13 +344,7 @@ cp -R ${AIRTIMEROOT}/python_apps/media-monitor/media-monitor2 /usr/lib/airtime/m
|
||||||
verbose "...Done"
|
verbose "...Done"
|
||||||
|
|
||||||
verbose "\n * Installing media-monitor..."
|
verbose "\n * Installing media-monitor..."
|
||||||
if [ -z web_root ]; then
|
python ${AIRTIMEROOT}/python_apps/media-monitor/setup.py install
|
||||||
python ${web_root}/python_apps/media-monitor/setup.py install
|
|
||||||
elif [ "$in_place" = "t" ]; then
|
|
||||||
python ${AIRTIMEROOT}/python_apps/media-monitor/setup.py install
|
|
||||||
else
|
|
||||||
python /usr/share/airtime/python_apps/media-monitor/setup.py install
|
|
||||||
fi
|
|
||||||
verbose "...Done"
|
verbose "...Done"
|
||||||
|
|
||||||
verbose "\n * Copying pypo files..."
|
verbose "\n * Copying pypo files..."
|
||||||
|
@ -359,13 +353,7 @@ cp -R ${AIRTIMEROOT}/python_apps/pypo/pypo /usr/lib/airtime/pypo/bin/
|
||||||
verbose "...Done"
|
verbose "...Done"
|
||||||
|
|
||||||
verbose "\n * Installing pypo..."
|
verbose "\n * Installing pypo..."
|
||||||
if [ -z web_root ]; then
|
python ${AIRTIMEROOT}/python_apps/pypo/setup.py install
|
||||||
python ${web_root}/python_apps/pypo/setup.py install
|
|
||||||
elif [ "$in_place" = "t" ]; then
|
|
||||||
python ${AIRTIMEROOT}/python_apps/pypo/setup.py install
|
|
||||||
else
|
|
||||||
python /usr/share/airtime/python_apps/pypo/setup.py install
|
|
||||||
fi
|
|
||||||
verbose "...Done"
|
verbose "...Done"
|
||||||
|
|
||||||
verbose "\n * Creating liquidsoap symlink..."
|
verbose "\n * Creating liquidsoap symlink..."
|
||||||
|
@ -431,7 +419,7 @@ fi
|
||||||
# PHP Config File for Apache
|
# PHP Config File for Apache
|
||||||
if [ ! -f "/etc/php5/apache2/conf.d/airtime.ini" ]; then
|
if [ ! -f "/etc/php5/apache2/conf.d/airtime.ini" ]; then
|
||||||
verbose "\n * Creating Airtime PHP config for Apache..."
|
verbose "\n * Creating Airtime PHP config for Apache..."
|
||||||
cp ${SCRIPT_DIR}/php/airtime.ini /etc/php5/apache2/conf.d/airtime.ini
|
cp ${SCRIPT_DIR}/installer/php/airtime.ini /etc/php5/apache2/conf.d/airtime.ini
|
||||||
else
|
else
|
||||||
verbose "\nAirtime PHP config for Apache already exists, skipping"
|
verbose "\nAirtime PHP config for Apache already exists, skipping"
|
||||||
fi
|
fi
|
||||||
|
@ -524,7 +512,7 @@ if [ "$install_dependencies" = "t" ]; then
|
||||||
loud "-----------------------------------------------------"
|
loud "-----------------------------------------------------"
|
||||||
|
|
||||||
verbose "\n * Reading requirements-${dist,,}-${code,,}.apt..."
|
verbose "\n * Reading requirements-${dist,,}-${code,,}.apt..."
|
||||||
loudCmd "apt-get -y -m --force-yes install $(grep -vE '^\s*#' ${SCRIPT_DIR}/lib/requirements-${dist,,}-${code,,}.apt | tr '\n' ' ')"
|
loudCmd "apt-get -y -m --force-yes install $(grep -vE '^\s*#' ${SCRIPT_DIR}/installer/lib/requirements-${dist,,}-${code,,}.apt | tr '\n' ' ')"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
verbose "\n * Restarting apache..."
|
verbose "\n * Restarting apache..."
|
|
@ -51,7 +51,7 @@ lxc-attach -n ${name} -- git -C /usr/share/Airtime checkout 2.5.x-installer-moni
|
||||||
echo "...Done"
|
echo "...Done"
|
||||||
|
|
||||||
echo -e "\n * Running installer..."
|
echo -e "\n * Running installer..."
|
||||||
lxc-attach -n ${name} -e -- /usr/share/Airtime/installer/install -ifapdIv
|
lxc-attach -n ${name} -e -- /usr/share/Airtime/install -ifapdIv
|
||||||
echo "...Done"
|
echo "...Done"
|
||||||
|
|
||||||
IP=$(lxc-info -i -n ${name} -H)
|
IP=$(lxc-info -i -n ${name} -H)
|
||||||
|
|
|
@ -1,94 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
### BEGIN INIT INFO
|
|
||||||
# Provides: airtime-liquidsoap
|
|
||||||
# Required-Start: $local_fs $remote_fs $network $syslog $all
|
|
||||||
# Required-Stop: $local_fs $remote_fs $network $syslog
|
|
||||||
# Default-Start: 2 3 4 5
|
|
||||||
# Default-Stop: 0 1 6
|
|
||||||
# Short-Description: Liquidsoap daemon
|
|
||||||
### END INIT INFO
|
|
||||||
|
|
||||||
USERID=WEB_USER
|
|
||||||
GROUPID=WEB_USER
|
|
||||||
NAME="Liquidsoap Playout Engine"
|
|
||||||
|
|
||||||
DAEMON=/usr/lib/airtime/pypo/bin/airtime-liquidsoap
|
|
||||||
PIDFILE=/var/run/airtime/airtime-liquidsoap.pid
|
|
||||||
EXEC='/usr/bin/airtime-liquidsoap'
|
|
||||||
|
|
||||||
start () {
|
|
||||||
mkdir -p /var/log/airtime/pypo-liquidsoap
|
|
||||||
chown $USERID:$GROUPID /var/log/airtime/pypo-liquidsoap
|
|
||||||
|
|
||||||
chown $USERID:$GROUPID /etc/airtime
|
|
||||||
touch /etc/airtime/liquidsoap.cfg
|
|
||||||
chown $USERID:$GROUPID /etc/airtime/liquidsoap.cfg
|
|
||||||
|
|
||||||
touch $PIDFILE
|
|
||||||
chown $USERID:$GROUPID $PIDFILE
|
|
||||||
|
|
||||||
#start-stop-daemon --start --quiet --chuid $USERID:$GROUPID \
|
|
||||||
#--pidfile $PIDFILE --nicelevel -15 --startas $DAEMON
|
|
||||||
start-stop-daemon --start --quiet --chuid $USERID:$GROUPID \
|
|
||||||
--startas $DAEMON --exec $EXEC
|
|
||||||
}
|
|
||||||
|
|
||||||
stop () {
|
|
||||||
timeout --version >/dev/null 2>&1
|
|
||||||
RESULT="$?"
|
|
||||||
|
|
||||||
#send term signal after 10 seconds
|
|
||||||
if [ "$RESULT" = "0" ]; then
|
|
||||||
timeout -s9 10s /usr/lib/airtime/airtime_virtualenv/bin/python \
|
|
||||||
/usr/lib/airtime/pypo/bin/liquidsoap_scripts/liquidsoap_prepare_terminate.py
|
|
||||||
else
|
|
||||||
#some earlier versions of Ubuntu (Lucid) had a different timeout
|
|
||||||
#command that takes different input parameters.
|
|
||||||
timeout 10 /usr/lib/airtime/airtime_virtualenv/bin/python \
|
|
||||||
/usr/lib/airtime/pypo/bin/liquidsoap_scripts/liquidsoap_prepare_terminate.py
|
|
||||||
fi
|
|
||||||
# Send TERM after 5 seconds, wait at most 30 seconds.
|
|
||||||
#start-stop-daemon --stop --oknodo --retry=TERM/10/KILL/5 --quiet --pidfile $PIDFILE
|
|
||||||
start-stop-daemon --stop --oknodo --retry=TERM/10/KILL/5 --quiet --exec $EXEC
|
|
||||||
|
|
||||||
rm -f $PIDFILE
|
|
||||||
sleep 2
|
|
||||||
}
|
|
||||||
|
|
||||||
case "${1:-''}" in
|
|
||||||
'stop')
|
|
||||||
echo -n "Stopping $NAME: "
|
|
||||||
stop
|
|
||||||
echo "Done."
|
|
||||||
;;
|
|
||||||
'start')
|
|
||||||
echo -n "Starting $NAME: "
|
|
||||||
start
|
|
||||||
echo "Done."
|
|
||||||
;;
|
|
||||||
'restart')
|
|
||||||
echo -n "Restarting $NAME: "
|
|
||||||
stop
|
|
||||||
start
|
|
||||||
echo "Done."
|
|
||||||
;;
|
|
||||||
|
|
||||||
'status')
|
|
||||||
if [ -f "$PIDFILE" ]; then
|
|
||||||
pid=`cat $PIDFILE`
|
|
||||||
if [ -d "/proc/$pid" ]; then
|
|
||||||
echo "$NAME is running"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
echo "$NAME is not running"
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
|
|
||||||
*) # no parameter specified
|
|
||||||
echo "Usage: $SELF start|stop|restart|status"
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
|
|
||||||
esac
|
|
|
@ -1,61 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
### BEGIN INIT INFO
|
|
||||||
# Provides: airtime-playout
|
|
||||||
# Required-Start: $local_fs $remote_fs $network $syslog $all
|
|
||||||
# Required-Stop: $local_fs $remote_fs $network $syslog
|
|
||||||
# Default-Start: 2 3 4 5
|
|
||||||
# Default-Stop: 0 1 6
|
|
||||||
# Short-Description: Manage airtime-playout daemon
|
|
||||||
### END INIT INFO
|
|
||||||
|
|
||||||
USERID=WEB_USER
|
|
||||||
NAME="Airtime Scheduler"
|
|
||||||
|
|
||||||
DAEMON=/usr/lib/airtime/pypo/bin/airtime-playout
|
|
||||||
PIDFILE=/var/run/airtime/airtime-playout.pid
|
|
||||||
|
|
||||||
start () {
|
|
||||||
mkdir -p /var/log/airtime/pypo
|
|
||||||
|
|
||||||
start-stop-daemon --start --background --quiet --chuid $USERID:$USERID \
|
|
||||||
--make-pidfile --pidfile $PIDFILE --startas $DAEMON
|
|
||||||
}
|
|
||||||
|
|
||||||
stop () {
|
|
||||||
# Send TERM after 5 seconds, wait at most 30 seconds.
|
|
||||||
start-stop-daemon --stop --oknodo --retry TERM/5/0/30 --quiet --pidfile $PIDFILE
|
|
||||||
rm -f $PIDFILE
|
|
||||||
}
|
|
||||||
|
|
||||||
case "${1:-''}" in
|
|
||||||
'start')
|
|
||||||
# start commands here
|
|
||||||
echo -n "Starting $NAME: "
|
|
||||||
start
|
|
||||||
echo "Done."
|
|
||||||
;;
|
|
||||||
'stop')
|
|
||||||
# stop commands here
|
|
||||||
echo -n "Stopping $NAME: "
|
|
||||||
stop
|
|
||||||
echo "Done."
|
|
||||||
;;
|
|
||||||
'restart')
|
|
||||||
# restart commands here
|
|
||||||
echo -n "Restarting $NAME: "
|
|
||||||
stop
|
|
||||||
start
|
|
||||||
echo "Done."
|
|
||||||
;;
|
|
||||||
|
|
||||||
'status')
|
|
||||||
# status commands here
|
|
||||||
/usr/bin/airtime-check-system
|
|
||||||
;;
|
|
||||||
*) # no parameter specified
|
|
||||||
echo "Usage: $SELF start|stop|restart|status"
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
|
|
||||||
esac
|
|
|
@ -0,0 +1,51 @@
|
||||||
|
#!/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
|
||||||
|
|
||||||
|
SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"
|
||||||
|
AIRTIMEROOT=${SCRIPT_DIR}
|
||||||
|
|
||||||
|
FILES=(
|
||||||
|
"/etc/airtime"
|
||||||
|
"/var/log/airtime"
|
||||||
|
"/usr/lib/airtime"
|
||||||
|
"/usr/share/airtime"
|
||||||
|
"/etc/init/airtime*"
|
||||||
|
"/usr/bin/airtime*"
|
||||||
|
"/etc/apache2/sites-available/airtime*"
|
||||||
|
"pip airtime-playout"
|
||||||
|
"pip airtime-media-monitor"
|
||||||
|
)
|
||||||
|
|
||||||
|
echo -e "The following files, directories, and services will be removed:\n"
|
||||||
|
for i in ${FILES[*]}; do
|
||||||
|
echo $i
|
||||||
|
done
|
||||||
|
|
||||||
|
echo -e "\nThis will permanently remove Airtime and all related files from your computer. \
|
||||||
|
Any files in Airtime directories will be deleted. Are you sure you want to proceed? (Y/n): \c"
|
||||||
|
read IN
|
||||||
|
if [[ ! ( "$IN" = "y" || "$IN" = "Y" ) ]]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Uninstalling Airtime..."
|
||||||
|
rm -rf /etc/airtime
|
||||||
|
rm -rf /var/log/airtime/
|
||||||
|
rm -rf /usr/lib/airtime/
|
||||||
|
|
||||||
|
rm -rf /usr/share/airtime
|
||||||
|
|
||||||
|
rm -f /etc/init/airtime*
|
||||||
|
rm -f /usr/bin/airtime*
|
||||||
|
|
||||||
|
rm -f /etc/apache2/sites-enabled/airtime*
|
||||||
|
rm -f /etc/apache2/sites-available/airtime*
|
||||||
|
|
||||||
|
pip uninstall -y airtime-playout airtime-media-monitor
|
||||||
|
echo "...Done"
|
Loading…
Reference in New Issue