source: npl/monitoring/fail2ban/fail2ban.SlackBuild @ c5c522c

gcc484ntopperl-5.22
Last change on this file since c5c522c was c5c522c, checked in by Edwin Eefting <edwin@datux.nl>, 8 years ago

initial commit, transferred from cleaned syn3 svn tree

  • Property mode set to 100755
File size: 3.3 KB
Line 
1#!/bin/sh
2
3# Slackware Package Build Script for fail2ban
4# Home Page http://www.fail2ban.org/wiki/index.php/Main_Page
5
6# Copyright (c) 2008-2010, Nishant Limbachia, Hoffman Estates, IL, USA
7# <nishant _AT_ mnspace _DOT_ net>
8# All rights reserved.
9
10# Redistribution and use of this script, with or without modification, is
11# permitted provided that the following conditions are met:
12
13# 1. Redistributions of script must retain the above copyright notice,
14#    this list of conditions and the following disclaimer.
15
16# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
20# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
23# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
24# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
25# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
28PRGNAM=fail2ban
29VERSION=${VERSION:-0.8.4}
30BUILD=${BUILD:-1}
31TAG=${TAG:-_SBo}
32
33# Automatically determine the architecture we're building on:
34if [ -z "$ARCH" ]; then
35  case "$( uname -m )" in
36    i?86) ARCH=i486 ;;
37    arm*) ARCH=arm ;;
38    # Unless $ARCH is already set, use uname -m for all other archs:
39       *) ARCH=$( uname -m ) ;;
40  esac
41fi
42
43CWD=$(pwd)
44TMP=${TMP:-/tmp/SBo}
45PKG=$TMP/package-$PRGNAM
46OUTPUT=${OUTPUT:-/tmp}
47
48set -e
49
50# clean up from previous builds
51rm -fr $PKG $TMP/$PRGNAM-$VERSION
52mkdir -p $PKG $TMP $OUTPUT
53cd $TMP
54tar xjf $CWD/$PRGNAM-$VERSION.tar.bz2
55cd $TMP/$PRGNAM-$VERSION
56chown -R root.root .
57find . \
58\( -perm 777 -o -perm 775 -o -perm 771 -o -perm 711 -o -perm 555 -o -perm 551 -o -perm 511 \) \
59-exec chmod 755 {} \; -o \
60\( -perm 666 -o -perm 664 -o -perm 660 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
61-exec chmod 644 {} \;
62
63python setup.py install --root=$PKG
64
65# installing man pages
66mkdir -p $PKG/usr/man/man1
67install -m 0644 man/fail2ban-client.1 man/fail2ban-regex.1 \
68man/fail2ban-server.1 $PKG/usr/man/man1
69
70# move config files to .new
71( cd $PKG/etc/fail2ban
72  for file in $(find . -type f); do
73    mv $file "$file.new"
74  done
75)
76# compress man pages
77( cd $PKG/usr/man
78  find . -type f -exec gzip -9 {} \;
79  for i in $(find . -type l) ; do ln -s $(readlink $i).gz $i.gz ; rm $i ; done
80)
81
82# install startup script
83install -D -m 0644 $CWD/rc.fail2ban $PKG/etc/rc.d/rc.fail2ban.new
84
85# install logrotate script
86install -D -m 0644 $CWD/fail2ban.logrotate $PKG/etc/logrotate.d/fail2ban.new
87
88# make directory for socket and pid file
89mkdir -p $PKG/var/run/fail2ban
90
91mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
92cp -a COPYING ChangeLog PKG-INFO README TODO $PKG/usr/doc/$PRGNAM-$VERSION
93cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
94
95#xbit startup script
96chmod +x $PKG/etc/rc.d/rc.fail2ban.new
97
98# building package
99mkdir -p $PKG/install
100cat $CWD/doinst.sh > $PKG/install/doinst.sh
101cat $CWD/slack-desc > $PKG/install/slack-desc
102
103cd $PKG
104/sbin/makepkg -l n -c n $CWD/$PRGNAM.pkg
105echo $VERSION > $CWD/$PRGNAM.version &&
106arch > $CWD/$PRGNAM.arch
107cd $OUTPUT
Note: See TracBrowser for help on using the repository browser.