Commit 617faed6 authored by Francesco Colista's avatar Francesco Colista
Browse files

testing/minissdpd: new aport. Fixes #5112

parent 6ede1a74
# Contributor: Francesco Colista <fcolista@alpinelinux.org>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=minissdpd
pkgver=1.5.20160301
pkgrel=0
pkgdesc="MiniSSDP Daemon"
url="http://miniupnp.free.fr/minissdpd.html"
arch="all"
license="BSD"
depends=""
depends_dev=""
makedepends="$depends_dev libnfnetlink-dev linux-headers bsd-compat-headers"
install=""
subpackages="$pkgname-doc"
source="http://miniupnp.free.fr/files/download.php?file=$pkgname-$pkgver.tar.gz
minissdpd-1.2-remove-initd.patch
$pkgname.initd
$pkgname.confd"
builddir="$srcdir"/$pkgname-$pkgver
build() {
cd "$builddir"
INSTALLPREFIX=/usr make || return 1
}
package() {
cd "$builddir"
make PREFIX="$pkgdir" install
install -m755 -D "$srcdir"/$pkgname.initd \
"$pkgdir"/etc/init.d/$pkgname || return 1
install -m644 -D "$srcdir"/$pkgname.confd \
"$pkgdir"/etc/conf.d/$pkgname || return 1
}
md5sums="3ca1fbf14ee11ebbddf9ace87f51f325 download.php?file=minissdpd-1.5.20160301.tar.gz
ab5cb0b3b269bc30bbc8f8d1b9f631af minissdpd-1.2-remove-initd.patch
05ae1c73ac964936fb394d76819132c3 minissdpd.initd
9d0ceb5535561a9b28421a49dfc1732c minissdpd.confd"
sha256sums="9ba6f87264898b9953f0e808a6ba6c6bdd38f4b47fe6d8e5dee2c92296657114 download.php?file=minissdpd-1.5.20160301.tar.gz
c64c8a62d4c8ccab7e6bd8016ff458698d257d7227c902b9c75dcf27a12364ac minissdpd-1.2-remove-initd.patch
e74fdd45c728834f5e4517750da3616f35207846389ae25149c431cf228527b1 minissdpd.initd
5a31743b20198ce596a09c73abd45b747e2d087de688cd4f954626bdd1574fc6 minissdpd.confd"
sha512sums="b8dbfa7ce05fc006c09378fe53fb3345cd8d4aad486ba0bd4adb4d7f5d662e34ba04d82ad48bdc721eca1a7d1d083a9f42be69c5d1086223a0e8803068c15426 download.php?file=minissdpd-1.5.20160301.tar.gz
20306ae9870659c9d5c07643f3d95ce56961a57a119d3f15b6aa6ef4ad6ab4c8f32bff9d11af3445f1c94fc9b628faf0a9c9b7e1fb1924f5bd20697bc39d438f minissdpd-1.2-remove-initd.patch
66c0822bc9166cd02faf57a58d0f843a85ecf71d3f852829197c8f81bcfd52358a115f2244520ffe50746aa7274d76c30365f927bc1cf5faf47485e91a44805f minissdpd.initd
5ac723cb5b3d3f8bb97989cffb174f22566fcebff304e40f12ca5144cfa94b00614fdf6925e2c5a1dd0f8fa533aac12e991bad0d0909cbdd90a9b7ed73e0c296 minissdpd.confd"
diff -Naur minissdpd-1.1.20120121.orig//Makefile minissdpd-1.1.20120121/Makefile
--- minissdpd-1.1.20120121.orig//Makefile 2012-01-02 05:46:24.000000000 -0500
+++ minissdpd-1.1.20120121/Makefile 2012-01-22 07:01:54.000000000 -0500
@@ -42,10 +42,6 @@
$(INSTALL) minissdpd $(SBININSTALLDIR)
$(INSTALL) -d $(MANINSTALLDIR)/man1
$(INSTALL) minissdpd.1 $(MANINSTALLDIR)/man1/minissdpd.1
-ifneq ($(OS), Darwin)
- $(INSTALL) -d $(PREFIX)/etc/init.d
- $(INSTALL) minissdpd.init.d.script $(PREFIX)/etc/init.d/minissdpd
-endif
minissdpd: $(MINISSDPDOBJS)
$(CC) $(CFLAGS) -o $@ $(MINISSDPDOBJS)
# /etc/conf.d/minissdpd: config file for /etc/init.d/minissdpd
# Configure on which interface or interfaces minissdpd will listen.
# List all interfaces space separated. If this is not specified then
# minissdpd will listen on just the interface for the default route.
# You probably want that when running minissdpd with miniupnpc on the
# client, but you most likely want to specify the internal interface
# when running with miniupnpd on the gateway.
#
# MINISSDPD_IFACE="eth0 eth1"
#!/sbin/openrc-run
MINISSDPD="/usr/sbin/minissdpd"
PIDFILE="/var/run/minissdpd.pid"
depend() {
need net
before miniupnpd
}
interfaceup() {
# interface exists?
if [ ! -f /sys/class/net/$1/flags ]; then return 1; fi
let "IFUP = `cat /sys/class/net/$1/flags` & 1"
# interface has UP flag?
if [ $IFUP -eq 0 ]; then return 1; fi
return 0
}
# awk script: scans the /proc routing table for local subnets
# 1. filter list for entries with a gateway (column 3) of 0.0.0.0 (ie interface-local)
# 2. read column 2 for network-order hex encoded subnet address
# 3. match against a 10.x.x.x, 172.(16-31).x.x, or 192.168.x.x address
# 4. print out any interface (column 1) that matches
privateinterfaces() {
awk -f - /proc/net/route <<'FindPrivateNetworks'
function p(m,n) { return(and(IP,m) == n); }
$3=="00000000" { IP=strtonum("0x"$2); if (p(0xff,0x0a) || p(0x1fff,0x10ac) || p(0xffff,0xa8c0)) print $1; }
FindPrivateNetworks
}
start() {
ebegin "Starting minissdpd"
ARGS=""
if [ "x$MINISSDPD_IFACE" = "x" ]; then
ewarn "No interfaces provided, using interfaces on private networks"
IFLIST=$(privateinterfaces)
else
IFLIST="$MINISSDPD_IFACE"
fi
eindent
for IF in $IFLIST; do
if interfaceup $IF; then
einfo Adding interface $IF
ARGS+="-i $IF "
else
ewarn "Interface $IF is not up"
fi
done
eoutdent
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $MINISSDPD -- $ARGS
eend $?
}
stop() {
ebegin "Stopping minissdpd"
start-stop-daemon --stop --pidfile "${PIDFILE}"
eend $?
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment