wok view snort-mysql/receipt @ rev 25155
updated proxytunnel (1.9.0 -> 1.10)
author | Hans-G?nter Theisgen |
---|---|
date | Thu Jun 30 15:35:33 2022 +0100 (2022-06-30) |
parents | 970deba23db6 |
children |
line source
1 # SliTaz package receipt.
3 PACKAGE="snort-mysql"
4 VERSION="2.9.4"
5 CATEGORY="network"
6 SHORT_DESC="Network intrusion prevention and detection system (IDS/IPS) with MySQL support."
7 MAINTAINER="pascal.bellard@slitaz.org"
8 LICENSE="GPL2"
9 TARBALL="$PACKAGE-$VERSION.tar.gz"
10 WEB_SITE="https://github.com/snort3/snort3"
11 WGET_URL="https://download.tuxfamily.org/slitaz/sources/packages-cooking/${TARBALL:0:1}/$TARBALL"
12 DEPENDS="pcre libdnet libdaq libmysqlclient"
13 BUILD_DEPENDS="pcre-dev libpcap-dev libdaq-dev libdnet-dev wget zlib-dev \
14 mysql-dev flex"
16 # What is the latest version available today?
17 current_version()
18 {
19 wget -O - https://www.snort.org/downloads 2>/dev/null | \
20 sed '/tar.gz/!d;/snort[0-9]*-[0-9]/!d;s|.*snort[0-9]*-||;s|.t.*||' | sort -Vr | sed q
21 }
23 # Rules to configure and make the package.
24 compile_rules()
25 {
26 ./configure \
27 --prefix=/usr \
28 --with-mysql \
29 --enable-dynamicplugin \
30 --enable-perfprofiling \
31 --enable-zlib \
32 --enable-reload \
33 $CONFIGURE_ARGS &&
34 make &&
35 make DESTDIR=$DESTDIR install
36 }
38 # Rules to gen a SliTaz package suitable for Tazpkg.
39 genpkg_rules()
40 {
41 mkdir -p \
42 $fs/usr/lib \
43 $fs/etc/snort/rules \
44 $fs/usr/share/snort/schemas \
45 $fs/var/log/snort
47 cp -a $install/usr/bin $fs/usr
48 cp -a $install/usr/lib/snort_dynamic* $fs/usr/lib
50 cp -a $src/etc/*.conf* $fs/etc/snort
51 cp -a $src/etc/*.map $fs/etc/snort
52 cp -a $src/schemas/create_mysql $fs/usr/share/snort/schemas
54 # Remove unwanted files
55 rm -f $fs/usr/lib/*/*.*a
56 }
58 # Post install commands
59 post_install()
60 {
61 local db_name=snort
62 local db_pass=snort
63 local db_schema=/usr/share/snort/create_mysql
65 newline
67 # addgroup snort if needed
68 if ! grep -q snort "$1/etc/group"; then
69 action 'Adding group snort...'
70 chroot "$1/" /bin/addgroup snort
71 status
72 fi
73 # adduser snort if needed
74 if ! grep -q 'snort:' "$1/etc/passwd"; then
75 action 'Adding user snort...'
76 chroot "$1/" /bin/adduser -s /bin/false -h /dev/null \
77 -g "Snort Daemon user" -H -D -S -G snort snort
78 status
79 fi
80 chroot "$1/" chown snort.snort /var/log/snort
82 # Create database
83 if [ -z "$1" ]; then
84 if ( ! mysqladmin -s ping > /dev/null ); then
85 echo 'Starting MySQL server'
86 ( /etc/init.d/mysql start ; status ) || exit
87 sleep 4 #let the mysql daemon start
88 fi
89 if ( ! mysql -u root -Be 'show databases' | grep -q $db_name ); then
90 action 'Create $db_name database'
91 mysql -Be "create database $db_name"
92 status
93 # We suppose that user does not exist.
94 # It may be false.
95 action 'Create user $db_user with password $db_pass'
96 mysql -Be "grant all privileges on glpi.* to $db_user@'localhost' identified by '$db_pass'"
97 status
98 # At last create the database for package
99 action 'Create $db_name database schema.'
100 mysql -u $db_user -p${db_pass} $db_name < $db_schema
101 status
102 fi
103 fi
104 }