rules 1.98 KB
Newer Older
1 2
#!/usr/bin/make -f
# -*- makefile -*-
3
# source package automatically created by stdeb 0.6.0+git
4 5 6
MANPAGELIST := $(patsubst %.rst, %.1, $(wildcard docs/*.rst))

# Uncomment this to turn on verbose mode.
Julien Muchembled's avatar
Julien Muchembled committed
7 8 9
#export DH_VERBOSE=1

INIT=debian/re6stnet/etc/init.d
10
NM=/etc/NetworkManager/dispatcher.d/50re6stnet
11

12 13 14 15 16 17
.PHONY: debian/changelog

build-package: debian/changelog
	dpkg-buildpackage -us -uc -b

debian/changelog:
18 19
	printf 're6stnet (%s) nexedi; urgency=low\n\n -- %s  %s\n' \
	"`python re6st/version.py`" \
20 21 22
	"`git var GIT_COMMITTER_IDENT |sed 's/\(.*>\) .*/\\1/'`" \
	"`date -R`" >debian/changelog

23 24 25 26 27 28 29
override_dh_auto_clean:
	dh_auto_clean
	rm -f $(MANPAGELIST)

%.1: %.rst
	rst2man $< $@

Julien Muchembled's avatar
Julien Muchembled committed
30 31 32 33
override_dh_install:
	dh_install
	install -d debian/re6stnet/usr/sbin
	mv debian/re6stnet/usr/bin/re6stnet debian/re6stnet/usr/sbin
34
	install -Dpm 0644 daemon/README.conf debian/re6stnet/etc/re6stnet/README
Julien Muchembled's avatar
Julien Muchembled committed
35
	install -Dpm 0644 daemon/logrotate.conf debian/re6stnet/etc/logrotate.d/re6stnet
36 37 38 39
	install -Dp daemon/network-manager debian/re6stnet$(NM)
	for a in up down; do \
	set debian/re6stnet/etc/network/if-$$a.d/re6stnet; \
	install -d $${1%/*}; \
40
	printf '#!/bin/sh -e\n[ "$$METHOD" = NetworkManager -o "$$IFACE" = lo ] ||exec $(NM) "$$IFACE" %s\n' $$a >$$1; \
41 42
	chmod +x $$1; \
	done
Julien Muchembled's avatar
Julien Muchembled committed
43 44 45 46 47

override_dh_installinit:
	install -d $(INIT)
	sed 's/#NAME#/re6st-registry/; s/#DEPENDS#//; s,#DAEMON_DIR#,/usr/bin,' \
		<debian/init.d >$(INIT)/re6st-registry
48 49 50 51
	sed 's/#NAME#/re6stnet/; s/#DEPENDS#/re6st-registry/; s,#DAEMON_DIR#,/usr/sbin,; /^case/i\
	cd $$CONFDIR; $$DAEMON @$$NAME.conf --test "main_interface != '\'lo\''" ||\
	case "$$1" in start) exit 0;; restart|force-reload) set stop;; esac\
	' <debian/init.d >$(INIT)/re6stnet
Julien Muchembled's avatar
Julien Muchembled committed
52 53 54 55
	for x in re6st-registry re6stnet; \
	do chmod +x $(INIT)/$$x && dh_installinit --onlyscripts --name=$$x; \
	done

56 57 58
override_dh_installman: $(MANPAGELIST)
	dh_installman $^

Julien Muchembled's avatar
Julien Muchembled committed
59 60 61
override_dh_python2:
	dh_python2 --no-guessing-deps --depends=pyOpenSSL --recommends=miniupnpc

62 63
%:
	dh $@ --with python2 --buildsystem=python_distutils