Drop SysV support

This commit is contained in:
jo 2021-09-02 14:08:20 +02:00
parent 5c61861b06
commit 3da0310173
9 changed files with 30 additions and 701 deletions

View file

@ -1,79 +0,0 @@
#!/usr/bin/env 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: Manage airtime-liquidsoap daemon
### END INIT INFO
USERID=www-data
GROUPID=www-data
NAME=airtime-liquidsoap
DAEMON=/usr/bin/$NAME
PIDFILE=/var/run/$NAME.pid
# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0
# Read configuration variable file if it is present
# shellcheck disable=SC1090
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh
# Define LSB log_* functions.
# Depend on lsb-base (>= 3.2-14) to ensure that this file is present
# and status_of_proc is working.
. /lib/lsb/init-functions
start() {
start-stop-daemon --start --background --quiet --chuid $USERID:$GROUPID \
--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."
;;
'force-reload')
# reload commands here
echo -n "Reloading $NAME: "
stop
start
echo "Done."
;;
'status')
status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
;;
*) # no parameter specified
echo "Usage: $SELF start|stop|restart|status"
exit 1
;;
esac

View file

@ -1,79 +0,0 @@
#!/usr/bin/env 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=www-data
GROUPID=www-data
NAME=airtime-playout
DAEMON=/usr/bin/$NAME
PIDFILE=/var/run/$NAME.pid
# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0
# Read configuration variable file if it is present
# shellcheck disable=SC1090
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh
# Define LSB log_* functions.
# Depend on lsb-base (>= 3.2-14) to ensure that this file is present
# and status_of_proc is working.
. /lib/lsb/init-functions
start() {
start-stop-daemon --start --background --quiet --chuid $USERID:$GROUPID \
--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."
;;
'force-reload')
# reload commands here
echo -n "Reloading $NAME: "
stop
start
echo "Done."
;;
'status')
status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
;;
*) # no parameter specified
echo "Usage: $SELF start|stop|restart|status"
exit 1
;;
esac

View file

@ -1,38 +1,10 @@
from __future__ import print_function
import os
import sys
from subprocess import call
from setuptools import setup
script_path = os.path.dirname(os.path.realpath(__file__))
print(script_path)
os.chdir(script_path)
# Change directory since setuptools uses relative paths
os.chdir(os.path.dirname(os.path.realpath(__file__)))
# Allows us to avoid installing the upstart init script when deploying on Airtime Pro:
if "--no-init-script" in sys.argv:
data_files = []
sys.argv.remove("--no-init-script") # super hax
else:
pypo_files = []
for root, dirnames, filenames in os.walk("pypo"):
for filename in filenames:
pypo_files.append(os.path.join(root, filename))
data_files = [
("/etc/init", ["install/upstart/airtime-playout.conf.template"]),
("/etc/init", ["install/upstart/airtime-liquidsoap.conf.template"]),
("/etc/init.d", ["install/sysvinit/airtime-playout"]),
("/etc/init.d", ["install/sysvinit/airtime-liquidsoap"]),
("/var/log/airtime/pypo", []),
("/var/log/airtime/pypo-liquidsoap", []),
("/var/tmp/airtime/pypo", []),
("/var/tmp/airtime/pypo/cache", []),
("/var/tmp/airtime/pypo/files", []),
("/var/tmp/airtime/pypo/tmp", []),
]
print(data_files)
setup(
name="airtime-playout",
@ -41,9 +13,18 @@ setup(
url="http://github.com/sourcefabric/Airtime",
author="sourcefabric",
license="AGPLv3",
packages=["pypo", "pypo.media", "pypo.media.update", "liquidsoap"],
packages=[
"pypo",
"pypo.media",
"pypo.media.update",
"liquidsoap",
],
package_data={"": ["**/*.liq", "*.cfg", "*.types"]},
scripts=["bin/airtime-playout", "bin/airtime-liquidsoap", "bin/pyponotify"],
scripts=[
"bin/airtime-playout",
"bin/airtime-liquidsoap",
"bin/pyponotify",
],
install_requires=[
"amqplib",
"anyjson",
@ -61,13 +42,4 @@ setup(
"packaging",
],
zip_safe=False,
data_files=data_files,
)
# Reload the initctl config so that playout services works
if data_files:
print("Reloading initctl configuration")
# call(['initctl', 'reload-configuration'])
print(
'Run "sudo service airtime-playout start" and "sudo service airtime-liquidsoap start"'
)