wok-next annotate snort-mysql/receipt @ rev 20513
A lot of tiny edits; remove wget and pkg-build from $BUILD_DEPENDS and from *-dev packages $DEPENDS.
author | Aleksej Bobylev <al.bobylev@gmail.com> |
---|---|
date | Wed Mar 21 15:58:17 2018 +0200 (2018-03-21) |
parents | 6fab3264ba87 |
children | 10df65db91ad |
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" |
al@20513 | 13 BUILD_DEPENDS="pcre-dev libpcap-dev libdaq-dev libdnet-dev zlib-dev \ |
al@18741 | 14 mysql-dev flex" |
erjo@11428 | 15 |
erjo@11428 | 16 # Rules to configure and make the package. |
erjo@11428 | 17 compile_rules() |
erjo@11428 | 18 { |
samuel_trassare@14145 | 19 ./configure \ |
samuel_trassare@14145 | 20 --prefix=/usr \ |
erjo@11428 | 21 --with-mysql \ |
erjo@11428 | 22 --enable-dynamicplugin \ |
erjo@11428 | 23 --enable-perfprofiling \ |
erjo@11428 | 24 --enable-zlib \ |
erjo@11428 | 25 --enable-reload \ |
samuel_trassare@14145 | 26 $CONFIGURE_ARGS && |
erjo@11428 | 27 make && |
samuel_trassare@14145 | 28 make DESTDIR=$DESTDIR install |
erjo@11428 | 29 } |
erjo@11428 | 30 |
erjo@11428 | 31 # Rules to gen a SliTaz package suitable for Tazpkg. |
erjo@11428 | 32 genpkg_rules() |
erjo@11428 | 33 { |
al@18741 | 34 mkdir -p \ |
al@18741 | 35 $fs/usr/lib \ |
erjo@11428 | 36 $fs/etc/snort/rules \ |
erjo@11428 | 37 $fs/usr/share/snort/schemas \ |
al@18741 | 38 $fs/var/log/snort |
al@18741 | 39 |
samuel_trassare@14145 | 40 cp -a $install/usr/bin $fs/usr |
samuel_trassare@14145 | 41 cp -a $install/usr/lib/snort_dynamic* $fs/usr/lib |
al@18741 | 42 |
erjo@11428 | 43 cp -a $src/etc/*.conf* $fs/etc/snort |
erjo@11428 | 44 cp -a $src/etc/*.map $fs/etc/snort |
erjo@11428 | 45 cp -a $src/schemas/create_mysql $fs/usr/share/snort/schemas |
al@18741 | 46 |
erjo@11428 | 47 # Remove unwanted files |
erjo@11428 | 48 rm -f $fs/usr/lib/*/*.*a |
erjo@11428 | 49 } |
erjo@11428 | 50 |
erjo@11428 | 51 # Post install commands |
erjo@11428 | 52 post_install() |
erjo@11428 | 53 { |
erjo@11428 | 54 local db_name=snort |
erjo@11428 | 55 local db_pass=snort |
erjo@11428 | 56 local db_schema=/usr/share/snort/create_mysql |
erjo@11428 | 57 |
al@18741 | 58 newline |
erjo@11428 | 59 |
erjo@11428 | 60 # addgroup snort if needed |
al@18741 | 61 if ! grep -q snort "$1/etc/group"; then |
al@18741 | 62 action 'Adding group snort...' |
al@18741 | 63 chroot "$1/" /bin/addgroup snort |
al@18741 | 64 status |
al@18741 | 65 fi |
al@18741 | 66 # adduser snort if needed |
al@18741 | 67 if ! grep -q 'snort:' "$1/etc/passwd"; then |
al@18741 | 68 action 'Adding user snort...' |
al@18741 | 69 chroot "$1/" /bin/adduser -s /bin/false -h /dev/null \ |
al@18741 | 70 -g "Snort Daemon user" -H -D -S -G snort snort |
al@18741 | 71 status |
al@18741 | 72 fi |
pascal@18730 | 73 chroot "$1/" chown snort.snort /var/log/snort |
erjo@11428 | 74 |
erjo@11428 | 75 # Create database |
al@18741 | 76 if [ -z "$1" ]; then |
al@18741 | 77 if ( ! mysqladmin -s ping > /dev/null ); then |
al@18741 | 78 echo 'Starting MySQL server' |
al@18741 | 79 ( /etc/init.d/mysql start ; status ) || exit |
al@18741 | 80 sleep 4 #let the mysql daemon start |
al@18741 | 81 fi |
al@18741 | 82 if ( ! mysql -u root -Be 'show databases' | grep -q $db_name ); then |
al@18741 | 83 action 'Create $db_name database' |
al@18741 | 84 mysql -Be "create database $db_name" |
al@18741 | 85 status |
al@18741 | 86 # We suppose that user does not exist. |
al@18741 | 87 # It may be false. |
al@18741 | 88 action 'Create user $db_user with password $db_pass' |
al@18741 | 89 mysql -Be "grant all privileges on glpi.* to $db_user@'localhost' identified by '$db_pass'" |
al@18741 | 90 status |
al@18741 | 91 # At last create the database for package |
al@18741 | 92 action 'Create $db_name database schema.' |
al@18741 | 93 mysql -u $db_user -p${db_pass} $db_name < $db_schema |
al@18741 | 94 status |
al@18741 | 95 fi |
al@18741 | 96 fi |
erjo@11428 | 97 } |