#!/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/autoradio DESTDIR = $(CURDIR)/debian/autoradio-server %: 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 (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 install -d -m 755 -o root -g root $(DESTDIR)/usr/share/autoradio/htdocs/static (for f in $(CURDIR)/fe/static/* ; do \ install -o root -g root -m 644 $$f $(DESTDIR)/usr/share/autoradio/htdocs/static/ ; \ done) install -d -m 755 -o root -g root $(DESTDIR)/usr/share/autoradio/htdocs/templates (for f in $(CURDIR)/fe/templates/*.html ; do \ install -o root -g root -m 644 $$f $(DESTDIR)/usr/share/autoradio/htdocs/templates/ ; \ 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 # 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