summaryrefslogtreecommitdiff
path: root/network/miniupnpd
diff options
context:
space:
mode:
authorAndreas Guldstrand <andreas.guldstrand@gmail.com>2018-05-06 16:13:51 +0100
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2018-05-12 06:58:23 +0700
commitaf7fe71764b4dd8992634cb5634e4d41843c905a (patch)
tree04fa1bfa3530ab22c1b9dfa23b26f54342bed4f1 /network/miniupnpd
parenta8ecd8cbf73a874bea6b42fc17af726a7f3c8a07 (diff)
downloadslackbuilds-af7fe71764b4dd8992634cb5634e4d41843c905a.tar.gz
network/miniupnpd: Added (IGD Protocol, NAT-PMP, and PCP daemon).
Signed-off-by: David Spencer <idlemoor@slackbuilds.org>
Diffstat (limited to 'network/miniupnpd')
-rw-r--r--network/miniupnpd/README5
-rw-r--r--network/miniupnpd/doinst.sh26
-rw-r--r--network/miniupnpd/miniupnpd.SlackBuild122
-rw-r--r--network/miniupnpd/miniupnpd.info10
-rw-r--r--network/miniupnpd/rc.miniupnpd.new92
-rw-r--r--network/miniupnpd/slack-desc19
-rw-r--r--network/miniupnpd/slackware-version.patch60
7 files changed, 334 insertions, 0 deletions
diff --git a/network/miniupnpd/README b/network/miniupnpd/README
new file mode 100644
index 0000000000..c6b5298af2
--- /dev/null
+++ b/network/miniupnpd/README
@@ -0,0 +1,5 @@
+MiniUPnPd, a daemon providing Internet Gateway Device Protocol, NAT-PMP,
+and PCP services to your network from a linux box being the gateway.
+Following UPnP terminology, MiniUPnPd is a UPnP Device.
+
+Set IPV6="yes" when running the SlackBuild to enable support for IPv6.
diff --git a/network/miniupnpd/doinst.sh b/network/miniupnpd/doinst.sh
new file mode 100644
index 0000000000..9454c5d350
--- /dev/null
+++ b/network/miniupnpd/doinst.sh
@@ -0,0 +1,26 @@
+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.miniupnpd.new
+config etc/miniupnpd/miniupnpd.conf.new
diff --git a/network/miniupnpd/miniupnpd.SlackBuild b/network/miniupnpd/miniupnpd.SlackBuild
new file mode 100644
index 0000000000..fc55d3f393
--- /dev/null
+++ b/network/miniupnpd/miniupnpd.SlackBuild
@@ -0,0 +1,122 @@
+#!/bin/sh
+
+# Slackware build script for miniupnpd
+
+# Copyright 2018 Andreas Guldstrand
+# 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=miniupnpd
+VERSION=${VERSION:-2.0}
+BUILD=${BUILD:-1}
+TAG=${TAG:-_SBo}
+
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) ARCH=i586 ;;
+ arm*) ARCH=arm ;;
+ *) ARCH=$( uname -m ) ;;
+ esac
+fi
+
+CWD=$(pwd)
+TMP=${TMP:-/tmp/SBo}
+PKG=$TMP/package-$PRGNAM
+OUTPUT=${OUTPUT:-/tmp}
+
+if [ "$ARCH" = "i586" ]; then
+ SLKCFLAGS="-O2 -march=i586 -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
+
+IPV6=${IPV6:-no}
+
+set -e
+
+rm -rf $PKG
+mkdir -p $TMP $PKG $OUTPUT
+cd $TMP
+rm -rf $PRGNAM-$VERSION
+tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
+cd $PRGNAM-$VERSION
+chown -R root:root .
+find -L . \
+ \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
+ -o -perm 511 \) -exec chmod 755 {} \; -o \
+ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
+ -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
+
+patch -p1 < "$CWD/slackware-version.patch"
+
+make -f Makefile.linux config.h
+
+make -f Makefile.linux \
+ CFLAGS="$SLKCFLAGS"
+
+make -f Makefile.linux install \
+ MANINSTALLDIR=/usr/man/man8 \
+ DESTDIR=$PKG
+
+find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
+ | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
+
+find $PKG/usr/man -type f -exec gzip -9 {} \;
+for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
+
+# Install init script
+mkdir -p $PKG/etc/rc.d
+sed -e "s/@IPV6@/$IPV6/" \
+ $CWD/rc.$PRGNAM.new > $PKG/etc/rc.d/rc.$PRGNAM.new
+chmod 755 $PKG/etc/rc.d/rc.$PRGNAM.new
+
+# Make sure we don't clobber an old configuration file
+mv $PKG/etc/miniupnpd/miniupnpd.conf $PKG/etc/miniupnpd/miniupnpd.conf.new
+
+# Add flush and display scripts
+sed -e 's%/sbin/%/usr/sbin/%' netfilter/iptables_flush.sh > $PKG/etc/miniupnpd/iptables_flush.sh
+sed -e 's%/sbin/%/usr/sbin/%' netfilter/ip6tables_flush.sh > $PKG/etc/miniupnpd/ip6tables_flush.sh
+sed -e 's%/sbin/%/usr/sbin/%' netfilter/iptables_display.sh > $PKG/etc/miniupnpd/iptables_display.sh
+sed -e 's%/sbin/%/usr/sbin/%' netfilter/ip6tables_display.sh > $PKG/etc/miniupnpd/ip6tables_display.sh
+chmod a+x \
+ $PKG/etc/miniupnpd/iptables_flush.sh \
+ $PKG/etc/miniupnpd/ip6tables_flush.sh \
+ $PKG/etc/miniupnpd/iptables_display.sh \
+ $PKG/etc/miniupnpd/ip6tables_display.sh
+
+mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
+cp -a \
+ README INSTALL LICENSE Changelog.txt \
+ $PKG/usr/doc/$PRGNAM-$VERSION
+cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
+
+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/miniupnpd/miniupnpd.info b/network/miniupnpd/miniupnpd.info
new file mode 100644
index 0000000000..22f793b1ad
--- /dev/null
+++ b/network/miniupnpd/miniupnpd.info
@@ -0,0 +1,10 @@
+PRGNAM="miniupnpd"
+VERSION="2.0"
+HOMEPAGE="http://miniupnp.free.fr/"
+DOWNLOAD="http://miniupnp.free.fr/files/miniupnpd-2.0.tar.gz"
+MD5SUM="1c07a215dd9b362e75a9efc05e2fb3b4"
+DOWNLOAD_x86_64=""
+MD5SUM_x86_64=""
+REQUIRES=""
+MAINTAINER="Andreas Guldstrand"
+EMAIL="andreas.guldstrand@gmail.com"
diff --git a/network/miniupnpd/rc.miniupnpd.new b/network/miniupnpd/rc.miniupnpd.new
new file mode 100644
index 0000000000..cb88938345
--- /dev/null
+++ b/network/miniupnpd/rc.miniupnpd.new
@@ -0,0 +1,92 @@
+#!/bin/bash
+
+PRG="MiniUPnPd"
+ARGS="-f /etc/miniupnpd/miniupnpd.conf"
+IPV6=@IPV6@
+
+cleanup() {
+ /etc/miniupnpd/iptables_removeall.sh &> /dev/null
+ [ "$IPV6" = "yes" ] && /etc/miniupnpd/ip6tables_removeall.sh &> /dev/null
+}
+
+start() {
+ echo -n "Starting $PRG..."
+ /etc/miniupnpd/iptables_init.sh &> /dev/null
+ [ "$IPV6" = "yes" ] && /etc/miniupnpd/ip6tables_init.sh &> /dev/null
+ if /usr/sbin/miniupnpd $ARGS; then
+ echo "Done."
+ else
+ EXIT=$?
+ cleanup
+ exit $EXIT
+ fi
+}
+
+stop() {
+ echo -n "Stopping $PRG..."
+ killall miniupnpd &> /dev/null
+ cleanup
+ echo "Done."
+}
+
+ensure_running() {
+ if pidof miniupnpd &> /dev/null; then
+ RUN=1
+ else
+ echo "$PRG is not running."
+ exit 1
+ fi
+}
+
+case "$1" in
+ "start")
+ if pidof miniupnpd &> /dev/null; then
+ echo "$PRG already running."
+ exit 0
+ fi
+ start
+ ;;
+ "stop")
+ ensure_running
+ stop
+ ;;
+ "restart")
+ if pidof miniupnpd &> /dev/null; then
+ stop
+ else
+ echo -n "$PRG is not running. Cleaning..."
+ cleanup
+ echo "Done."
+ fi
+ start
+ ;;
+ "flush")
+ ensure_running
+ echo -n "Flushing $PRG iptables rules..."
+ /etc/miniupnpd/iptables_flush.sh
+ [ "$IPV6" = "yes" ] && /etc/miniupnpd/ip6tables_flush.sh
+ echo "Done."
+ ;;
+ "display")
+ ensure_running
+ /etc/miniupnpd/iptables_display.sh
+ [ "$IPV6" = "yes" ] && /etc/miniupnpd/ip6tables_display.sh
+ ;;
+ "status")
+ ensure_running
+ echo "$PRG is running."
+ ;;
+ "cleanup")
+ if pidof miniupnpd &> /dev/null; then
+ echo "$PRG is running. Refusing to cleanup."
+ exit 1
+ fi
+ echo -n "Cleaning..."
+ cleanup
+ echo "Done."
+ ;;
+ *)
+ echo "Usage: $0 {start|stop|restart|flush|display|cleanup|status}"
+ exit 1
+ ;;
+esac
diff --git a/network/miniupnpd/slack-desc b/network/miniupnpd/slack-desc
new file mode 100644
index 0000000000..8ff2fd4658
--- /dev/null
+++ b/network/miniupnpd/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 ':' except on otherwise blank lines.
+
+ |-----handy-ruler------------------------------------------------------|
+miniupnpd: miniupnpd (Internet Gateway Device Protocol, NAT-PMP, and PCP daemon)
+miniupnpd:
+miniupnpd: MiniUPnPd, a daemon providing Internet Gateway Device Protocol,
+miniupnpd: NAT-PMP, and PCP services to your network from a linux box being the
+miniupnpd: gateway. Following UPnP terminology, MiniUPnPd is a UPnP Device.
+miniupnpd:
+miniupnpd:
+miniupnpd:
+miniupnpd:
+miniupnpd:
+miniupnpd:
diff --git a/network/miniupnpd/slackware-version.patch b/network/miniupnpd/slackware-version.patch
new file mode 100644
index 0000000000..79bd2bdec6
--- /dev/null
+++ b/network/miniupnpd/slackware-version.patch
@@ -0,0 +1,60 @@
+--- a/genconfig.sh 2018-05-05 10:09:05.942853150 +0200
++++ b/genconfig.sh 2018-05-05 10:26:38.668441749 +0200
+@@ -274,28 +274,35 @@
+ OS_VERSION=`grep ^base_version /etc/product | awk '{ print $3 }'`
+ OS_URL=https://www.clearos.com/
+ fi
+- # use lsb_release (Linux Standard Base) when available
+- LSB_RELEASE=`which lsb_release`
+- if [ 0 -eq $? ]; then
+- OS_NAME=`${LSB_RELEASE} -i -s`
+- OS_VERSION=`${LSB_RELEASE} -r -s`
+- case $OS_NAME in
+- Debian)
+- OS_URL=http://www.debian.org/
+- OS_VERSION=`${LSB_RELEASE} -c -s`
+- ;;
+- Ubuntu)
+- OS_URL=http://www.ubuntu.com/
+- OS_VERSION=`${LSB_RELEASE} -c -s`
+- ;;
+- Gentoo)
+- OS_URL=http://www.gentoo.org/
+- ;;
+- arch)
+- OS_URL=http://www.archlinux.org/
+- OS_VERSION=`uname -r`
+- ;;
+- esac
++ # Slackware specific
++ if [ -f /etc/os-release ]; then
++ OS_NAME=$(cat /etc/os-release | grep ^NAME= | cut -d= -f 2 | sed -e 's/^"//' -e 's/"$//')
++ OS_VERSION=$(cat /etc/os-release | grep ^VERSION= | cut -d= -f 2 | sed -e 's/^"//' -e 's/"$//')
++ OS_URL=$(cat /etc/os-release | grep ^HOME_URL= | cut -d= -f 2 | sed -e 's/^"//' -e 's/"$//')
++ else
++ # otherwise use lsb_release (Linux Standard Base) when available
++ LSB_RELEASE=`which lsb_release`
++ if [ 0 -eq $? ]; then
++ OS_NAME=`${LSB_RELEASE} -i -s`
++ OS_VERSION=`${LSB_RELEASE} -r -s`
++ case $OS_NAME in
++ Debian)
++ OS_URL=http://www.debian.org/
++ OS_VERSION=`${LSB_RELEASE} -c -s`
++ ;;
++ Ubuntu)
++ OS_URL=http://www.ubuntu.com/
++ OS_VERSION=`${LSB_RELEASE} -c -s`
++ ;;
++ Gentoo)
++ OS_URL=http://www.gentoo.org/
++ ;;
++ arch)
++ OS_URL=http://www.archlinux.org/
++ OS_VERSION=`uname -r`
++ ;;
++ esac
++ fi
+ fi
+ echo "#define USE_IFACEWATCHER 1" >> ${CONFIGFILE}
+ FW=netfilter