d22c4644a2f5068a8bf9356e7c3a320c342767fe
[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         install -m 750 src/agentlessd/scripts/* $(DESTDIR)/agentless
77         install -m 755 bin/* $(DESTDIR)/bin
78         install -m 755 src/init/ossec-*.sh $(DESTDIR)/bin
79         ln -s ossec-local.sh $(DESTDIR)/bin/ossec-control
80         install -m 755 active-response/*.sh $(DESTDIR)/active-response/bin
81         install -m 755 active-response/firewalls/*.sh \
82                 $(DESTDIR)/active-response/bin
83
84         # system init script
85         mkdir -p $(PKGDIR)/etc/init.d
86         install -m 755 src/init/ossec-hids.init $(PKGDIR)/etc/init.d/ossec-hids
87
88         # system ossec-init
89         echo "DIRECTORY=\"/var/ossec\""      >  $(PKGDIR)/etc/ossec-init.conf
90         echo "VERSION=\"`cat src/VERSION`\"" >> $(PKGDIR)/etc/ossec-init.conf
91         echo "DATE=\"`date --utc`\""         >> $(PKGDIR)/etc/ossec-init.conf
92         echo "TYPE=\"local\""                >> $(PKGDIR)/etc/ossec-init.conf
93
94 # Build architecture-independent files here.
95 binary-indep: build install
96         dh_testdir
97         dh_testroot
98         dh_installchangelogs
99         dh_installdocs
100 #       dh_installexamples
101 #       dh_installmenu
102 #       dh_installdebconf
103 #       dh_installlogrotate
104 #       dh_installemacsen
105 #       dh_installcatalogs
106 #       dh_installpam
107 #       dh_installmime
108 #       dh_installinit
109 #       dh_installcron
110 #       dh_installinfo
111 #       dh_undocumented
112         dh_installman
113         dh_link
114         dh_compress
115         dh_fixperms
116 #       dh_perl
117 #       dh_python
118         dh_installdeb
119         dh_gencontrol
120         dh_md5sums
121         dh_builddeb
122
123 # Build architecture-dependent files here.
124 binary-arch: build install
125 # We have nothing to do by default.
126
127 binary: binary-indep binary-arch
128 .PHONY: build clean binary-indep binary-arch binary install