wok-current view snort-mysql/receipt @ rev 16167
ARM: improve slitaz-configs*
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Sat Mar 29 13:56:21 2014 +0100 (2014-03-29) |
parents | 3824a7102b48 |
children | 9e01bc6321ea |
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 mysql-dev flex"
15 # Rules to configure and make the package.
16 compile_rules()
17 {
18 ./configure \
19 --prefix=/usr \
20 --with-mysql \
21 --enable-dynamicplugin \
22 --enable-perfprofiling \
23 --enable-zlib \
24 --enable-reload \
25 $CONFIGURE_ARGS &&
26 make &&
27 make DESTDIR=$DESTDIR install
28 }
30 # Rules to gen a SliTaz package suitable for Tazpkg.
31 genpkg_rules()
32 {
33 mkdir -p $fs/usr/lib \
34 $fs/etc/snort/rules \
35 $fs/usr/share/snort/schemas \
36 $fs/var/log/snort
38 cp -a $install/usr/bin $fs/usr
39 cp -a $install/usr/lib/snort_dynamic* $fs/usr/lib
41 cp -a $src/etc/*.conf* $fs/etc/snort
42 cp -a $src/etc/*.map $fs/etc/snort
43 cp -a $src/schemas/create_mysql $fs/usr/share/snort/schemas
45 # Remove unwanted files
46 rm -f $fs/usr/lib/*/*.*a
47 }
50 # Post install commands
51 post_install()
52 {
53 local db_name=snort
54 local db_pass=snort
55 local db_schema=/usr/share/snort/create_mysql
57 echo "Processing post install commands..."
59 # addgroup snort if needed
60 if ! grep -q snort $1/etc/group; then
61 echo -n "Adding group Snort..."
62 chroot $1/ /bin/addgroup snort
63 status
64 fi
65 # adduser snort if needed
66 if ! grep -q 'snort:' $1/etc/passwd; then
67 echo -n "Adding user Snort..."
68 chroot $1/ /bin/adduser -s /bin/false -h /dev/null \
69 -g "Snort Daemon user" -H -D -S -G snort snort
70 status
71 fi
72 chroot $1/ chown snort.snort /var/log/snort
74 # Create database
75 if [ -z $1 ]; then
76 if ( ! mysqladmin -s ping > /dev/null ); then
77 echo "Starting MySQL server"
78 ( /etc/init.d/mysql start ; status ) || exit
79 sleep 4 #let the mysql daemon start
80 fi
81 if ( ! mysql -u root -Be 'show databases' | grep -q $db_name ); then
82 echo -n "Create $db_name database"
83 mysql -Be "create database $db_name" ;
84 # We suppose that user does not exist.
85 # It may be false.
86 echo -n "Create user $db_user with password $db_pass"
87 mysql -Be "grant all privileges on glpi.* to $db_user@'localhost'
88 identified by '$db_pass'" ; status
89 # At last create the database for package
90 echo -n "Create $db_name database schema."
91 mysql -u $db_user -p${db_pass} $db_name < $db_schema ; status
93 fi
95 fi
98 }