wok-current annotate snort-mysql/receipt @ rev 11513

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