slackbuilds/UNUSED/n/artillery/SlackBuild
2020-07-12 09:22:26 +02:00

97 lines
2.4 KiB
Bash
Executable file
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/sh
# variables
VERSION=$(date +"%Y.%m.%d_%H.%M")
BUILD=1
TAG=gwh
TMP=/tmp/$TAG
CWD=$(pwd)
OUTPUT=/tmp
PRGNAM=$(basename $CWD)
PKG=$TMP/pkg-$PRGNAM
ARCH=noarch
REPOSITORY=/home/installs/SlackBuilds/repositories/$PRGNAM
# nettoyage préalable
rm -fr $PKG $TMP/$PRGNAM-$VERSION
# mise en place
cd $TMP
if [ ! -e $REPOSITORY ] ; then
svn co http://svn.secmaniac.com/artillery $REPOSITORY
else
( cd $REPOSITORY
svn update
)
fi
mkdir -p $PKG/{var/,etc/rc.d/,usr/doc/$PRGNAM/}
cp -R $REPOSITORY $PKG/var/
cd $PKG/var/$PRGNAM
find . -name .svn -exec rm -fr {} \;
mv README readme/ install.py $PKG/usr/doc/$PRGNAM/
cat <<EOF > $PKG/etc/rc.d/rc.$PRGNAM
#!/bin/bash
case "\$1" in
'start')
python /var/$PRGNAM/$PRGNAM.py &
echo \$! > /var/run/$PRGNAM.pid
;;
'stop')
[ -e /var/run/$PRGNAM.pid ] && kill \$(cat /var/run/$PRGNAM.pid) && rm /var/run/$PRGNAM.pid
;;
'restart')
\$0 stop
sleep 1
\$0 start
;;
esac
EOF
#chmod +x $PKG/etc/rc.d/rc.$PRGNAM
# correction
cd $PKG
chown -R root:root *
# embaumement
mkdir -p $PKG/install
cat <<EOF > $PKG/install/doinst.sh
#!/bin/sh
grep -q "/etc/rc.d/rc.$PRGNAM" /etc/rc.d/rc.local || cat <<FOE >> /etc/rc.d/rc.local
[ -x /etc/rc.d/rc.$PRGNAM ] && /etc/rc.d/rc.$PRGNAM start
FOE
EOF
cat <<EOF > $PKG/install/slack-desc
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|'
# on the right side marks the last column you can put a character in. You must
# make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':'.
|-----handy-ruler------------------------------------------------------|
$PRGNAM: $PRGNAM (Network Security tool)
$PRGNAM:
$PRGNAM: Artillery is a combination of a honeypot, file monitoring and
$PRGNAM: integrity, alerting, and brute force prevention tool. Its extremely
$PRGNAM: light weight, has multiple different methods for detecting specific
$PRGNAM: attacks and eventually will also notify you of insecure nix
$PRGNAM: configurations.
$PRGNAM:
$PRGNAM:
$PRGNAM: http://www.secmaniac.com/blog/2011/10/14/new-tool-release-artillery-for-linux-protection/
$PRGNAM:
EOF
# empaquetage
cd $PKG
rm -f $PKG/{,usr/}lib$(uname -m | grep -o 64)/*.la
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.txz