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