#!/bin/sh ############################# ## Build script for: syslog-ng ## Creator: http://kaneda.bohater.net/slackware ## Date: 2006.02.04 ## Source location: http:// MYIN="kan" SLKCFLAGS="-O2 -march=i486 -mcpu=i686" ARCH="i486" WGET="/usr/bin/wget -c" CWD=`pwd` TMP=/tmp PKG_DIR="/usr/src/slackpackages" ######################### ## Lets set the name of the program here so we can use it later. NAME=syslog-ng ## Set the versions for packages here, these must match the source file version. PROGRAM_VER=1.6.11 ## Set the BUILD the $MYIN comes from the global config file in /etc BUILD=1$MYIN ## Location to download the source SRC_LOC="http://www.balabit.com/downloads/syslog-ng/1.6/src/$NAME-$PROGRAM_VER.tar.gz" ## Set initial variables these should be standard in most packages: PKG=$TMP/package-$NAME if [ ! -d "$PKG_DIR" ] ; then mkdir -p $PKG_DIR fi ## Now we go grab the source for the user. Again global config has the wget line ## We will check if it is here and if not then download if [ -f $CWD/$NAME-$PROGRAM_VER.tar.gz ]; then echo "Source present not downloading" else $WGET $SRC_LOC || true fi if [ ! -f $CWD/$NAME-$PROGRAM_VER.tar.gz ]; then echo "ERROR: File cant be downloaded" exit fi ## Ok time to make sure the area is clean and unarchive the file rm -rf $PKG mkdir -p $PKG cd $TMP rm -rf $NAME-$PROGRAM_VER tar xvzf $CWD/$NAME-$PROGRAM_VER.tar.gz # Compile cd $TMP/$NAME-$PROGRAM_VER if [ "`pwd`" == "/tmp" ] ; then echo "ERROR: something is wrong... we cant cd $TMP/$NAME-$PROGRAM_VER" exit fi chown -R root.root . export CFLAGS=$SLKCFLAGS ./configure --prefix=/usr --sysconfdir=/etc make make install DESTDIR=$PKG # Doc files mkdir -p $PKG/usr/doc/$NAME-$PROGRAM_VER cp -f AUTHORS COPYING ChangeLog INSTALL NEWS PORTS README README.spoof \ syslog-ng.spec $PKG/usr/doc/$NAME-$PROGRAM_VER/ cp -fr doc $PKG/usr/doc/$NAME-$PROGRAM_VER/ mkdir -p $PKG/etc/rc.d mkdir $PKG/etc/syslog-ng cp -f doc/syslog-ng.conf.sample $PKG/etc/syslog-ng/syslog-ng.conf.new cat > $PKG/etc/rc.d/rc.syslog-ng.new << __END__ #!/bin/sh # Start/stop/restart the system logging daemons. # # Written for Slackware Linux by Patrick J. Volkerding . # Modyfied for syslog-ng by Kanedaaa syslogng_start() { if [ -x /usr/sbin/syslog-ng ]; then echo -n "Starting syslog-ng daemon: " echo " /usr/sbin/syslog-ng" /usr/sbin/syslog-ng fi } syslogng_stop() { killall syslog-ng 2> /dev/null } syslogng_restart() { syslogng_stop sleep 1 syslogng_start } case "\$1" in 'start') syslogng_start ;; 'stop') syslogng_stop ;; 'restart') syslogng_restart ;; *) echo "usage \$0 start|stop|restart" esac __END__ chmod +x $PKG/etc/rc.d/rc.syslog-ng.new mkdir -p $PKG/install/ cat > $PKG/install/doinst.sh << __END__ #!/bin/sh config() { NEW="\$1" OLD="\`dirname \$NEW\`/\`basename \$NEW .new\`" # If there's no config file by that name, mv it over: if [ ! -r \$OLD ]; then mv \$NEW \$OLD elif [ "\`cat \$OLD | md5sum\`" = "\`cat \$NEW | md5sum\`" ]; then # toss the redundant copy rm \$NEW fi # Otherwise, we leave the .new copy for the admin to consider... } cp etc/syslog-ng/syslog-ng.conf etc/syslog-ng/syslog-ng.conf.old 2>/dev/null config etc/syslog-ng/syslog-ng.conf.new config etc/rc.d/rc.syslog-ng.new # This won't be needed. The point here is to preserve the permissions of the existing # file, if there is one. I don't see major new development happening in rc.samba... ;-) rm -f etc/syslog-ng/syslog-ng.conf.new rm -f etc/rc.d/rc.syslog-ng.new __END__ # Strip cd $PKG find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null # Gzip man pages gzip -9q $PKG/usr/man/*/* gzip -9q $PKG/usr/man/*/*/* # Fix bin for DIRECTORY in sbin usr/sbin bin usr/bin usr/local/bin usr/X11R6/bin; do if [ -d $DIRECTORY ]; then chown -R root.bin $DIRECTORY chmod -R 755 $DIRECTORY fi done # Fix bad permission find $PKG -perm +0111 -exec chmod 755 {} \; find $PKG \! -perm +0111 -exec chmod 644 {} \; # Install dir mkdir -p $PKG/install if [ ! -z "`ls /var/log/packages/requiredbuilder-*`" ] ; then requiredbuilder -p -y $PKG fi mkdir -p $PKG/usr/src/slackbuilds/ # Copy SlackBuild file cp -f $CWD/$0 $PKG/usr/src/slackbuilds/ # Create slack-desc cat > $PKG/install/slack-desc << END |-----handy-ruler------------------------------------------------------| syslog-ng: $NAME $PROGRAM_VER (portable syslogd replacement for new generation) syslog-ng: syslog-ng: syslog-ng is the world\'s most flexible and scalable syslog-ng: audit trail processing tool for organizations of any size. It syslog-ng: provides a centralised, securely stored log of all devices on syslog-ng: your network, whatever platform they run on. And syslog-ng syslog-ng: also incorporates a host of powerful features, including syslog-ng: filtering based on message content, as well as customisable syslog-ng: data mining and analysis capabilities. syslog-ng: syslog-ng: My other Slack packages: http://kaneda.bohater.net/slackware END # Build the package: cd $PKG makepkg -l y -c n $TMP/$NAME-$PROGRAM_VER-$ARCH-$BUILD.tgz mv $TMP/$NAME-$PROGRAM_VER-$ARCH-$BUILD.tgz $PKG_DIR/ #The end echo "Your $NAME package is complete." echo "It is located in $PKG_DIR. Check The Linuxpackages.net for other packages..."