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