-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
54 lines (39 loc) · 1.4 KB
/
Makefile
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
44
45
46
47
48
49
50
51
52
53
.PHONY: build-deb clean
.DELETE_ON_ERROR:
VERSION=0.15.2
RESTIC_URL = https://github.com/restic/restic/releases/download/v$(VERSION)/restic_$(VERSION)_linux_amd64.bz2
RESTIC=usr/bin/restic
RESTIC_MAN=usr/share/man/man1/restic.1
RESTIC_BASH_COMPLETION=usr/share/bash-completion/completions/restic
DEB_CONTROL=restic-$(VERSION)/debian/control
RESTIC_DEB=restic_$(VERSION)-2_amd64.deb
print-version:
@echo $(VERSION)
print-deb-file:
@echo $(RESTIC_DEB)
$(RESTIC):
mkdir -p `dirname $@`
curl -L $(RESTIC_URL) | bunzip2 > $@
chmod a+rx $@
$(RESTIC_BASH_COMPLETION): $(RESTIC)
mkdir -p `dirname $@`
$(RESTIC) generate --bash-completion $@
$(RESTIC_MAN): $(RESTIC)
mkdir -p `dirname $@`
$(RESTIC) generate --man `dirname $@`
restic-$(VERSION).tgz: $(RESTIC_MAN) $(RESTIC_BASH_COMPLETION)
fakeroot tar cf $@ --gzip ./usr
# generate dirs + files directly needed to build .deb
restic-$(VERSION): restic-$(VERSION).tgz
fakeroot alien --generate --to-deb \
--description "restic backup program" \
$<
$(RESTIC_DEB): restic-$(VERSION)
sed -i 's|^Maintainer:.*|Maintainer: https://github.com/phlummox-dev/restic-deb/|' $(DEB_CONTROL)
sed -i 's/^Architecture:.*/Architecture: amd64/' $(DEB_CONTROL)
sed -i 's/^Section:.*/Section: utils/' $(DEB_CONTROL)
echo "Homepage: https://github.com/restic/restic" >> $(DEB_CONTROL)
cd $< && fakeroot ./debian/rules binary
build-deb: $(RESTIC_DEB)
clean:
-rm -rf restic* usr