[8191] | 1 | ################################################################ |
---|
| 2 | # rpmbuild Package Options |
---|
| 3 | # ======================== |
---|
| 4 | # |
---|
| 5 | # See README.build_rpms for more details. |
---|
| 6 | # |
---|
| 7 | # --with flexresp |
---|
| 8 | # Add flexresp capability to whatever package(s) you are |
---|
| 9 | # building. |
---|
| 10 | # |
---|
| 11 | # --with inline |
---|
| 12 | # Add inline capability to whatever package(s) you are |
---|
| 13 | # building. This will create its own inline package. |
---|
| 14 | # |
---|
| 15 | # --with mysql |
---|
| 16 | # Builds a binary/package with support for MySQL. |
---|
| 17 | # |
---|
| 18 | # --with postgresql |
---|
| 19 | # Builds a binary/package with support for PostgreSQL. |
---|
| 20 | # |
---|
| 21 | # --with unixODBC |
---|
| 22 | # Build a binary/package with support for unixODBC |
---|
| 23 | # |
---|
| 24 | # --with oracle |
---|
| 25 | # Builds a binary/package with support for Oracle. |
---|
| 26 | # |
---|
| 27 | # See pg 399 of _Red_Hat_RPM_Guide_ for rpmbuild --with and --without options. |
---|
| 28 | ################################################################ |
---|
| 29 | |
---|
| 30 | # Other useful bits |
---|
| 31 | %define OracleHome /opt/oracle/OraHome1 |
---|
| 32 | %define SnortRulesDir %{_sysconfdir}/snort/rules |
---|
| 33 | %define noShell /bin/false |
---|
| 34 | |
---|
| 35 | # Handle the options noted above. |
---|
| 36 | # Default of no flexresp, but --with flexresp will enable it |
---|
| 37 | %define flexresp 1 |
---|
| 38 | %{?_with_flexresp:%define flexresp 1} |
---|
| 39 | %{?_without_flexresp:%define flexresp 0} |
---|
| 40 | |
---|
| 41 | # Default of no MySQL, but --with mysql will enable it |
---|
| 42 | %define mysql 0 |
---|
| 43 | %{?_with_mysql:%define mysql 1} |
---|
| 44 | %{?_without_mysql:%define mysql 0} |
---|
| 45 | |
---|
| 46 | # Default of no PostgreSQL, but --with postgresql will enable it |
---|
| 47 | %define postgresql 0 |
---|
| 48 | %{?_with_postgresql:%define postgresql 1} |
---|
| 49 | %{?_without_postgresql:%define postgresql 0} |
---|
| 50 | |
---|
| 51 | # Default of no unixODBC, but --with unixODBC will enable it |
---|
| 52 | %define unixODBC 0 |
---|
| 53 | %{?_with_unixODBC:%define unixODBC 1} |
---|
| 54 | %{?_without_unixODBC:%define unixODBC 0} |
---|
| 55 | |
---|
| 56 | # Default of no Oracle, but --with oracle will enable it |
---|
| 57 | %define oracle 0 |
---|
| 58 | %{?_with_oracle:%define oracle 1} |
---|
| 59 | |
---|
| 60 | # If not inline then we'll conflict with it |
---|
| 61 | %define conflicts snort-inline |
---|
| 62 | |
---|
| 63 | # Default of no Inline, but --with inline will enable it |
---|
| 64 | %define inline 0 |
---|
| 65 | %define inlinetext %{nil} |
---|
| 66 | %{?_with_inline:%define inline 1} |
---|
| 67 | %{?_with_inline:%define inlinetext -inline } |
---|
| 68 | %{?_with_inline:%define conflicts snort } |
---|
| 69 | |
---|
| 70 | %define vendor Snort.org |
---|
| 71 | %define for_distro RPMs |
---|
| 72 | %define release 1 |
---|
| 73 | %define realname snort |
---|
| 74 | |
---|
| 75 | # Look for a directory to see if we're building under cAos |
---|
| 76 | # Exit status is usually 0 if the dir exists, 1 if not, so |
---|
| 77 | # we reverse that with the '!' |
---|
| 78 | %define caos %([ ! -d /usr/lib/rpm/caos ]; echo $?) |
---|
| 79 | |
---|
| 80 | %if %{caos} |
---|
| 81 | # We are building for cAos (www.caosity.org) and the autobuilder doesn't |
---|
| 82 | # have command line options so we have to fake the options for whatever |
---|
| 83 | # packages we actually want here, in addition to tweaking the package |
---|
| 84 | # info. |
---|
| 85 | %define vendor cAos Linux |
---|
| 86 | %define for_distro RPMs for cAos Linux |
---|
| 87 | %define mysql 1 |
---|
| 88 | %define postgresql 1 |
---|
| 89 | %define release 1.caos |
---|
| 90 | %endif |
---|
| 91 | |
---|
| 92 | |
---|
| 93 | Name: %{realname}%{inlinetext} |
---|
| 94 | %{?_with_inline:%define Name: %{realname}-inline } |
---|
| 95 | Version: 2.9.5.6 |
---|
| 96 | Epoch: 1 |
---|
| 97 | Release: 1%{?_dist_release} |
---|
| 98 | Summary: An open source Network Intrusion Detection System (NIDS) |
---|
| 99 | Group: Applications/Internet |
---|
[521] | 100 | License: GPL |
---|
[8191] | 101 | Url: http://www.snort.org/ |
---|
| 102 | Source0: http://www.snort.org/snort-downloads/2.9.2/%{realname}-%{version}.tar.gz |
---|
| 103 | |
---|
| 104 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) |
---|
| 105 | |
---|
| 106 | #Packager: Official Snort.org %{for_distro} |
---|
| 107 | #Vendor: %{vendor} |
---|
| 108 | Vendor: Project Vine |
---|
| 109 | Distribution: Vine Linux |
---|
| 110 | |
---|
| 111 | BuildRequires: autoconf, automake, flex, bison |
---|
| 112 | BuildRequires: pcre-devel |
---|
| 113 | BuildRequires: libpcap-devel |
---|
| 114 | BuildRequires: daq |
---|
| 115 | BuildRequires: libdnet-devel |
---|
| 116 | BuildRequires: zlib-devel |
---|
| 117 | BuildRequires: iptables-devel |
---|
| 118 | BuildRequires: libnfnetlink-devel |
---|
| 119 | BuildRequires: libnetfilter_queue-devel |
---|
| 120 | Conflicts: %{conflicts} |
---|
| 121 | |
---|
| 122 | %if %{flexresp} |
---|
| 123 | BuildRequires: libnet |
---|
| 124 | %define EnableFlexresp --enable-flexresp |
---|
| 125 | %endif |
---|
| 126 | |
---|
| 127 | # Itables-devel removed from BuildReq as RH does not supply that package. |
---|
| 128 | # Will replace iptables-devel buildreq with a scripted solution. --jh |
---|
| 129 | %if %{inline} |
---|
| 130 | BuildRequires: libnet |
---|
| 131 | %define EnableInline --enable-inline |
---|
| 132 | %endif |
---|
| 133 | |
---|
| 134 | %package mysql |
---|
| 135 | Summary: Snort with MySQL support |
---|
[521] | 136 | Group: Applications/Internet |
---|
[8191] | 137 | Requires: %{name} = %{epoch}:%{version}-%{release} |
---|
| 138 | %if %{mysql} |
---|
| 139 | BuildRequires: mysql-devel |
---|
| 140 | %endif |
---|
[521] | 141 | |
---|
[8191] | 142 | %description mysql |
---|
| 143 | Snort binary compiled with mysql support. |
---|
| 144 | |
---|
| 145 | %package postgresql |
---|
| 146 | Summary: Snort with PostgreSQL support |
---|
| 147 | Group: Applications/Internet |
---|
| 148 | Requires: %{name} = %{epoch}:%{version}-%{release} |
---|
| 149 | %if %{postgresql} |
---|
| 150 | BuildRequires: postgresql-devel |
---|
| 151 | %endif |
---|
| 152 | |
---|
| 153 | %description postgresql |
---|
| 154 | Snort binary compiled with postgresql support. |
---|
| 155 | |
---|
| 156 | %package unixODBC |
---|
| 157 | Summary: Snort with unixODBC support |
---|
| 158 | Group: Applications/Internet |
---|
| 159 | Requires: %{name} = %{epoch}:%{version}-%{release} |
---|
| 160 | %if %{unixODBC} |
---|
| 161 | BuildRequires: unixODBC-devel |
---|
| 162 | %endif |
---|
| 163 | |
---|
| 164 | %description unixODBC |
---|
| 165 | Snort binary compiled with unixODBC support. |
---|
| 166 | |
---|
| 167 | %package oracle |
---|
| 168 | Summary: Snort with Oracle support |
---|
| 169 | Group: Applications/Internet |
---|
| 170 | Requires: %{name} = %{epoch}:%{version}-%{release} |
---|
| 171 | |
---|
| 172 | %description oracle |
---|
| 173 | Snort binary compiled with Oracle support. |
---|
| 174 | |
---|
| 175 | EXPERIMENTAL!! I don't have a way to test this, so let me know if it works! |
---|
| 176 | ORACLE_HOME=%{OracleHome} |
---|
| 177 | |
---|
| 178 | |
---|
[521] | 179 | %description |
---|
[8191] | 180 | Snort is an open source network intrusion detection system, capable of |
---|
| 181 | performing real-time traffic analysis and packet logging on IP networks. |
---|
| 182 | It can perform protocol analysis, content searching/matching and can be |
---|
| 183 | used to detect a variety of attacks and probes, such as buffer overflows, |
---|
| 184 | stealth port scans, CGI attacks, SMB probes, OS fingerprinting attempts, |
---|
| 185 | and much more. |
---|
[521] | 186 | |
---|
[8191] | 187 | Snort has three primary uses. It can be used as a straight packet sniffer |
---|
| 188 | like tcpdump(1), a packet logger (useful for network traffic debugging, |
---|
| 189 | etc), or as a full blown network intrusion detection system. |
---|
[521] | 190 | |
---|
[8191] | 191 | You MUST edit /etc/snort/snort.conf to configure snort before it will work! |
---|
| 192 | |
---|
| 193 | There are 5 different packages available. All of them require the base |
---|
| 194 | snort rpm (this one). Additionally, you may need to chose a different |
---|
| 195 | binary to install if you want database support. |
---|
| 196 | |
---|
| 197 | If you install a different binary package %{_sbindir}/snort should end up |
---|
| 198 | being a symlink to a binary in one of the following configurations: |
---|
| 199 | |
---|
| 200 | plain Snort (this package, required) |
---|
| 201 | mysql Snort with mysql (optional) |
---|
| 202 | postgresql Snort with postgresql (optional) |
---|
| 203 | unixODBC Snort with unixODBC (optional) |
---|
| 204 | oracle Snort with oracle (optional, not official) |
---|
| 205 | inline Snort with inline support (optional) |
---|
| 206 | |
---|
| 207 | Please see the documentation in %{_docdir}/%{realname}-%{version} for more |
---|
| 208 | information on snort features and configuration. |
---|
| 209 | |
---|
| 210 | |
---|
[521] | 211 | %prep |
---|
[8191] | 212 | %setup -q -n %{realname}-%{version} |
---|
[521] | 213 | |
---|
[8191] | 214 | # When building from a Snort.org CVS snapshot tarball, you have to run |
---|
| 215 | # autojunk before you can build. |
---|
| 216 | if [ \( ! -s configure \) -a \( -x autojunk.sh \) ]; then |
---|
| 217 | ./autojunk.sh |
---|
| 218 | fi |
---|
| 219 | |
---|
| 220 | # Make sure it worked, or die with a useful error message. |
---|
| 221 | if [ ! -s configure ]; then |
---|
| 222 | echo "Can't find ./configure. ./autojunk.sh not present or not executable?" |
---|
| 223 | exit 2 |
---|
| 224 | fi |
---|
| 225 | |
---|
| 226 | |
---|
[521] | 227 | %build |
---|
| 228 | |
---|
[8191] | 229 | BuildSnort() { |
---|
| 230 | %__mkdir "$1" |
---|
| 231 | cd "$1" |
---|
| 232 | %__ln_s ../configure ./configure |
---|
| 233 | |
---|
| 234 | if [ "$1" = "plain" ] ; then |
---|
| 235 | ./configure $SNORT_BASE_CONFIG \ |
---|
| 236 | --without-mysql \ |
---|
| 237 | --without-postgresql \ |
---|
| 238 | --without-oracle \ |
---|
| 239 | --without-odbc \ |
---|
| 240 | %{?EnableFlexresp} %{?EnableFlexresp2} \ |
---|
| 241 | %{?EnableInline} |
---|
| 242 | fi |
---|
| 243 | |
---|
| 244 | if [ "$1" = "mysql" ]; then |
---|
| 245 | ./configure $SNORT_BASE_CONFIG \ |
---|
| 246 | --with-mysql \ |
---|
| 247 | --with-mysql-libraries=%{_libdir} \ |
---|
| 248 | --without-postgresql \ |
---|
| 249 | --without-oracle \ |
---|
| 250 | --without-odbc \ |
---|
| 251 | %{?EnableFlexresp} %{?EnableFlexresp2} \ |
---|
| 252 | %{?EnableInline} |
---|
| 253 | fi |
---|
| 254 | |
---|
| 255 | if [ "$1" = "postgresql" ]; then |
---|
| 256 | ./configure $SNORT_BASE_CONFIG \ |
---|
| 257 | --without-mysql \ |
---|
| 258 | --with-postgresql \ |
---|
| 259 | --without-odbc \ |
---|
| 260 | --without-oracle \ |
---|
| 261 | %{?EnableFlexresp} %{?EnableFlexresp2} \ |
---|
| 262 | %{?EnableInline} |
---|
| 263 | fi |
---|
| 264 | |
---|
| 265 | if [ "$1" = "unixODBC" ]; then |
---|
| 266 | ./configure $SNORT_BASE_CONFIG \ |
---|
| 267 | --without-mysql \ |
---|
| 268 | --without-postgresql \ |
---|
| 269 | --with-odbc=%{_libdir} \ |
---|
| 270 | --without-oracle \ |
---|
| 271 | %{?EnableFlexresp} %{?EnableFlexresp2} \ |
---|
| 272 | %{?EnableInline} |
---|
| 273 | fi |
---|
| 274 | |
---|
| 275 | if [ "$1" = "oracle" ]; then |
---|
| 276 | export ORACLE_HOME=%{OracleHome} |
---|
| 277 | ./configure $SNORT_BASE_CONFIG \ |
---|
| 278 | --without-mysql \ |
---|
| 279 | --without-postgresql \ |
---|
| 280 | --without-odbc \ |
---|
| 281 | --with-oracle=$ORACLE_HOME \ |
---|
| 282 | %{?EnableFlexresp} %{?EnableFlexresp2} \ |
---|
| 283 | %{?EnableInline} |
---|
| 284 | fi |
---|
| 285 | |
---|
| 286 | %__make |
---|
| 287 | %__mv src/snort ../%{name}-"$1" |
---|
| 288 | cd .. |
---|
| 289 | } |
---|
| 290 | |
---|
| 291 | |
---|
| 292 | CFLAGS="$RPM_OPT_FLAGS" |
---|
| 293 | export AM_CFLAGS="-g -O2" |
---|
| 294 | SNORT_BASE_CONFIG="--prefix=%{_prefix} \ |
---|
| 295 | --bindir=%{_sbindir} \ |
---|
| 296 | --sysconfdir=%{_sysconfdir}/snort \ |
---|
| 297 | --with-libpcap-includes=%{_includedir} \ |
---|
| 298 | --enable-decoder-preprocessor-rules --enable-targetbased \ |
---|
| 299 | " |
---|
| 300 | |
---|
| 301 | # Always build snort-plain |
---|
| 302 | BuildSnort plain |
---|
| 303 | |
---|
| 304 | # Maybe build the others |
---|
| 305 | %if %{mysql} |
---|
| 306 | BuildSnort mysql |
---|
| 307 | %endif |
---|
| 308 | |
---|
| 309 | %if %{postgresql} |
---|
| 310 | BuildSnort postgresql |
---|
| 311 | %endif |
---|
| 312 | |
---|
| 313 | %if %{oracle} |
---|
| 314 | BuildSnort oracle |
---|
| 315 | %endif |
---|
| 316 | |
---|
| 317 | %if %{unixODBC} |
---|
| 318 | BuildSnort unixODBC |
---|
| 319 | %endif |
---|
| 320 | |
---|
| 321 | |
---|
[521] | 322 | %install |
---|
| 323 | |
---|
[8191] | 324 | # Remove leftover CVS files in the tarball, if any... |
---|
| 325 | find . -type 'd' -name "CVS" -print | xargs %{__rm} -rf |
---|
[521] | 326 | |
---|
[8191] | 327 | InstallSnort() { |
---|
| 328 | if [ "$1" = "mysql" ]; then |
---|
| 329 | %__install -p -m 0755 %{name}-mysql %{buildroot}%{_sbindir}/%{name}-mysql |
---|
| 330 | fi |
---|
[521] | 331 | |
---|
[8191] | 332 | if [ "$1" = "postgresql" ]; then |
---|
| 333 | %__install -p -m 0755 %{name}-postgresql %{buildroot}%{_sbindir}/%{name}-postgresql |
---|
| 334 | fi |
---|
[521] | 335 | |
---|
[8191] | 336 | if [ "$1" = "unixODBC" ]; then |
---|
| 337 | %__install -p -m 0755 %{name}-unixODBC %{buildroot}%{_sbindir}/%{name}-unixODBC |
---|
| 338 | fi |
---|
[521] | 339 | |
---|
[8191] | 340 | if [ "$1" = "oracle" ]; then |
---|
| 341 | %__install -p -m 0755 %{name}-oracle %{buildroot}%{_sbindir}/%{name}-oracle |
---|
| 342 | fi |
---|
| 343 | |
---|
| 344 | if [ "$1" = "plain" ]; then |
---|
| 345 | %__rm -rf %{buildroot} |
---|
| 346 | |
---|
| 347 | %__mkdir_p -m 0755 %{buildroot}%{_sbindir} |
---|
| 348 | %__mkdir_p -m 0755 %{buildroot}%{SnortRulesDir} |
---|
| 349 | %__mkdir_p -m 0755 %{buildroot}%{_sysconfdir}/snort |
---|
| 350 | %__mkdir_p -m 0755 %{buildroot}%{_sysconfdir}/sysconfig |
---|
| 351 | %__mkdir_p -m 0755 %{buildroot}%{_sysconfdir}/logrotate.d |
---|
| 352 | %__mkdir_p -m 0755 %{buildroot}%{_var}/log/snort |
---|
| 353 | %__mkdir_p -m 0755 %{buildroot}%{_initrddir} |
---|
| 354 | %__mkdir_p -m 0755 %{buildroot}%{_mandir}/man8 |
---|
| 355 | %__mkdir_p -m 0755 %{buildroot}%{_docdir}/%{realname}-%{version} |
---|
| 356 | |
---|
| 357 | %__install -p -m 0755 %{name}-plain %{buildroot}%{_sbindir}/%{name}-plain |
---|
| 358 | %__mkdir_p -m 0755 %{buildroot}%{_libdir}/%{realname}-%{version}_dynamicengine |
---|
| 359 | %__mkdir_p -m 0755 %{buildroot}%{_libdir}/%{realname}-%{version}_dynamicpreprocessor |
---|
| 360 | %__install -p -m 0755 plain/src/dynamic-plugins/sf_engine/.libs/libsf_engine.so.0 %{buildroot}%{_libdir}/%{realname}-%{version}_dynamicengine |
---|
| 361 | %__ln_s -f %{_libdir}/%{realname}-%{version}_dynamicengine/libsf_engine.so.0 %{buildroot}%{_libdir}/%{realname}-%{version}_dynamicengine/libsf_engine.so |
---|
| 362 | %__install -p -m 0755 plain/src/dynamic-preprocessors/build/%{_prefix}/lib/snort_dynamicpreprocessor/*.so* %{buildroot}%{_libdir}/%{realname}-%{version}_dynamicpreprocessor |
---|
| 363 | |
---|
| 364 | for file in %{buildroot}%{_libdir}/%{realname}-%{version}_dynamicpreprocessor/*.so; do |
---|
| 365 | preprocessor=`basename $file` |
---|
| 366 | %__ln_s -f %{_libdir}/%{realname}-%{version}_dynamicpreprocessor/$preprocessor.0 $file |
---|
| 367 | done |
---|
| 368 | |
---|
| 369 | %__install -p -m 0644 snort.8 %{buildroot}%{_mandir}/man8 |
---|
| 370 | %__gzip %{buildroot}%{_mandir}/man8/snort.8 |
---|
| 371 | %__install -p -m 0755 rpm/snortd %{buildroot}%{_initrddir} |
---|
| 372 | %__install -p -m 0644 rpm/snort.sysconfig %{buildroot}/%{_sysconfdir}/sysconfig/%{realname} |
---|
| 373 | %__install -p -m 0644 rpm/snort.logrotate %{buildroot}/%{_sysconfdir}/logrotate.d/snort |
---|
| 374 | %__install -p -m 0644 etc/reference.config etc/classification.config \ |
---|
| 375 | etc/unicode.map etc/gen-msg.map \ |
---|
| 376 | etc/threshold.conf etc/snort.conf \ |
---|
| 377 | %{buildroot}/%{_sysconfdir}/snort |
---|
| 378 | find doc -maxdepth 1 -type f -not -name 'Makefile*' -exec %__install -p -m 0644 {} %{buildroot}%{_docdir}/%{realname}-%{version} \; |
---|
| 379 | |
---|
| 380 | %__rm -f %{buildroot}%{_docdir}/%{realname}-%{version}/Makefile.* |
---|
| 381 | fi |
---|
| 382 | } |
---|
| 383 | |
---|
| 384 | # Fix the RULE_PATH |
---|
| 385 | %__sed -e 's;var RULE_PATH ../rules;var RULE_PATH %{SnortRulesDir};' \ |
---|
| 386 | < etc/snort.conf > etc/snort.conf.new |
---|
| 387 | %__rm -f etc/snort.conf |
---|
| 388 | %__mv etc/snort.conf.new etc/snort.conf |
---|
| 389 | |
---|
| 390 | # Fix dynamic-preproc paths |
---|
| 391 | %__sed -e 's;dynamicpreprocessor directory \/usr\/local/lib\/snort_dynamicpreprocessor;dynamicpreprocessor directory %{_libdir}\/%{realname}-%{version}_dynamicpreprocessor;' < etc/snort.conf > etc/snort.conf.new |
---|
| 392 | %__rm -f etc/snort.conf |
---|
| 393 | %__mv etc/snort.conf.new etc/snort.conf |
---|
| 394 | |
---|
| 395 | # Fix dynamic-engine paths |
---|
| 396 | %__sed -e 's;dynamicengine \/usr\/local/lib\/snort_dynamicengine;dynamicengine %{_libdir}\/%{realname}-%{version}_dynamicengine;' < etc/snort.conf > etc/snort.conf.new |
---|
| 397 | %__rm -f etc/snort.conf |
---|
| 398 | %__mv etc/snort.conf.new etc/snort.conf |
---|
| 399 | |
---|
| 400 | |
---|
| 401 | # Always install snort-plain |
---|
| 402 | InstallSnort plain |
---|
| 403 | |
---|
| 404 | # Maybe install the others |
---|
| 405 | %if %{mysql} |
---|
| 406 | InstallSnort mysql |
---|
| 407 | %endif |
---|
| 408 | |
---|
| 409 | %if %{postgresql} |
---|
| 410 | InstallSnort postgresql |
---|
| 411 | %endif |
---|
| 412 | |
---|
| 413 | %if %{unixODBC} |
---|
| 414 | InstallSnort unixODBC |
---|
| 415 | %endif |
---|
| 416 | |
---|
| 417 | %if %{oracle} |
---|
| 418 | InstallSnort oracle |
---|
| 419 | %endif |
---|
| 420 | |
---|
| 421 | |
---|
[521] | 422 | %clean |
---|
[8191] | 423 | %__rm -rf %{buildroot} |
---|
[521] | 424 | |
---|
[8191] | 425 | |
---|
| 426 | %pre |
---|
| 427 | # Don't do all this stuff if we are upgrading |
---|
| 428 | if [ $1 = 1 ] ; then |
---|
| 429 | /usr/sbin/groupadd snort 2> /dev/null || true |
---|
| 430 | /usr/sbin/useradd -M -d %{_var}/log/snort -s %{noShell} -c "Snort" -g snort snort 2>/dev/null || true |
---|
[521] | 431 | fi |
---|
| 432 | |
---|
[8191] | 433 | %post mysql |
---|
| 434 | if [ -L %{_sbindir}/snort ] || [ ! -e %{_sbindir}/snort ] ; then |
---|
| 435 | %__rm -f %{_sbindir}/snort; %__ln_s -f %{_sbindir}/%{name}-mysql %{_sbindir}/snort |
---|
| 436 | fi |
---|
[521] | 437 | |
---|
[8191] | 438 | %post postgresql |
---|
| 439 | if [ -L %{_sbindir}/snort ] || [ ! -e %{_sbindir}/snort ] ; then |
---|
| 440 | %__rm -f %{_sbindir}/snort; %__ln_s -f %{_sbindir}/%{name}-postgresql %{_sbindir}/snort |
---|
| 441 | fi |
---|
[521] | 442 | |
---|
[8191] | 443 | %post unixODBC |
---|
| 444 | if [ -L %{_sbindir}/snort ] || [ ! -e %{_sbindir}/snort ] ; then |
---|
| 445 | %__rm -f %{_sbindir}/snort; %__ln_s -f %{_sbindir}/%{name}-unixODBC %{_sbindir}/snort |
---|
| 446 | fi |
---|
[521] | 447 | |
---|
| 448 | |
---|
[8191] | 449 | %post oracle |
---|
| 450 | if [ -L %{_sbindir}/snort ] || [ ! -e %{_sbindir}/snort ] ; then |
---|
| 451 | %__rm -f %{_sbindir}/snort; %__ln_s %{_sbindir}/%{name}-oracle %{_sbindir}/snort |
---|
| 452 | fi |
---|
[521] | 453 | |
---|
[8191] | 454 | %post |
---|
| 455 | # Make a symlink if there is no link for snort-plain |
---|
| 456 | if [ -L %{_sbindir}/snort ] || [ ! -e %{_sbindir}/snort ] ; then \ |
---|
| 457 | %__rm -f %{_sbindir}/snort; %__ln_s %{_sbindir}/%{name}-plain %{_sbindir}/snort; fi |
---|
[521] | 458 | |
---|
[8191] | 459 | # We should restart it to activate the new binary if it was upgraded |
---|
| 460 | %{_initrddir}/snortd condrestart 1>/dev/null 2>/dev/null |
---|
| 461 | |
---|
| 462 | # Don't do all this stuff if we are upgrading |
---|
| 463 | if [ $1 = 1 ] ; then |
---|
| 464 | %__chown -R snort.snort %{_var}/log/snort |
---|
| 465 | /sbin/chkconfig --add snortd |
---|
| 466 | fi |
---|
| 467 | |
---|
| 468 | |
---|
[521] | 469 | %preun |
---|
| 470 | if [ $1 = 0 ] ; then |
---|
[8191] | 471 | # We get errors about not running, but we don't care |
---|
| 472 | %{_initrddir}/snortd stop 2>/dev/null 1>/dev/null |
---|
[521] | 473 | /sbin/chkconfig --del snortd |
---|
| 474 | fi |
---|
| 475 | |
---|
| 476 | %postun |
---|
[8191] | 477 | # Try and restart, but don't bail if it fails |
---|
| 478 | if [ $1 -ge 1 ] ; then |
---|
| 479 | %{_initrddir}/snortd condrestart 1>/dev/null 2>/dev/null || : |
---|
| 480 | fi |
---|
| 481 | |
---|
| 482 | # Only do this if we are actually removing snort |
---|
[521] | 483 | if [ $1 = 0 ] ; then |
---|
[8191] | 484 | if [ -L %{_sbindir}/snort ]; then |
---|
| 485 | %__rm -f %{_sbindir}/snort |
---|
| 486 | fi |
---|
| 487 | |
---|
| 488 | /usr/sbin/userdel snort 2>/dev/null |
---|
[521] | 489 | fi |
---|
| 490 | |
---|
[8191] | 491 | %postun mysql |
---|
| 492 | if [ -L %{_sbindir}/snort ]; then |
---|
| 493 | %__rm -f %{_sbindir}/snort |
---|
| 494 | %__ln_s -f %{_sbindir}/%{name}-plain %{_sbindir}/snort |
---|
| 495 | fi |
---|
| 496 | |
---|
| 497 | %postun postgresql |
---|
| 498 | if [ -L %{_sbindir}/snort ]; then |
---|
| 499 | %__rm -f %{_sbindir}/snort |
---|
| 500 | %__ln_s -f %{_sbindir}/%{name}-plain %{_sbindir}/snort |
---|
| 501 | fi |
---|
| 502 | |
---|
| 503 | %postun unixODBC |
---|
| 504 | if [ -L %{_sbindir}/snort ]; then |
---|
| 505 | %__rm -f %{_sbindir}/snort |
---|
| 506 | %__ln_s -f %{_sbindir}/%{name}-plain %{_sbindir}/snort |
---|
| 507 | fi |
---|
| 508 | |
---|
| 509 | %postun oracle |
---|
| 510 | if [ -L %{_sbindir}/snort ]; then |
---|
| 511 | %__rm -f %{_sbindir}/snort |
---|
| 512 | %__ln_s -f %{_sbindir}/%{name}-plain %{_sbindir}/snort |
---|
| 513 | fi |
---|
| 514 | |
---|
[521] | 515 | %files |
---|
[8191] | 516 | %defattr(-,root,root,-) |
---|
| 517 | %{_sbindir}/%{name}-plain |
---|
| 518 | %{_mandir}/man8/snort.8.* |
---|
| 519 | %dir %{SnortRulesDir} |
---|
| 520 | %config(noreplace) %{_sysconfdir}/snort/classification.config |
---|
| 521 | %config(noreplace) %{_sysconfdir}/snort/reference.config |
---|
| 522 | %config(noreplace) %{_sysconfdir}/snort/threshold.conf |
---|
| 523 | %config(noreplace) %{_sysconfdir}/snort/*.map |
---|
| 524 | %config(noreplace) %{_sysconfdir}/logrotate.d/snort |
---|
| 525 | %config(noreplace) %{_sysconfdir}/snort/snort.conf |
---|
| 526 | %config(noreplace) %{_sysconfdir}/sysconfig/snort |
---|
| 527 | %config(noreplace) %{_initrddir}/snortd |
---|
| 528 | %attr(0755,snort,snort) %dir %{_var}/log/snort |
---|
| 529 | %dir %{_sysconfdir}/snort |
---|
| 530 | %{_docdir}/%{realname}-%{version}/* |
---|
| 531 | %dir %{_libdir}/%{realname}-%{version}_dynamicengine |
---|
| 532 | %{_libdir}/%{realname}-%{version}_dynamicengine/libsf_engine.* |
---|
| 533 | %dir %{_libdir}/%{realname}-%{version}_dynamicpreprocessor |
---|
| 534 | %{_libdir}/%{realname}-%{version}_dynamicpreprocessor/libsf_*_preproc.* |
---|
[521] | 535 | |
---|
[8191] | 536 | %dir %{_docdir}/%{realname}-%{version} |
---|
| 537 | %docdir %{_docdir}/%{realname}-%{version} |
---|
| 538 | |
---|
| 539 | %if %{mysql} |
---|
| 540 | %files mysql |
---|
| 541 | %defattr(-,root,root,-) |
---|
| 542 | %{_sbindir}/%{name}-mysql |
---|
| 543 | %endif |
---|
| 544 | |
---|
| 545 | %if %{postgresql} |
---|
| 546 | %files postgresql |
---|
| 547 | %defattr(-,root,root,-) |
---|
| 548 | %{_sbindir}/%{name}-postgresql |
---|
| 549 | %endif |
---|
| 550 | |
---|
| 551 | %if %{unixODBC} |
---|
| 552 | %files unixODBC |
---|
| 553 | %defattr(-,root,root,-) |
---|
| 554 | %{_sbindir}/%{name}-unixODBC |
---|
| 555 | %endif |
---|
| 556 | |
---|
| 557 | %if %{oracle} |
---|
| 558 | %files oracle |
---|
| 559 | %defattr(-,root,root,-) |
---|
| 560 | %{_sbindir}/%{name}-oracle |
---|
| 561 | %endif |
---|
| 562 | |
---|
| 563 | |
---|
[521] | 564 | %changelog |
---|
[8191] | 565 | * Wed Jan 15 2014 Yoji TOYODA <bsyamato@sea.plala.or.jp> - 2.9.5.6-1 |
---|
| 566 | - new upstream release |
---|
[521] | 567 | |
---|
[8191] | 568 | * Fri Mar 16 2012 MATSUBAYASHI Kohji <shaolin@vinelinux.org> - 2.9.2.1-1 |
---|
| 569 | - initial build for Vine Linux (based on official srpm) |
---|