Commit 55e3af32 authored by ale's avatar ale
Browse files

add debian package metadata (deploy using "runit")

parent e3e5db7c
The Debian Package radioai
----------------------------
Icecast clustering software.
-- ale <ale@incal.net> Thu, 07 Nov 2013 09:00:44 +0000
radioai (0.1) unstable; urgency=low
* Initial Release.
-- ale <ale@incal.net> Thu, 07 Nov 2013 09:00:44 +0000
Source: radioai
Section: net
Priority: extra
Maintainer: ale <ale@incal.net>
Build-Depends: debhelper (>= 8.0.0)
Standards-Version: 3.9.4
Homepage: https://git.autistici.org/ale/radioai
Package: radioai
Architecture: any
Depends: icecast2, runit, libcap2-bin, ${shlibs:Depends}, ${misc:Depends}
Description: Icecast clustering software.
Runs icecast2 in a cluster controlled by etcd.
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: radioai
Source: <url://example.com>
Files: *
Copyright: <years> <put author's name and email here>
<years> <likewise for another author>
License: BSD-3-Clause
Files: debian/*
Copyright: 2013 ale <ale@incal.net>
License: BSD-3-Clause
License: BSD-3-Clause
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE HOLDERS OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# Please also look if there are files or directories which have a
# different copyright/license attached and list them here.
# Please avoid to pick license terms that are more restrictive than the
# packaged work, as it may make Debian's contributions unacceptable upstream.
#!/bin/sh
# postinst script for radioai
#
# see: dh_installdeb(1)
set -e
# summary of how this script can be called:
# * <postinst> `configure' <most-recently-configured-version>
# * <old-postinst> `abort-upgrade' <new version>
# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
# <new-version>
# * <postinst> `abort-remove'
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
# <failed-install-package> <version> `removing'
# <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
create_users() {
if ! getent passwd log 2>/dev/null ; then
adduser --system --home /var/log --no-create-home --group log
fi
}
create_log_dir() {
logdir=/var/log/radioai
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/radioai/svc/$svc /etc/service/$svc
done
}
case "$1" in
configure)
create_users
create_log_dir
activate_services radiod redirectord
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst 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
# Defaults for radioai initscript
# sourced by /etc/init.d/radioai
# installed at /etc/default/radioai by the maintainer scripts
#
# This is a POSIX shell fragment
#
# Set your base domain name here.
DOMAIN=""
# Set your public IP if necessary (otherwise we'll try to resolve
# if your fully-qualified hostname).
#PUBLIC_IP=""
# Set the etcd servers to connect to (default: etcd.$DOMAIN).
#ETCD_SERVER=""
# Additional options that are passed to the daemons.
DAEMON_OPTS=""
#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
#
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.
#
# Modified to make a template file for a multi-binary package with separated
# build-arch and build-indep targets by Bill Allombert 2001
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
# This has to be exported to make some magic below work.
export DH_OPTIONS
GOPKG = git.autistici.org/ale/radioai
DESTDIR = $(CURDIR)/debian/radioai
SVCDIR = $(DESTDIR)/etc/radioai/svc
%:
dh $@
override_dh_install:
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 && \
go get -d -v ./$(GOPKG)/... && go install -v ./$(GOPKG)/... && \
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)
install -d -m 755 -o root -g root $(SVCDIR)
install -d -m 755 -o root -g root $(DESTDIR)/usr/share/radioai
install -m 644 -o root -g root debian/services/lib.sh \
$(DESTDIR)/usr/share/radioai/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 debian/services/$$f \
$(SVCDIR)/$$f/run ; \
chmod 0755 $(SVCDIR)/$$f/log/run ; \
echo -e '#!/bin/sh\nexec chpst -u log svlogd -tt /var/log/radioai/'$$f > \
$(SVCDIR)/$$f/log/run ; \
done)
# Common functions for the 'radioai' startup scripts.
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:$PATH
export PATH
test -e /etc/default/radioai && . /etc/default/radioai
if [ -z "${DOMAIN}" ]; then
echo "You must set DOMAIN in /etc/default/radioai!" 1>&2
exit 1
fi
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_etcd_params() {
local default_etcd_server="etcd.${DOMAIN}"
ETCD_SERVER="${ETCD_SERVER:-${default_etcd_server}}"
ETCD_OPTIONS="${ETCD_OPTIONS} --etcd-server=${ETCD_SERVER}"
}
#!/bin/sh
. /usr/share/radiod/lib.sh
set_public_ip
set_etcd_params
exec chpst -u icecast2 \
radiod --ip=${PUBLIC_IP} ${ETCD_OPTIONS} ${DAEMON_OPTIONS}
#!/bin/sh
. /usr/share/radiod/lib.sh
set_public_ip
set_etcd_params
exec setcap cap_net_bind_service=+ep \
chpst -u nobody \
redirectord --ip=${PUBLIC_IP} ${ETCD_OPTIONS} ${DAEMON_OPTIONS}
Supports Markdown
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