dist: refactoring, ship systemd services for Debian, fix section of re6stnet manpage
[re6stnet.git] / debian / common.mk
1 PACKAGE = $(shell dh_listpackages)
2 TMP = $(CURDIR)/debian/$(PACKAGE)
3
4 INIT = $(TMP)/etc/init.d
5
6 ifdef VERSION
7 define CHANGELOG
8 $(PACKAGE) ($(VERSION)) nexedi; urgency=low
9
10 -- $(shell git var GIT_COMMITTER_IDENT |sed 's/[^>]*$$//') $(shell date -R)
11 endef
12 export CHANGELOG
13
14 .PHONY: debian/changelog
15
16 debian/changelog:
17 echo "$$CHANGELOG" >$@
18 endif
19
20 override_dh_install:
21 make DESTDIR=$(TMP) PREFIX=/usr install-noinit install-ifupdown
22
23 override_dh_installinit:
24 install -d $(INIT)
25 sed 's/#NAME#/re6st-registry/; s/#DEPENDS#//; s,#DAEMON_DIR#,/usr/bin,' \
26 <debian/init.d >$(INIT)/re6st-registry
27 sed 's/#NAME#/re6stnet/; s/#DEPENDS#/re6st-registry/; s,#DAEMON_DIR#,/usr/sbin,; /^case/i\
28 cd $$CONFDIR; $$DAEMON @$$NAME.conf --test "main_interface != '\'lo\''" ||\
29 case "$$1" in start) exit 0;; restart|force-reload) set stop;; esac\
30 ' <debian/init.d >$(INIT)/re6stnet
31 # First install *.service then update scripts.
32 for x in $(INIT)/*; do set dh_installinit --name=$${x##*/} && \
33 chmod +x $$x && "$$@" --noscripts && "$$@" --onlyscripts; \
34 done