27fc051a0082e9666723b3320c8ed3b71de50227
[ossec-hids.git] / debian / rules
1 #!/usr/bin/make -f
2
3 # Uncomment this to turn on verbose mode.
4 #export DH_VERBOSE=1
5
6 # Directories
7 SRCDIR = $(CURDIR)/src
8 PKGDIR = $(CURDIR)/debian/ossec-hids
9 DESTDIR = $(PKGDIR)/var/ossec
10
11 # OSSEC INSTALL SUBDIRS
12 SUBDIRS = logs logs/archives logs/alerts logs/firewall bin queue queue/ossec queue/alerts queue/syscheck queue/rids queue/fts queue/syscheck queue/rootcheck queue/diff queue/agent-info queue/agentless tmp var var/run etc etc/shared stats rules active-response active-response/bin agentless .ssh
13
14 ###################### main ######################
15
16 build: build-stamp
17 build-stamp:
18         dh_testdir
19         dh_clean
20
21         $(MAKE) -C $(SRCDIR) setlocal all build
22
23         touch build-stamp
24
25 clean:
26         dh_testdir
27         dh_testroot
28         rm -f build-stamp
29
30         # Add here commands to clean up after the build process.
31         $(MAKE) -C $(SRCDIR) clean
32
33         dh_clean
34
35 install: build
36         dh_testdir
37         dh_testroot
38         dh_clean -k
39         dh_installdirs
40
41         # ugly directory creation
42         for i in $(SUBDIRS); do \
43                 mkdir -p -m 700 $(DESTDIR)/$$i; \
44         done
45
46         # attrs
47         chmod -R 550 $(DESTDIR)
48         chmod -R 770 $(DESTDIR)/queue/alerts
49         chmod -R 770 $(DESTDIR)/queue/ossec
50         chmod -R 750 $(DESTDIR)/queue/fts
51         chmod -R 750 $(DESTDIR)/queue/syscheck
52         chmod -R 750 $(DESTDIR)/queue/rootcheck
53         chmod -R 750 $(DESTDIR)/queue/diff
54         chmod -R 755 $(DESTDIR)/queue/agent-info
55         chmod -R 755 $(DESTDIR)/queue/rids
56         chmod -R 755 $(DESTDIR)/queue/agentless
57         chmod -R 750 $(DESTDIR)/stats
58         chmod -R 750 $(DESTDIR)/logs
59         chmod -R 550 $(DESTDIR)/rules
60         chmod 770 $(DESTDIR)/var/run
61         chmod 550 $(DESTDIR)/etc
62         chmod 770 $(DESTDIR)/etc/shared
63         chmod 700 $(DESTDIR)/.ssh
64
65         # various files installation
66         install -m 644 etc/internal_options.conf $(DESTDIR)/etc
67         install -m 644 etc/decoder.xml $(DESTDIR)/etc
68         install -m 644 src/rootcheck/db/*.txt $(DESTDIR)/etc/shared
69         if [ -e etc/ossec.mc ]; then \
70                 install -m 440 etc/ossec.mc $(DESTDIR)/etc/ossec.conf; \
71         else \
72                 install -m 440 etc/ossec-agent.conf $(DESTDIR)/etc/ossec.conf; \
73         fi
74         install -m 440 etc/ossec-*.conf $(DESTDIR)/etc
75         cp -r etc/rules/* $(DESTDIR)/rules
76         find $(DESTDIR)/rules -type f -exec chmod 640 '{}' ';'
77         install -m 750 src/agentlessd/scripts/* $(DESTDIR)/agentless
78         install -s -m 755 bin/* $(DESTDIR)/bin
79         install -m 755 src/init/ossec-*.sh $(DESTDIR)/bin
80         ln -s ossec-local.sh $(DESTDIR)/bin/ossec-control
81         install -m 755 active-response/*.sh $(DESTDIR)/active-response/bin
82         install -m 755 active-response/firewalls/*.sh \
83                 $(DESTDIR)/active-response/bin
84
85         # system init script
86         mkdir -p $(PKGDIR)/etc/init.d
87         install -m 755 src/init/ossec-hids.init $(PKGDIR)/etc/init.d/ossec-hids
88
89         # system ossec-init
90         echo "DIRECTORY=\"/var/ossec\""      >  $(PKGDIR)/etc/ossec-init.conf
91         echo "VERSION=\"`cat src/VERSION`\"" >> $(PKGDIR)/etc/ossec-init.conf
92         echo "DATE=\"`date --utc`\""         >> $(PKGDIR)/etc/ossec-init.conf
93         echo "TYPE=\"local\""                >> $(PKGDIR)/etc/ossec-init.conf
94
95 # Build architecture-independent files here.
96 binary-indep: build install
97         dh_testdir
98         dh_testroot
99         dh_installchangelogs
100         dh_installdocs
101 #       dh_installexamples
102 #       dh_installmenu
103 #       dh_installdebconf
104 #       dh_installlogrotate
105 #       dh_installemacsen
106 #       dh_installcatalogs
107 #       dh_installpam
108 #       dh_installmime
109 #       dh_installinit
110 #       dh_installcron
111 #       dh_installinfo
112 #       dh_undocumented
113         dh_installman
114         dh_link
115         dh_compress
116         dh_fixperms
117 #       dh_perl
118 #       dh_python
119         dh_installdeb
120         dh_gencontrol
121         dh_md5sums
122         dh_builddeb
123
124 # Build architecture-dependent files here.
125 binary-arch: build install
126 # We have nothing to do by default.
127
128 binary: binary-indep binary-arch
129 .PHONY: build clean binary-indep binary-arch binary install