source: trunk/samhain.spec.in@ 547

Last change on this file since 547 was 547, checked in by katerina, 5 years ago

Fix for ticket #438 (problems with RPM spec file).

File size: 9.0 KB
Line 
1#
2# Accepted parameters for 'rpmbuild':
3#
4# --with tests - make tests before building
5
6Summary: File integrity and host-based IDS
7Name: @install_name@
8Version: @VERSION@
9Release: 1
10License: GPL
11Group: System Environment/Base
12Source: samhain-%{version}.tar.gz
13BuildRoot: %{_tmppath}/samhain-%{version}-root
14Packager: Andre Oliveira da Costa <brblueser@uol.com.br>
15Provides: %{name}
16%if 0%{?suse_version}
17Requires(pre): shadow
18%else
19Requires(pre): shadow-utils
20%endif
21
22# dummy (fix configure warning)
23# datarootdir = @datarootdir@
24
25# no quotes here - aparently will be expanded literally
26
27%define password %(echo $PASSWORD)
28
29%define withpwd_prg x@clmytclient@
30%define withstg_prg x@stegin_prg@
31
32# disable automatic stripping of binaries upon installation
33%define __spec_install_post %{nil}
34# required because DeadRat wants to package some debug info otherwise
35# (this debug info would be created by debug_install_post called
36# from spec_install_post)
37%define debug_package %{nil}
38# Use internal dependency generator rather than external helpers?
39%define _use_internal_dependency_generator 0
40
41%description
42@install_name@ is an open source file integrity and host-based intrusion
43detection system for Linux and Unix. It can run as a daemon process, and
44and thus can remember file changes -- contrary to a tool that runs from
45cron, if a file is modified you will get only one report, while
46subsequent checks of that file will ignore the modification as it is
47already reported (unless the file is modified again).
48
49@install_name@ can optionally be used as client/server system to provide
50centralized monitoring for multiple host. Logging to a (MySQL or
51PostgreSQL) database is supported.
52
53NOTE: for security reasons, if you distribute binary executables to
54third parties you should point out the use of the --add-key option to
55modify the key material within the executable.
56This spec file is intended to facilitate installation on YOUR system.
57If you use this spec file to build a SRPM for distribution to third parties,
58make sure to remove the --enable-base configure option below.
59
60%prep
61%setup -q -n samhain-%{version}
62
63%build
64%if %{?_with_tests:1}%{!?_with_tests:0}
65# test installation (test #7 is only included if --with gpg has been
66# specified)
67for i in `seq 6` %{?_with_gpg:7}; do ./test/test.sh $i; done
68%endif
69#
70# configure with the user-supplied arguments to './configure'
71#
72./configure @mydefargs@
73make
74%if "%{withpwd_prg}" == "xDSH_WITH_CLIENT"
75%if "%{password}" != ""
76 ./samhain_setpwd samhain new %{password}
77 mv samhain samhain.old
78 mv samhain.new samhain
79%endif
80%endif
81
82
83%install
84rm -rf ${RPM_BUILD_ROOT}
85# sstrip shouldn't be used since binaries will be stripped later
86## cat << EOF > sstrip
87## #!/bin/sh
88## echo "*** SSTRIP DISABLED ***"
89## EOF
90make DESTDIR=${RPM_BUILD_ROOT} install
91# copy script files to /var/lib/samhain so that we can use them right
92# after the package is installed
93#
94install -m 700 samhain-install.sh init/samhain.startLinux init/samhain.startLSB ${RPM_BUILD_ROOT}@mydataroot@
95#
96# file list (helpful advice from Lars Kellogg-Stedman)
97#
98echo "@sbindir@/@install_name@" > sh_file_list
99find %{buildroot}/lib/modules \! -type d -print | \
100 sed 's,%{buildroot},,' >> sh_file_list
101
102%clean
103rm -rf ${RPM_BUILD_ROOT}
104
105%pre
106if test "x@install_name@" = "xyule"
107then
108 getent group samhain >/dev/null || groupadd -r samhain
109 getent passwd yule >/dev/null || \
110 useradd -r -g samhain -d @mydataroot@ -s /sbin/nologin \
111 -c "samhain server daemon" yule
112
113fi
114exit 0
115
116%post
117if [ "$1" -ge 1 ]; then
118 # Activate boot-time start up
119 cd @mydataroot@
120 /bin/sh ./samhain-install.sh --verbose install-boot
121 rm -f ./samhain.startLSB
122 rm -f ./samhain.startLinux
123 if [ -f @sbindir@/@install_name@_stealth ]; then
124 rm -f samhain-install.sh
125 fi
126 shkeep=yes
127 if test x"$shkeep" = xno; then
128 rm -f ./samhain-install.sh
129 rm -f @sbindir@/@install_name@_stealth
130 fi
131fi
132if [ "$1" = 1 ]; then
133 if test -f /usr/lib/lsb/install_initd; then
134 /usr/lib/lsb/install_initd /etc/init.d/@install_name@
135 fi
136fi
137
138%if "%{name}" != "yule"
139cat << EOF
140
141Samhain is installed but is NOT running yet, and the database of
142file signatures is NOT initialized yet. Read the documentation,
143review configuration files, and then (i) initialize it
144(@sbindir@/samhain -t init)
145and (ii) start it manually
146(@sbindir@/samhain start).
147
148It is configured to start automatically on the next boot for runlevels
149[2-5].
150
151EOF
152%endif
153%if "%{name}" == "yule"
154cat << EOF
155
156Yule is installed but is NOT running yet, read the documentation,
157review configuration files, and then start it
158(@sbindir@/yule)
159
160It is configured to start automatically on the next boot for runlevels
161[2-5].
162
163EOF
164%endif
165
166%preun
167# stop running instance of samhain, if any
168if [ -f @mylockdir@/%{name}.pid ]; then
169 @sbindir@/@install_name@ stop
170fi
171if [ "$1" = 0 ]; then
172 # remove boot-time scripts and links
173 cd @mydataroot@
174 if [ -f ./samhain-install.sh ]; then
175 /bin/sh ./samhain-install.sh --verbose uninstall-boot
176 else
177 if test -f /usr/lib/lsb/remove_initd; then
178 /usr/lib/lsb/remove_initd /etc/init.d/@install_name@
179 fi
180 rm -f /etc/init.d/@install_name@
181 fi
182fi
183
184
185
186%files -f sh_file_list
187%defattr(-,root,root)
188%if "@mylockdir@" != "/run" || "@mylockdir@" != "/var/run"
189 %dir @mylockdir@
190%endif
191%if "@mylogdir@" != "/var/log"
192 %dir @mylogdir@
193%endif
194%doc docs/BUGS COPYING docs/Changelog
195%doc LICENSE docs/FAQ.html docs/HOWTO* docs/MANUAL-2_4.* docs/README*
196@mydataroot@
197%if "%{withstg_prg}" == "xsamhain_stealth"
198 @sbindir@/@install_name@_stealth
199%endif
200%if "%{withpwd_prg}" == "xDSH_WITH_CLIENT"
201 @sbindir@/@install_name@_setpwd
202%endif
203%if "%{withpwd_prg}" == "xDSH_WITH_SERVER"
204 @sbindir@/@install_name@ctl
205 @sbindir@/@install_name@admin.pl
206 %exclude @sbindir@/@install_name@_setpwd
207%endif
208%attr(644,root,root) @mandir@/man5/@install_name@*
209%attr(644,root,root) @mandir@/man8/@install_name@*
210%attr(644,root,root) /etc/logrotate.d/@install_name@
211%if "%{name}" == "yule"
212%attr(750,root,samhain) @mydataroot@
213%attr(750,yule,samhain) @mylogdir@
214%endif
215%config(noreplace) @myrpmconffile@
216
217%changelog
218* Wed May 01 2019 Rainer Wichmann
219- remove obsolete part fpr sh_lkm
220- add fixes by Franky Van L. (password, directory ownership)
221
222* Mon Dec 18 2017 Rainer Wichmann
223- patch for SLES12 by Pirmin
224- fix missing yuleadmin.pl file
225
226* Tue Oct 23 2012 Rainer Wichmann
227- fixes for yule installation
228
229* Tue May 16 2006 Rainer Wichmann
230- fix manual version, noticed by Imre Gergely
231
232* Tue Apr 05 2005 Rainer Wichmann
233- disable automatic stripping, use sstrip
234
235* Thu Mar 17 2005 Rainer Wichmann
236- fixes for enable-khide
237
238* Wed Oct 20 2004 Rainer Wichmann
239- more fixes for client/server detection
240- fix for samhain_stealth
241
242* Sun Aug 15 2004 Rainer Wichmann
243- fix detection of client/server
244
245* Sat Jun 19 2004 Rainer Wichmann
246- replace ./test.sh $i with make test$i
247- add logic for rpm-light (remove some more files after install)
248- make postun posix compliant (avoid empty argument list for rm -f)
249
250* Wed Dec 31 2003 Stijn Jonker <sjcjonker@sjc.nl>
251- Fixed correctly build of yule-*-rpm
252- Fixed excluding of yule_setpwd, and including of yulectl on yule build
253- Fixed including of samhain_setpwd in samhain client build
254- Above changes required for correct build in newer rpms,
255 with defaults for abort on unpacked files due to
256 %_unpackaged_files_terminate_build 1 setting
257- Fixed installation text for yule, not to display samhain text
258- Added /sbin/chkconfig install_name on to enable the rc scripts
259
260* Thu Dec 11 2003 Christian Vanguers <cva at molis dot be>
261- Fixed typo in samhain.spec
262- Compiled on RedHat Enterprise Linux ES 3
263
264* Thu Mar 26 2003 Rainer Wichmann
265- strip REQ_FROM_SERVER in config file path (%config(noreplace) ...)
266
267* Sun Jan 12 2003 Rainer Wichmann <support at la-samhna dot de>
268- replace %configure with ./configure
269
270* Tue Dec 24 2002 Rainer Wichmann <support at la-samhna dot de>
271- backported applicable changes to samhain.spec.in
272- warn user that database must be initialized
273- fix version of MANUAL in '%files'
274- test for chkconfig, use only if found
275
276* Sun Dec 22 2002 Andre Oliveira da Costa <brblueser@uol.com.br> 1.7.0
277- fixed typo with _usr macro on ./configure
278- stops running samhain before uninstall
279- implemented conditionals to allow proper uninstalls/upgrades
280- 'BuildPreReq: gpg' is considered only if '--with gpg' is provided
281- run 'chkconfig' to activate samhain after installation
282- warn user that samhain must be manually started after
283 install/upgrade
284
285* Fri Dec 20 2002 Rainer Wichmann <support at la-samhna dot de>
286- backported to samhain.spec.in (take over user's choices from configure)
287- also save samhain.startLSB and samhain.startSuSE for install-boot
288
289* Thu Dec 19 2002 Andre Oliveira da Costa <brblueser@uol.com.br> 1.6.6
290- optional parameters '--with gpg' and '--with tests'
291- use of pre-defined macros whenever possible
292
293* Wed Dec 18 2002 Andre Oliveira da Costa <brblueser@uol.com.br> 1.6.6
294- Fixed installation process, avoiding hardcoded paths on the binaries
295 (thks to samhain's author Rainer Wichmann)
296
297* Mon Dec 16 2002 Andre Oliveira da Costa <brblueser@uol.com.br> 1.6.6
298- First attempt to build from sources
299
Note: See TracBrowser for help on using the repository browser.