wok view snort-mysql/receipt @ rev 20580

go: force arch
author Pascal Bellard <pascal.bellard@slitaz.org>
date Thu Dec 13 22:11:22 2018 +0100 (2018-12-13)
parents 9e01bc6321ea
children a78610b2eb47
line source
1 # SliTaz package receipt.
3 PACKAGE="snort-mysql"
4 VERSION="2.9.4"
5 CATEGORY="network"
6 SHORT_DESC="Network intrusion prevention and detection system (IDS/IPS) with MySQL support."
7 MAINTAINER="pascal.bellard@slitaz.org"
8 LICENSE="GPL2"
9 TARBALL="$PACKAGE-$VERSION.tar.gz"
10 WEB_SITE="http://www.snort.org/"
11 WGET_URL="http://www.snort.org/downloads/1207"
12 DEPENDS="pcre libdnet libdaq libmysqlclient"
13 BUILD_DEPENDS="pcre-dev libpcap-dev libdaq-dev libdnet-dev wget zlib-dev \
14 mysql-dev flex"
16 # Rules to configure and make the package.
17 compile_rules()
18 {
19 ./configure \
20 --prefix=/usr \
21 --with-mysql \
22 --enable-dynamicplugin \
23 --enable-perfprofiling \
24 --enable-zlib \
25 --enable-reload \
26 $CONFIGURE_ARGS &&
27 make &&
28 make DESTDIR=$DESTDIR install
29 }
31 # Rules to gen a SliTaz package suitable for Tazpkg.
32 genpkg_rules()
33 {
34 mkdir -p \
35 $fs/usr/lib \
36 $fs/etc/snort/rules \
37 $fs/usr/share/snort/schemas \
38 $fs/var/log/snort
40 cp -a $install/usr/bin $fs/usr
41 cp -a $install/usr/lib/snort_dynamic* $fs/usr/lib
43 cp -a $src/etc/*.conf* $fs/etc/snort
44 cp -a $src/etc/*.map $fs/etc/snort
45 cp -a $src/schemas/create_mysql $fs/usr/share/snort/schemas
47 # Remove unwanted files
48 rm -f $fs/usr/lib/*/*.*a
49 }
51 # Post install commands
52 post_install()
53 {
54 local db_name=snort
55 local db_pass=snort
56 local db_schema=/usr/share/snort/create_mysql
58 newline
60 # addgroup snort if needed
61 if ! grep -q snort "$1/etc/group"; then
62 action 'Adding group snort...'
63 chroot "$1/" /bin/addgroup snort
64 status
65 fi
66 # adduser snort if needed
67 if ! grep -q 'snort:' "$1/etc/passwd"; then
68 action 'Adding user snort...'
69 chroot "$1/" /bin/adduser -s /bin/false -h /dev/null \
70 -g "Snort Daemon user" -H -D -S -G snort snort
71 status
72 fi
73 chroot "$1/" chown snort.snort /var/log/snort
75 # Create database
76 if [ -z "$1" ]; then
77 if ( ! mysqladmin -s ping > /dev/null ); then
78 echo 'Starting MySQL server'
79 ( /etc/init.d/mysql start ; status ) || exit
80 sleep 4 #let the mysql daemon start
81 fi
82 if ( ! mysql -u root -Be 'show databases' | grep -q $db_name ); then
83 action 'Create $db_name database'
84 mysql -Be "create database $db_name"
85 status
86 # We suppose that user does not exist.
87 # It may be false.
88 action 'Create user $db_user with password $db_pass'
89 mysql -Be "grant all privileges on glpi.* to $db_user@'localhost' identified by '$db_pass'"
90 status
91 # At last create the database for package
92 action 'Create $db_name database schema.'
93 mysql -u $db_user -p${db_pass} $db_name < $db_schema
94 status
95 fi
96 fi
97 }