#!/bin/bash # # ossec.SlackBuild is free software; you can redistribute it and/or modify it under the # terms of the GNU General Public License as published by the Free Software # Foundation; either version 2 of the License, or any later version. # # ossec.SlackBuild is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR # A PARTICULAR PURPOSE. See the GNU General Public License for more details. # # You should have received a copy of the GNU General Public License along with # this program; if not, write to the Free Software Foundation, Inc., 59 Temple # Place - Suite 330, Boston, MA 02111-1307, USA # # default settings PACKAGE="ossec" PACKAGE_EXT="gz" VERSION=${VERSION:=2.8.3} BUILD=${BUILD:=2} if [ -f ~/.slackbuildrc ]; then . ~/.slackbuildrc elif [ -f ../../runtime/slackbuildrc ]; then . ../../runtime/slackbuildrc fi # Check for ossec accounts here if ! grep ^ossec: /etc/group 2>&1 > /dev/null; then groupadd -g 302 ossec fi if ! grep ^ossec: /etc/passwd 2>&1 > /dev/null; then useradd -d /var/ossec -s /bin/false -u 302 -g 302 -c "Ossec" ossec passwd -l ossec &>/dev/null fi if ! grep ^ossecm: /etc/passwd 2>&1 > /dev/null; then useradd -d /var/ossec -s /bin/false -u 303 -g 302 -c "Ossec" ossecm passwd -l ossecm &>/dev/null fi if ! grep ^ossecr: /etc/passwd 2>&1 > /dev/null; then useradd -d /var/ossec -s /bin/false -u 304 -g 302 -c "Ossec" ossecr passwd -l ossecr &>/dev/null fi check_required SRC="v$VERSION.tar.$PACKAGE_EXT" URL="https://github.com/ossec/ossec-hids/archive/${SRC}" get_source $SRC $URL unpack_source $SRC ossec-hids-$VERSION _instdir=/var/ossec export USER_NO_STOP=yes export USER_LANGUAGE=en export USER_INSTALL_TYPE=server export USER_DIR=$_instdir . "$CWD/ossec.config" # load configuration # fix placement of ossec-init.conf mkdir -p $PKG/etc sed -i "s|^OSSEC_INIT.*|OSSEC_INIT=\"$PKG/etc/ossec-init.conf\"|" src/init/shared.sh # change the install location sed -i "s|^DIR=.*|DIR=$PKG/$_instdir|" src/InstallServer.sh ./install.sh ( cd $PKG/var/ossec/etc mv ossec.conf ossec.conf.new mv internal_options.conf internal_options.conf.new touch local_decoder.xml.new chgrp ossec local_decoder.xml.new ) ( cd $PKG/var/ossec/rules mv local_rules.xml local_rules.xml.new ) # install rc initscript install -D -m755 $CWD/ossec.rc $PKG/etc/rc.d/init.d/ossec install -D -m755 $CWD/ossec.setup $PKG/var/log/setup/setup.ossec install -D -m644 $CWD/ossec.logrotate $PKG/etc/logrotate.d/ossec mkdir -p $DOCS cp -a BUGS CONFIG CONTRIBUTORS INSTALL LICENSE README.md doc/* $DOCS rm -rf $DOCS/br $DOCS/pl fixup_package $PKG # Clean up the extra stuff: set +u if [ "$1" = "--cleanup" ]; then rm -rf $TMP/$PACKAGE-$VERSION rm -rf $PKG fi