~jbboehr/+junk/etcd-package

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/make -f
# -*- makefile -*-

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

export PKGSRCDIR=$(CURDIR)/src/github.com/coreos/etcd
export GOPATH=$(CURDIR):$(PKGSRCDIR)/third_party
export GOBIN=$(CURDIR)/bin

PKGDIR=debian/etcd

%:
	dh $@ 

clean:
	dh_clean
	rm -rf $(CURDIR)/bin/* $(CURDIR)/pkg/*
	cd $(PKGSRCDIR) && go clean
	rm -f $(CURDIR)/goinstall.log

binary-arch: clean
	dh_prep
	dh_installdirs
	dh_installinit --restart-after-upgrade --error-handler etcd_error_handler
	# build and install the package
	cd $(PKGSRCDIR) && go install
	# copy the binaries into the package
	mkdir -p $(PKGDIR)/usr/bin
	cp $(CURDIR)/bin/* $(PKGDIR)/usr/bin/
	# copy our configuration into the package
	mkdir -p $(PKGDIR)/etc/etcd
	cp $(CURDIR)/debian/etcd.conf $(PKGDIR)/etc/etcd/
	# misc dh
	dh_strip
	dh_compress
	dh_fixperms
	dh_installdeb
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary: binary-arch