rules 2.55 KiB
#!/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/svc
%:
dh $@
override_dh_install:
# Build the binary
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 the static files and templates for the HTTP dashboard.
install -d -m 755 -o root -g root $(DESTDIR)/usr/share/radioai
install -d -m 755 -o root -g root $(DESTDIR)/usr/share/radioai/htdocs/static
(for f in $(CURDIR)/fe/static/* ; do \
install -o root -g root -m 644 $$f $(DESTDIR)/usr/share/radioai/htdocs/static/ ; \
done)
install -d -m 755 -o root -g root $(DESTDIR)/usr/share/radioai/htdocs/templates
(for f in $(CURDIR)/fe/templates/*.html ; do \
install -o root -g root -m 644 $$f $(DESTDIR)/usr/share/radioai/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/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 $(CURDIR)/debian/services/$$f \
$(SVCDIR)/$$f/run ; \
echo -e '#!/bin/sh\nexec chpst -u log svlogd -tt /var/log/radioai/'$$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/radioai.xsl \
$(DESTDIR)/usr/share/icecast2/web/radioai.xsl