summaryrefslogtreecommitdiffstats
path: root/network/niceshaper
diff options
context:
space:
mode:
author Michal Bialozor <bialyy@o2.pl>2013-07-12 13:09:45 -0500
committer Erik Hanson <erik@slackbuilds.org>2013-07-12 13:09:45 -0500
commit56954fb021d20377159f85f0b0ecac324c190008 (patch)
treea569f3517c639b7aeafa93fb4072eebdab6c1719 /network/niceshaper
parentc3a19bf016bc447ee37fdafd8728d43945bfa6b9 (diff)
downloadslackbuilds-56954fb021d20377159f85f0b0ecac324c190008.tar.gz
slackbuilds-56954fb021d20377159f85f0b0ecac324c190008.tar.xz
network/niceshaper: Added (dynamic traffic shaper)
Signed-off-by: Erik Hanson <erik@slackbuilds.org>
Diffstat (limited to 'network/niceshaper')
-rw-r--r--network/niceshaper/README22
-rw-r--r--network/niceshaper/doinst.sh25
-rw-r--r--network/niceshaper/niceshaper.SlackBuild112
-rw-r--r--network/niceshaper/niceshaper.info10
-rw-r--r--network/niceshaper/rc.niceshaper89
-rw-r--r--network/niceshaper/slack-desc19
6 files changed, 277 insertions, 0 deletions
diff --git a/network/niceshaper/README b/network/niceshaper/README
new file mode 100644
index 0000000000..4fb5af24cb
--- /dev/null
+++ b/network/niceshaper/README
@@ -0,0 +1,22 @@
+NiceShaper is a program working in a Linux router environment. It uses
+a proven HTB QOS algorithm. It provides dynamic traffic shaping which
+is more effective than traditional, static shaping. By constantly
+monitoring packets flowing through the router in response to changing
+load dynamically adjusts the bandwidth of acting classes to a level
+enabling the fullest possible usage of a internet access. At the same
+time does not allow for the creation of congestion, ensuring complete
+convenience of interactive services.
+
+NiceShaper outside the protection of each class using reasonable
+bandwidth, offers a quota on the amount of transferred datas
+and ability to automatically change the selected parameters
+on specified hours. Automated IMQ and packets marking for support
+multiple ISPs and cooperation with "Source NAT" on private IP
+addresses. Comfortable - even remotely accessible - live monitoring
+(statistics). Automatic writing statistics to a specified file
+in defined interval, for example in order to make them web accesible.
+An important goal of the project is clear and intuitive configuration
+to make learning curve as short as possible. Exact information about
+errors in configuration and encountered problems.
+
+NiceShaper takes care of download when upload stops up.
diff --git a/network/niceshaper/doinst.sh b/network/niceshaper/doinst.sh
new file mode 100644
index 0000000000..13a7636d72
--- /dev/null
+++ b/network/niceshaper/doinst.sh
@@ -0,0 +1,25 @@
+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...
+}
+
+preserve_perms() {
+ NEW="$1"
+ OLD="$(dirname $NEW)/$(basename $NEW .new)"
+ if [ -e $OLD ]; then
+ cp -a $OLD ${NEW}.incoming
+ cat $NEW > ${NEW}.incoming
+ mv ${NEW}.incoming $NEW
+ fi
+ config $NEW
+}
+
+preserve_perms etc/rc.d/rc.niceshaper.new
diff --git a/network/niceshaper/niceshaper.SlackBuild b/network/niceshaper/niceshaper.SlackBuild
new file mode 100644
index 0000000000..5d5bf1df20
--- /dev/null
+++ b/network/niceshaper/niceshaper.SlackBuild
@@ -0,0 +1,112 @@
+#!/bin/sh
+
+# Slackware build script for niceshaper
+
+# Copyright 2013 Michal Bialozor, Gdansk, Pomorskie, POLAND
+# All rights reserved.
+#
+# Redistribution and use of this script, with or without modification, is
+# permitted provided that the following conditions are met:
+#
+# 1. Redistributions of this script must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED
+# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+PRGNAM=niceshaper
+VERSION=${VERSION:-1.0.0}
+BUILD=${BUILD:-1}
+TAG=${TAG:-_SBo}
+
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) ARCH=i486 ;;
+ arm*) ARCH=arm ;;
+ *) ARCH=$( uname -m ) ;;
+ esac
+fi
+
+CWD=$(pwd)
+TMP=${TMP:-/tmp/SBo}
+PKG=$TMP/package-$PRGNAM
+OUTPUT=${OUTPUT:-/tmp}
+
+if [ "$ARCH" = "i486" ]; then
+ SLKCFLAGS="-O2 -march=i486 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "i686" ]; then
+ SLKCFLAGS="-O2 -march=i686 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "x86_64" ]; then
+ SLKCFLAGS="-O2 -fPIC"
+ LIBDIRSUFFIX="64"
+else
+ SLKCFLAGS="-O2"
+ LIBDIRSUFFIX=""
+fi
+
+set -e
+
+rm -rf $PKG
+mkdir -p $TMP $PKG $OUTPUT
+cd $TMP
+rm -rf $PRGNAM-$VERSION
+tar xvf $CWD/$PRGNAM-$VERSION.tar.bz2
+cd $PRGNAM-$VERSION
+chown -R root:root .
+find . \
+ \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
+ -exec chmod 755 {} \; -o \
+ \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
+ -exec chmod 644 {} \;
+
+# Fix prefix and bindir
+sed -e "/^PREFIX/s|/usr/local|/usr|" \
+ -e "/^BINDIR/s|/bin|/sbin|" \
+ -i Makefile
+
+make
+make install DESTDIR=$PKG
+
+find $PKG | xargs file | grep -e "executable" -e "shared object"| grep ELF | \
+ cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
+
+# Working dir
+mkdir -p $PKG/var/lib/niceshaper
+
+# Configuration files
+mkdir -p $PKG/etc/niceshaper
+cp -a etc/niceshaper/*.conf $PKG/etc/niceshaper
+
+# Init script
+mkdir -p $PKG/etc/rc.d
+cat $CWD/rc.$PRGNAM > $PKG/etc/rc.d/rc.$PRGNAM.new
+
+# Documentation
+mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
+cp -a COPYING $PKG/usr/doc/$PRGNAM-$VERSION
+cp -a docs $PKG/usr/doc/$PRGNAM-$VERSION/html
+cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
+
+# Syntax rules
+mkdir -p $PKG/usr/share/mc/syntax
+cp -a editors/mc/niceshaper.syntax $PKG/usr/share/mc/syntax
+mkdir -p $PKG/usr/share/vim/vim73/syntax
+cp -a editors/vim/niceshaper.vim $PKG/usr/share/vim/vim73/syntax
+
+# Installation scripts
+mkdir -p $PKG/install
+cat $CWD/slack-desc > $PKG/install/slack-desc
+cat $CWD/doinst.sh > $PKG/install/doinst.sh
+
+cd $PKG
+/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
diff --git a/network/niceshaper/niceshaper.info b/network/niceshaper/niceshaper.info
new file mode 100644
index 0000000000..47b91f7861
--- /dev/null
+++ b/network/niceshaper/niceshaper.info
@@ -0,0 +1,10 @@
+PRGNAM="niceshaper"
+VERSION="1.0.0"
+HOMEPAGE="http://niceshaper.jedwabny.net"
+DOWNLOAD="http://niceshaper.jedwabny.net/files/niceshaper-1.0.0.tar.bz2"
+MD5SUM="544fa49d5cc56b8624fd7ad030d77798"
+DOWNLOAD_x86_64=""
+MD5SUM_x86_64=""
+REQUIRES=""
+MAINTAINER="Michal Bialozor"
+EMAIL="bialyy@o2.pl"
diff --git a/network/niceshaper/rc.niceshaper b/network/niceshaper/rc.niceshaper
new file mode 100644
index 0000000000..3296e2690e
--- /dev/null
+++ b/network/niceshaper/rc.niceshaper
@@ -0,0 +1,89 @@
+#!/bin/sh
+#
+# Startup script for NiceShaper - Dynamic Traffic Shaper
+#
+# Usage: ./rc.niceshaper {start|stop|restart|status}
+
+PRGNAM=niceshaper
+PRGDIR=/usr/sbin/
+PIDDIR=/var/run/
+RETVAL=0
+
+prg_start() {
+ echo -n "Starting $PRGNAM ... "
+ if [ -r ${PIDDIR}${PRGNAM}.pid ]; then
+ if $(! /sbin/pidof $PRGNAM > /dev/null 2>&1 ) ; then
+ echo -n "removing an old ${PIDDIR}${PRGNAM}.pid ... "
+ rm -f ${PIDDIR}${PRGNAM}.pid
+ fi
+ fi
+ ${PRGDIR}${PRGNAM} start > /dev/null 2>&1
+ RETVAL=$?
+
+ if [ $RETVAL -eq 0 ]; then
+ touch /var/lock/$PRGNAM
+ sleep 2
+ echo "done"
+ else
+ echo "failed"
+ fi
+ return $RETVAL
+}
+
+prg_stop() {
+ echo -n "Stopping $PRGNAM ... "
+ if [ -r ${PIDDIR}${PRGNAM}.pid ]; then
+ ${PRGDIR}${PRGNAM} stop > /dev/null 2>&1
+ # Give it some time to die gracefully
+ for second in 0 1 2 3 4 5 6 7 8 9 10 ; do
+ if $(! /sbin/pidof $PRGNAM > /dev/null 2>&1 ) ; then
+ rm -f ${PIDDIR}${PRGNAM}.pid
+ break;
+ fi
+ sleep 1
+ done
+
+ if [ "$second" = "10" ]; then
+ echo "\nWARNING: $PRGNAM did not exit!"
+ sleep 10
+ else
+ echo "done"
+ fi
+ fi
+ rm -f /var/lock/$PRGNAM
+ return $RETVAL
+}
+
+prg_status() {
+ if [ -e ${PIDDIR}${PRGNAM}.pid ]; then
+ echo "$PRGNAM (pid $(cat ${PIDDIR}${PRGNAM}.pid)) is running..."
+ else
+ echo "$PRGNAM is stopped..."
+ RETVAL=1
+ fi
+}
+
+# How were we called:
+case "$1" in
+ start)
+ prg_start
+ ;;
+ stop)
+ prg_stop
+ ;;
+ restart|reload)
+ prg_stop
+ # Wait a few seconds before restarting
+ sleep 1
+ prg_start
+ ;;
+ status)
+ prg_status
+ ;;
+ *)
+ echo "Usage: $(basename $0) {start|stop|restart|status}"
+ RETVAL=1
+esac
+
+exit $RETVAL
+# EOF
diff --git a/network/niceshaper/slack-desc b/network/niceshaper/slack-desc
new file mode 100644
index 0000000000..84a6ae03aa
--- /dev/null
+++ b/network/niceshaper/slack-desc
@@ -0,0 +1,19 @@
+# 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------------------------------------------------------|
+niceshaper: niceshaper (dynamic traffic shaper)
+niceshaper:
+niceshaper: NiceShaper is a program working in a Linux router environment.
+niceshaper: It uses a proven HTB QOS algorithm. It provides dynamic traffic
+niceshaper: shaping which is more effective than traditional, static shaping.
+niceshaper: By constantly monitoring packets flowing through the router
+niceshaper: in response to changing load dynamically adjusts the bandwidth
+niceshaper: of acting classes to a level enabling the fullest possible usage
+niceshaper: of a internet access. At the same time does not allow for the creation
+niceshaper: of congestion, ensuring complete convenience of interactive services.
+niceshaper: