wok-next annotate snort-mysql/receipt @ rev 21423

updated puzzles again ( -> 20200413)
author Hans-G?nter Theisgen
date Mon Apr 27 17:56:50 2020 +0100 (2020-04-27)
parents d5aab818505e
children
rev   line source
al@20604 1 # SliTaz package receipt v2.
erjo@11428 2
erjo@11428 3 PACKAGE="snort-mysql"
samuel_trassare@14145 4 VERSION="2.9.4"
erjo@11428 5 CATEGORY="network"
al@20604 6 SHORT_DESC="Network intrusion prevention and detection system (IDS/IPS) with \
al@20604 7 MySQL support"
erjo@11428 8 MAINTAINER="pascal.bellard@slitaz.org"
pascal@15002 9 LICENSE="GPL2"
al@21041 10 WEB_SITE="https://www.snort.org/"
al@20888 11 REPOLOGY="snort"
al@20604 12
erjo@11428 13 TARBALL="$PACKAGE-$VERSION.tar.gz"
erjo@11428 14 WGET_URL="http://www.snort.org/downloads/1207"
al@20604 15
al@20513 16 BUILD_DEPENDS="pcre-dev libpcap-dev libdaq-dev libdnet-dev zlib-dev \
al@18741 17 mysql-dev flex"
erjo@11428 18
al@20604 19 compile_rules() {
samuel_trassare@14145 20 ./configure \
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 &&
al@20604 27 fix libtool &&
erjo@11428 28 make &&
al@21020 29 make DESTDIR=$install install
erjo@11428 30 }
erjo@11428 31
al@20604 32 genpkg_rules() {
al@18741 33 mkdir -p \
al@18741 34 $fs/usr/lib \
erjo@11428 35 $fs/etc/snort/rules \
erjo@11428 36 $fs/usr/share/snort/schemas \
al@18741 37 $fs/var/log/snort
al@18741 38
samuel_trassare@14145 39 cp -a $install/usr/bin $fs/usr
samuel_trassare@14145 40 cp -a $install/usr/lib/snort_dynamic* $fs/usr/lib
al@18741 41
erjo@11428 42 cp -a $src/etc/*.conf* $fs/etc/snort
al@20604 43 cp -a $src/etc/*.map $fs/etc/snort
erjo@11428 44 cp -a $src/schemas/create_mysql $fs/usr/share/snort/schemas
al@18741 45
erjo@11428 46 # Remove unwanted files
erjo@11428 47 rm -f $fs/usr/lib/*/*.*a
al@20604 48 DEPENDS="pcre libdnet libdaq libmysqlclient"
erjo@11428 49 }
erjo@11428 50
al@20604 51 post_install() {
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
al@18741 56 newline
erjo@11428 57
erjo@11428 58 # addgroup snort if needed
al@18741 59 if ! grep -q snort "$1/etc/group"; then
al@18741 60 chroot "$1/" /bin/addgroup snort
al@18741 61 fi
al@18741 62 # adduser snort if needed
al@18741 63 if ! grep -q 'snort:' "$1/etc/passwd"; then
al@18741 64 chroot "$1/" /bin/adduser -s /bin/false -h /dev/null \
al@18741 65 -g "Snort Daemon user" -H -D -S -G snort snort
al@18741 66 fi
al@21020 67 chroot "$1/" chown snort.snort /var/log/snort
erjo@11428 68
erjo@11428 69 # Create database
al@18741 70 if [ -z "$1" ]; then
al@20604 71 if ( ! mysqladmin -s ping >/dev/null ); then
al@18741 72 echo 'Starting MySQL server'
al@21020 73 ( /etc/init.d/mysql start; status ) || exit
al@18741 74 sleep 4 #let the mysql daemon start
al@18741 75 fi
al@18741 76 if ( ! mysql -u root -Be 'show databases' | grep -q $db_name ); then
al@18741 77 action 'Create $db_name database'
al@18741 78 mysql -Be "create database $db_name"
al@18741 79 status
al@18741 80 # We suppose that user does not exist.
al@18741 81 # It may be false.
al@18741 82 action 'Create user $db_user with password $db_pass'
al@18741 83 mysql -Be "grant all privileges on glpi.* to $db_user@'localhost' identified by '$db_pass'"
al@18741 84 status
al@18741 85 # At last create the database for package
al@18741 86 action 'Create $db_name database schema.'
al@18741 87 mysql -u $db_user -p${db_pass} $db_name < $db_schema
al@18741 88 status
al@18741 89 fi
al@18741 90 fi
erjo@11428 91 }