rules 1.54 KB
Newer Older
1 2 3 4 5
#!/usr/bin/make -f
# -*- makefile -*-
MANPAGELIST := $(patsubst %.rst, %.1, $(wildcard docs/*.rst))

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

INIT=debian/re6stnet/etc/init.d
9
NM=/etc/NetworkManager/dispatcher.d/50re6stnet
10 11 12 13 14 15 16 17

override_dh_auto_clean:
	dh_auto_clean
	rm -f $(MANPAGELIST)

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

Julien Muchembled's avatar
Julien Muchembled committed
18 19 20 21
override_dh_install:
	dh_install
	install -d debian/re6stnet/usr/sbin
	mv debian/re6stnet/usr/bin/re6stnet debian/re6stnet/usr/sbin
22
	install -Dpm 0644 daemon/README.conf debian/re6stnet/etc/re6stnet/README
23 24 25 26 27 28 29
	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%/*}; \
	printf '#!/bin/sh -e\n[ "$$METHOD" = NetworkManager ] ||exec $(NM) "$$IFACE" %s\n' $$a >$$1; \
	chmod +x $$1; \
	done
Julien Muchembled's avatar
Julien Muchembled committed
30 31 32 33 34

override_dh_installinit:
	install -d $(INIT)
	sed 's/#NAME#/re6st-registry/; s/#DEPENDS#//; s,#DAEMON_DIR#,/usr/bin,' \
		<debian/init.d >$(INIT)/re6st-registry
35 36 37 38
	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
39 40 41 42
	for x in re6st-registry re6stnet; \
	do chmod +x $(INIT)/$$x && dh_installinit --onlyscripts --name=$$x; \
	done

43 44 45
override_dh_installman: $(MANPAGELIST)
	dh_installman $^

Julien Muchembled's avatar
Julien Muchembled committed
46 47 48
override_dh_python2:
	dh_python2 --no-guessing-deps --depends=pyOpenSSL --recommends=miniupnpc

49 50
%:
	dh $@ --with python2 --buildsystem=python_distutils