Commit eaded178 authored by ale's avatar ale

update Debian package metadata for jessie

parent c494b7d5
# Defaults for autoradio initscript
# sourced by /etc/init.d/autoradio
# installed at /etc/default/autoradio by the maintainer scripts
#
# This is a POSIX shell fragment
#
# Set your base domain name here.
DOMAIN=""
#DOMAIN="--domain="
# Set your public IP if necessary (otherwise we'll try to resolve
# if your fully-qualified hostname).
#PUBLIC_IP=""
# Set your public IP if necessary.
#PUBLIC_IP="--ip="
# Name of the outbound network interface (if unset, we'll try to
# figure it out automatically based on the value of PUBLIC_IP).
#INTERFACE="eth0"
# Name of the outbound network interface (if unset, radiod will try to
# figure it out automatically).
#INTERFACE="--interface=eth0"
# Set the etcd servers to connect to (default: etcd.$DOMAIN).
# Set the etcd servers to connect to (default: localhost:2379).
#ETCD_SERVER=""
# Additional options that are passed to specific daemons.
#RADIOD_OPTIONS="--bwlimit=1000"
#REDIRECTORD_OPTIONS=""
RADIOD_OPTIONS="${PUBLIC_IP} ${INTERFACE}"
REDIRECTORD_OPTIONS="${PUBLIC_IP} ${DOMAIN}"
[Unit]
Description=autoradio Icecast supervisor
After=etcd.service
Wants=etcd.service
[Service]
User=icecast2
EnvironmentFile=-/etc/default/autoradio
ExecStart=/usr/sbin/radiod ${RADIOD_OPTIONS}
Restart=always
[Install]
WantedBy=multi-user.target
\ No newline at end of file
[Unit]
Description=autoradio front-end
After=etcd.service
Wants=etcd.service
[Service]
User=nobody
EnvironmentFile=-/etc/default/autoradio
ExecStart=/usr/sbin/redirectord ${REDIRECTORD_OPTIONS}
Restart=always
[Install]
WantedBy=multi-user.target
\ No newline at end of file
......@@ -2,14 +2,14 @@ Source: autoradio
Section: net
Priority: extra
Maintainer: ale <ale@incal.net>
Build-Depends: debhelper (>= 8.0.0)
Build-Depends: debhelper (>= 8.0.0), dh-systemd
Standards-Version: 3.9.4
Homepage: https://git.autistici.org/ale/autoradio
Package: autoradio
Architecture: any
Depends: icecast2, liquidsoap, liquidsoap-plugin-lame, liquidsoap-plugin-icecast,
liquidsoap-plugin-mad, liquidsoap-plugin-vorbis, runit, libcap2-bin,
liquidsoap-plugin-mad, liquidsoap-plugin-vorbis, libcap2-bin,
${shlibs:Depends}, ${misc:Depends}
Description: Icecast clustering software.
Runs icecast2 in a cluster controlled by etcd.
......
......@@ -19,23 +19,24 @@ export DH_OPTIONS
GOPKG = git.autistici.org/ale/autoradio
DESTDIR = $(CURDIR)/debian/autoradio
SVCDIR = $(DESTDIR)/etc/svc
%:
dh $@
dh $@ --with systemd
override_dh_install:
# Build the binary
(mkdir -p $(CURDIR)/build/src/$(dir $(GOPKG)) && \
ln -s $(CURDIR) $(CURDIR)/build/src/$(GOPKG) && \
cd $(CURDIR)/build/src/$(GOPKG) && \
env GOPATH=$(CURDIR)/build PATH=$$PATH:/usr/local/bin go install -v ./...)
install -m 755 -o root -g root -d $(DESTDIR)/usr/bin
(tmpdir=$$(mktemp -d) ; \
export GOPATH=$$tmpdir ; unset GOBIN ; \
mkdir -p $$tmpdir/src/$(dir $(GOPKG)) ; \
ln -s $(CURDIR) $$tmpdir/src/$(GOPKG) ; \
cd $$tmpdir/src/$(GOPKG) && go install -v ./... && \
for bin in radiod redirectord radioctl ; do \
install -m 755 -o root -g root $$tmpdir/bin/$$bin $(DESTDIR)/usr/bin/$$bin ; \
done ; \
rm -fr $$tmpdir)
(for bin in radioctl radiobench ; do \
install -m 755 -o root -g root $(CURDIR)/build/bin/$$bin $(DESTDIR)/usr/bin/$$bin ; \
done)
install -m 755 -o root -g root -d $(DESTDIR)/usr/sbin
(for bin in redirectord radiod ; do \
install -m 755 -o root -g root $(CURDIR)/build/bin/$$bin $(DESTDIR)/usr/sbin/$$bin ; \
done)
# Install the static files and templates for the HTTP dashboard.
install -d -m 755 -o root -g root $(DESTDIR)/usr/share/autoradio
......@@ -48,21 +49,15 @@ override_dh_install:
install -o root -g root -m 644 $$f $(DESTDIR)/usr/share/autoradio/htdocs/templates/ ; \
done)
# Install runit service runners.
install -d -m 755 -o root -g root $(SVCDIR)
install -m 644 -o root -g root $(CURDIR)/debian/services/lib.sh \
$(DESTDIR)/usr/share/autoradio/lib.sh
(for f in radiod redirectord ; do \
install -d -o root -g root $(SVCDIR)/$$f ; \
install -d -o root -g root $(SVCDIR)/$$f/log ; \
install -m 755 -o root -g root $(CURDIR)/debian/services/$$f \
$(SVCDIR)/$$f/run ; \
echo '#!/bin/sh\nexec chpst -u log svlogd -tt /var/log/'$$f > \
$(SVCDIR)/$$f/log/run ; \
chmod 0755 $(SVCDIR)/$$f/log/run ; \
done)
# Icecast2 status XSL template.
install -d -m 755 -o root -g root $(DESTDIR)/usr/share/icecast2/web
install -m 644 -o root -g root $(CURDIR)/debian/status.xsl \
$(DESTDIR)/usr/share/icecast2/web/status-autoradio.xsl
override_dh_clean:
-rm -fr build
dh_clean
override_dh_systemd_enable:
dh_systemd_enable --name=radiod
dh_systemd_enable --name=redirectord
# Common functions for the 'autoradio' startup scripts.
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:$PATH
export PATH
test -e /etc/default/autoradio && . /etc/default/autoradio
if [ -z "${DOMAIN}" ]; then
echo "You must set DOMAIN in /etc/default/autoradio!" 1>&2
exit 1
fi
resolveall() {
local name="$1"
local port="$2"
getent hosts ${name} | awk "{print \$1 \":${port}\"}"
}
commaseplist() {
local out=
for arg in "$@" ; do
out="${out}${out:+,}${arg}"
done
echo "${out}"
}
set_public_ip() {
# Try to guess the public IP of this host if unset, resolving the
# fully-qualified host name.
if [ -z "${PUBLIC_IP}" ]; then
PUBLIC_IP=$(getent hosts $(hostname -f) | awk '{print $1}' | head -1)
fi
if [ -z "${PUBLIC_IP}" ]; then
PUBLIC_IP=127.0.0.1
fi
}
set_interface() {
# Try to guess the network interface for PUBLIC_IP.
if [ -z "${INTERFACE}" ]; then
INTERFACE=$(/sbin/ip -o addr show to ${PUBLIC_IP} | awk '{print $2}')
fi
if [ -z "${INTERFACE}" ]; then
echo "Warning: could not autodetect network interface for ${PUBLIC_IP}" 1>&2
INTERFACE=eth0
fi
}
set_etcd_params() {
local default_etcd_server="etcd.${DOMAIN}"
ETCD_SERVER="${ETCD_SERVER:-${default_etcd_server}}"
local server_ips=$(commaseplist localhost:2379 $(resolveall ${ETCD_SERVER} 2379))
ETCD_OPTIONS="${ETCD_OPTIONS} --etcd-servers=${server_ips}"
}
#!/bin/sh
. /usr/share/autoradio/lib.sh
set_public_ip
set_interface
set_etcd_params
exec chpst -u icecast2 \
radiod --ip=${PUBLIC_IP} --interface=${INTERFACE} ${ETCD_OPTIONS} ${RADIOD_OPTIONS} \
2>&1
#!/bin/sh
. /usr/share/autoradio/lib.sh
set_public_ip
set_etcd_params
exec chpst -u nobody \
redirectord --ip=${PUBLIC_IP} --domain=${DOMAIN} \
${ETCD_OPTIONS} ${REDIRECTORD_OPTIONS} \
2>&1
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment