summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolás Reynolds <apoyosis@correo.inta.gob.ar>2012-09-23 21:08:36 -0300
committerNicolás Reynolds <apoyosis@correo.inta.gob.ar>2012-09-23 21:08:36 -0300
commit408bc5dba4f122b185d6427ad5d4a8aa8deb0a9a (patch)
treea0e66e4b980351fec1a60fd0e712d2272e9402dc
parent2b5ff18a1b5444a26a3e2d7c53e39b8bf8981078 (diff)
miniupnp daemon
-rw-r--r--social/miniupnpd/PKGBUILD41
-rw-r--r--social/miniupnpd/miniupnpd.init51
-rw-r--r--social/miniupnpd/miniupnpd.systemd8
3 files changed, 100 insertions, 0 deletions
diff --git a/social/miniupnpd/PKGBUILD b/social/miniupnpd/PKGBUILD
new file mode 100644
index 000000000..b0d67c09e
--- /dev/null
+++ b/social/miniupnpd/PKGBUILD
@@ -0,0 +1,41 @@
+pkgname=miniupnpd
+pkgver=1.7.20120824
+pkgrel=2
+pkgdesc="Lightweight UPnP IGD daemon"
+arch=('i686' 'x86_64' 'mips64el')
+url="http://miniupnp.free.fr"
+license=('BSD')
+backup=(etc/miniupnpd/miniupnpd.conf)
+depends=('libnfnetlink')
+
+eval $(wget "https://projects.archlinux.org/svntogit/packages.git/plain/trunk/PKGBUILD?h=packages/iptables" -O - | awk -F= '
+ $1 == "pkgver" { pkgver=$2 }
+ $1 == "source" { sub(/\${pkgname}/, "iptables"); sub(/\${pkgver}/, pkgver); print $0 "); " }
+ $1 == "sha1sums" { print $0 ");" }
+ END { print "_iptables=iptables-" pkgver }')
+
+source+=("http://miniupnp.free.fr/files/$pkgname-$pkgver.tar.gz" miniupnpd.init miniupnpd.systemd)
+sha1sums+=('7abca8ecbcd8596392175eb312941083ed5faf21'
+ 'c84031d7af122c5bede8609bcfa80bc31f2a5e61'
+ 'bc0ae02a88eceef4f172b07f6f67d5fd54cc6ae0')
+
+build() {
+ cd "$srcdir/$_iptables"
+ ./configure --enable-static
+ make
+
+ cd "$srcdir/$pkgname-$pkgver"
+ make -f Makefile.linux config.h
+ IPTABLESPATH="$srcdir/$_iptables" make -f Makefile.linux
+}
+
+package() {
+ cd "$srcdir/$pkgname-$pkgver"
+ mkdir -p "$pkgdir/usr/share/man/man8"
+ make PREFIX="$pkgdir/" -f Makefile.linux install
+ rm -r "${pkgdir}/etc/init.d"
+ install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
+ install -Dm755 "${srcdir}/miniupnpd.init" "${pkgdir}/etc/rc.d/miniupnpd"
+ install -Dm644 "${srcdir}/miniupnpd.systemd" "${pkgdir}/usr/lib/systemd/system/miniupnpd.service"
+}
+
diff --git a/social/miniupnpd/miniupnpd.init b/social/miniupnpd/miniupnpd.init
new file mode 100644
index 000000000..e09ac3ade
--- /dev/null
+++ b/social/miniupnpd/miniupnpd.init
@@ -0,0 +1,51 @@
+#!/bin/sh
+
+MINIUPNPD=/usr/sbin/miniupnpd
+ARGS='-f /etc/miniupnpd/miniupnpd.conf'
+PIDFILE='/var/run/miniupnpd.pid'
+IPTABLES_CREATE=/etc/miniupnpd/iptables_init.sh
+IPTABLES_REMOVE=/etc/miniupnpd/iptables_removeall.sh
+
+. /etc/rc.d/functions
+
+case "$1" in
+ start)
+ stat_busy "Starting MiniUPNPd"
+
+ if ! pidof -o %PPID $MINIUPNPD &> /dev/null; then
+ rm -f "$PIDFILE"
+ fi
+
+ $IPTABLES_CREATE > /dev/null 2>&1
+
+ PID="$(cat "$PIDFILE" 2> /dev/null)"
+
+ if [ -z "$PID" ] && $MINIUPNPD $ARGS; then
+ add_daemon miniupnpd
+ stat_done
+ else
+ stat_fail
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping MiniUPNPd"
+ PID="$(cat "$PIDFILE" 2> /dev/null)"
+ if [ -n "$PID" ] && kill "$PID" &> /dev/null; then
+ rm -f "$PIDFILE"
+ rm_daemon miniupnpd
+ stat_done
+ else
+ stat_fail
+ fi
+ ;;
+ restart)
+ "$0" stop
+ sleep 1
+ "$0" start
+ ;;
+ *)
+ echo "Usage: /etc/rc.d/miniupnpd {start|stop|restart}"
+ exit 2
+ ;;
+esac
+exit 0
diff --git a/social/miniupnpd/miniupnpd.systemd b/social/miniupnpd/miniupnpd.systemd
new file mode 100644
index 000000000..0449e8a69
--- /dev/null
+++ b/social/miniupnpd/miniupnpd.systemd
@@ -0,0 +1,8 @@
+[Unit]
+Description=Lightweight UPnP IGD daemon
+
+[Service]
+ExecStart=/usr/sbin/miniupnpd -f /etc/miniupnpd/miniupnpd.conf -d
+
+[Install]
+WantedBy=network.target