correct issue with trc6500-webconfig package installation
[debian6500.git] / trc6500-master-file / Makefile
CommitLineData
e043b5aa
OL
1# -*- Makefile -*-
2
7cf8d4b7 3DIR = ../master/
e043b5aa
OL
4
5CONFIGDIR = debian/
6
7FILES = $(shell cd $(DIR); find etc/ -type f)
8
7cf8d4b7 9TARGET = ../$(MODULE)_$(VERSION)_$(ARCH).deb
e043b5aa
OL
10
11OBJECTS = deb/DEBIAN/preinst \
12 deb/DEBIAN/postrm \
13 deb/DEBIAN/postinst \
7cf8d4b7 14 deb/opt/script
e043b5aa
OL
15
16SHELL=/bin/bash
7cf8d4b7 17MODULE = $(shell basename `pwd`)
e043b5aa
OL
18ARCH = all
19
20.DEFAULT: all
21.PHONY: clean deb all
22
23VERSION = $(shell awk '/^$(MODULE)/ { gsub(/[()]/, ""); print $$2; exit }' debian/debian-changelog)
24
25
26all: $(TARGET) deb
27
28clean:
29 rm -rf deb $(OBJECTS) $(TARGETS)
30
31deb:
32 rm -rf deb
33 mkdir --parent deb/etc/webconfig/ deb/etc/default/ deb/DEBIAN
34
35deb/DEBIAN/preinst: debian/debian-preinst deb $(addprefix $(DIR)/, $(FILES)) $(MAKEFILE_LIST)
36 rm -f $@
37 cat $< > $@~
38 for f in $(FILES); do echo '[ -f "/'$$f'" ] && dpkg-divert --add /'$$f; done >>$@~
39 echo "exit 0" >>$@~
40 chmod +x $@~
41 mv $@~ $@
42
43deb/DEBIAN/postrm: debian/debian-postrm deb $(addprefix $(DIR)/, $(FILES)) $(MAKEFILE_LIST)
44 rm -f $@
45 cat $< > $@~
46 for f in $(FILES); do echo '[ -f "/'$$f'" ] && dpkg-divert --remove /'$$f; done >>$@~
47 echo "exit 0" >>$@~
48 chmod +x $@~
49 mv $@~ $@
50
51deb/DEBIAN/postinst: debian/debian-postinst deb
52 cp $< $@
53
7cf8d4b7
LM
54deb/opt/script: script deb
55 mkdir -p $@
56 cp $</* $@
e043b5aa
OL
57
58$(TARGET): deb $(OBJECTS)
59 sed s/@@version@@/$(VERSION)/ debian/debian-control > deb/DEBIAN/control
60 mkdir -p deb/usr/share/doc/$(MODULE)
61 cp debian/debian-changelog deb/usr/share/doc/$(MODULE)/changelog
62 cp -r $(DIR)/* deb/
63 fakeroot dpkg --build deb
64 mv deb.deb $@