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