common.mk 1.03 KB
Newer Older
1 2 3 4 5 6 7 8 9
PACKAGE = $(shell dh_listpackages)
TMP = $(CURDIR)/debian/$(PACKAGE)

INIT = $(TMP)/etc/init.d

ifdef VERSION
define CHANGELOG
$(PACKAGE) ($(VERSION)) nexedi; urgency=low

10
 -- $(shell git log -1 --pretty='%cN <%cE>  %cD')
11 12 13 14 15 16 17 18 19 20
endef
export CHANGELOG

.PHONY: debian/changelog

debian/changelog:
	echo "$$CHANGELOG" >$@
endif

override_dh_install:
21 22
	make DESTDIR=$(TMP) PREFIX=/usr PYTHON=/usr/bin/python \
		install-noinit install-ifupdown
23 24 25 26 27 28 29 30 31 32 33 34 35

override_dh_installinit:
	install -d $(INIT)
	sed 's/#NAME#/re6st-registry/; s/#DEPENDS#//; s,#DAEMON_DIR#,/usr/bin,' \
		<debian/init.d >$(INIT)/re6st-registry
	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
# First install *.service then update scripts.
	for x in $(INIT)/*; do set dh_installinit --name=$${x##*/} && \
		chmod +x $$x && "$$@" --noscripts && "$$@" --onlyscripts; \
	done