Skip to content
Snippets Groups Projects
Commit 9464d22b authored by ale's avatar ale
Browse files

various fixes to packaging for Jessie

- Changed package name to autoradio-server to avoid conflicts;
- fixed systemd service files and defaults;
- added sudo configuration to restart icecast2;
- removed obsolete prerm/postrm scripts.
parent f9a9a9ef
No related branches found
No related tags found
No related merge requests found
......@@ -6,8 +6,9 @@ Wants=etcd.service
[Service]
User=icecast2
EnvironmentFile=-/etc/default/autoradio
ExecStart=/usr/sbin/radiod ${RADIOD_OPTIONS}
ExecStart=/usr/sbin/radiod $ETCD_SERVER $PUBLIC_IP $INTERFACE $RADIOD_OPTIONS
Restart=always
[Install]
WantedBy=multi-user.target
\ No newline at end of file
WantedBy=multi-user.target
......@@ -6,8 +6,10 @@ Wants=etcd.service
[Service]
User=nobody
EnvironmentFile=-/etc/default/autoradio
ExecStart=/usr/sbin/redirectord ${REDIRECTORD_OPTIONS}
ExecStart=/usr/sbin/redirectord $ETCD_SERVER $PUBLIC_IP $DOMAIN $REDIRECTORD_OPTIONS
CapabilityBoundingSet=CAP_NET_BIND_SERVICE
Restart=always
[Install]
WantedBy=multi-user.target
\ No newline at end of file
WantedBy=multi-user.target
......@@ -14,5 +14,5 @@
# Additional options that are passed to specific daemons.
#RADIOD_OPTIONS="--bwlimit=1000"
RADIOD_OPTIONS="${ETCD_SERVER} ${PUBLIC_IP} ${INTERFACE}"
REDIRECTORD_OPTIONS="${ETCD_SERVER} ${PUBLIC_IP} ${DOMAIN}"
#RADIOD_OPTIONS="--interface=eth0"
REDIRECTORD_OPTIONS=""
......@@ -6,10 +6,10 @@ Build-Depends: debhelper (>= 8.0.0), dh-systemd
Standards-Version: 3.9.4
Homepage: https://git.autistici.org/ale/autoradio
Package: autoradio
Package: autoradio-server
Architecture: any
Depends: icecast2, liquidsoap, liquidsoap-plugin-lame, liquidsoap-plugin-icecast,
liquidsoap-plugin-mad, liquidsoap-plugin-vorbis, libcap2-bin,
liquidsoap-plugin-mad, liquidsoap-plugin-vorbis, libcap2-bin, sudo,
${shlibs:Depends}, ${misc:Depends}
Description: Icecast clustering software.
Runs icecast2 in a cluster controlled by etcd.
......
......@@ -18,39 +18,14 @@ set -e
# the debian-policy package
create_users() {
if ! getent passwd log >/dev/null ; then
adduser --system --home /var/log --no-create-home --group log
fi
}
create_log_dir() {
logdir=/var/log
for d in radiod redirectord ; do
mkdir -p ${logdir}/${d}
chown log:log ${logdir}/${d}
done
}
activate_services() {
for svc in $@ ; do
test -e /etc/service/$svc \
|| ln -s /etc/svc/$svc /etc/service/$svc
sv start $svc || true
done
}
set_capabilities() {
setcap cap_net_bind_service=+ep /usr/bin/redirectord
setcap cap_net_bind_service=+ep /usr/sbin/redirectord
}
case "$1" in
configure)
create_users
create_log_dir
set_capabilities
activate_services radiod redirectord
;;
abort-upgrade|abort-remove|abort-deconfigure)
......
#!/bin/sh
# postrm script for autoradio
set -e
. /usr/share/debconf/confmodule
case "$1" in
remove)
# Clear logs.
/bin/rm -f -r /var/log/radiod
/bin/rm -f -r /var/log/redirectord
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0
#!/bin/sh
# prerm script for autoradio
#
# see: dh_installdeb(1)
set -e
. /usr/share/debconf/confmodule
# summary of how this script can be called:
# * <prerm> `remove'
# * <old-prerm> `upgrade' <new-version>
# * <new-prerm> `failed-upgrade' <old-version>
# * <conflictor's-prerm> `remove' `in-favour' <package> <new-version>
# * <deconfigured's-prerm> `deconfigure' `in-favour'
# <package-being-installed> <version> `removing'
# <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
case "$1" in
remove|upgrade|deconfigure)
# Stop the services, if they are still running.
sv stop radiod || true
sv stop redirectord || true
# Disable runit services.
/bin/rm -f /etc/service/radiod 2>/dev/null || true
/bin/rm -f /etc/service/redirectord 2>/dev/null || true
;;
failed-upgrade)
;;
*)
echo "prerm called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0
......@@ -18,7 +18,7 @@ export DH_OPTIONS
GOPKG = git.autistici.org/ale/autoradio
DESTDIR = $(CURDIR)/debian/autoradio
DESTDIR = $(CURDIR)/debian/autoradio-server
%:
dh $@ --with systemd
......@@ -54,10 +54,19 @@ override_dh_install:
install -m 644 -o root -g root $(CURDIR)/debian/status.xsl \
$(DESTDIR)/usr/share/icecast2/web/status-autoradio.xsl
# Install a sudoers rule for systemctl.
install -d -m 755 -o root -g root $(DESTDIR)/etc/sudoers.d
echo "icecast2 ALL = NOPASSWD: /bin/systemctl [a-z]* icecast2.service" \
> $(DESTDIR)/etc/sudoers.d/autoradio
chmod 0440 $(DESTDIR)/etc/sudoers.d/autoradio
override_dh_clean:
-rm -fr build
dh_clean
override_dh_installinit:
dh_installinit --name=autoradio
override_dh_systemd_enable:
dh_systemd_enable --name=radiod
dh_systemd_enable --name=redirectord
# Vagrantfile for a test 3-node autoradio cluster.
#
# By default it will pull autoradio packages from the public
# repository. Set the environment variable LOCAL to a non-empty value
# if you want to use local packages, in which case the 'etcd' and
# 'autoradio' packages should be placed in the same directory as this
# file.
# repository. If you want to use locally-built packages, copy the
# 'etcd' and 'autoradio-server' packages to this directory and run
# 'dpkg-scanpackages -m . >Packages'.
#
# If you have an APT proxy available, you can set the APT_PROXY environment
# variable to its host:port address, and the VMs will use it to retrieve
# Debian packages. This will make the setup step faster.
# If you have an APT proxy available, you can set the APT_PROXY
# environment variable to its host:port address, and the VMs will use
# it to retrieve Debian packages. This will make the setup step
# faster.
API_VERSION = "2"
......@@ -51,11 +51,7 @@ Vagrant.configure(API_VERSION) do |config|
end
config.vm.provision "shell" do |s|
if ENV['LOCAL'].nil?
s.path = "bootstrap.sh"
else
s.path = "bootstrap-local.sh"
end
s.path = "bootstrap.sh"
s.args = "autora.dio"
end
......
#!/bin/bash
set -e
cat >/etc/default/icecast2 <<EOF
CONFIGFILE="/etc/icecast2/icecast.xml"
USERID=icecast2
GROUPID=icecast
ENABLE=true
EOF
most_recent_match() {
local pattern="$1"
ls -1rv ${pattern} | head -1
}
# Install the required packages.
export DEBIAN_FRONTEND=noninteractive
apt-get -q update
yes N 2>/dev/null | apt-get install -q -y runit icecast2 libcap2-bin liquidsoap
etcd_pkg=$(most_recent_match '/vagrant/etcd_*.deb')
echo "Found etcd package: ${etcd_pkg}" >&2
dpkg -i ${etcd_pkg}
autoradio_pkg=$(most_recent_match '/vagrant/autoradio_*.deb')
echo "Found autoradio package: ${autoradio_pkg}" >&2
dpkg -i ${autoradio_pkg}
# Install the configuration.
DOMAIN="${DOMAIN:-$1}"
if [ -n "${DOMAIN}" ]; then
echo "Autoconfigured with domain: ${DOMAIN}" >&2
echo "DOMAIN=${DOMAIN}" > /etc/default/autoradio
fi
echo "REDIRECTORD_OPTIONS=\"--enable-icecast-proxy\"" >> /etc/default/autoradio
echo "All done (?)" >&2
exit 0
......@@ -2,9 +2,31 @@
set -e
# If there is a /vagrant/Packages file, pull packages from there
# (assuming they have been built locally). Otherwise, use the default
# public repository.
default_repo="deb http://www.incal.net/ale/debian autoradio/"
local_repo="deb file:///vagrant ./"
if [ -e /vagrant/Packages ]; then
echo "Using local package repository from /vagrant" >&2
repo="${local_repo}"
else
echo "Using default package repository" >&2
repo="${default_repo}"
fi
# Install our Debian apt repository.
echo 'deb http://www.incal.net/ale/debian autoradio/' > \
/etc/apt/sources.list.d/autoradio.list
echo "${repo}" > /etc/apt/sources.list.d/autoradio.list
# Install the configuration.
DOMAIN="${DOMAIN:-$1}"
if [ -z "${DOMAIN}" ]; then
echo "Must set \$DOMAIN" >&2
exit 1
fi
cat >/etc/default/autoradio <<EOF
DOMAIN="--domain=${DOMAIN}"
EOF
cat >/etc/default/icecast2 <<EOF
CONFIGFILE="/etc/icecast2/icecast.xml"
......@@ -15,15 +37,8 @@ EOF
# Install the required packages.
export DEBIAN_FRONTEND=noninteractive
apt-get update -q
yes n | apt-get install -q -y --force-yes etcd autoradio
# Install the configuration.
DOMAIN="${DOMAIN:-$1}"
if [ -n "${DOMAIN}" ]; then
echo "Autoconfigured with domain: ${DOMAIN}" 1>&2
echo "DOMAIN=${DOMAIN}" > /etc/default/autoradio
fi
apt-get -qq update
yes n | apt-get install -y --force-yes -q etcd autoradio-server
echo "All done (?)" 1>&2
exit 0
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment