wok-next view snort-mysql/receipt @ rev 21724

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