diff --git a/Makefile b/Makefile index 2ff0dbe..a43161b 100644 --- a/Makefile +++ b/Makefile @@ -21,7 +21,7 @@ BIN=testmdnsd LIBTINYSVCMDNS_OBJS = mdns.o mdnsd.o -.PHONY: all clean +.PHONY: all clean opkg all: $(BIN) libtinysvcmdns.a @@ -44,4 +44,10 @@ libtinysvcmdns.a: $(patsubst %, libtinysvcmdns.a(%), $(LIBTINYSVCMDNS_OBJS)) mdnsd: testmdnsd strip -o $@ $< + install -C -D -p mdnsd sbin/ +opkg: mdnsd $(wildcard opkg/CONTROL/*) etc/init.d/S80mdnsd + install -D -p mdnsd opkg/sbin + install -D -p etc/init.d/S80mdnsd opkg/etc/init.d/ + opkg-pack opkg + diff --git a/etc/init.d/S80mdnsd b/etc/init.d/S80mdnsd new file mode 100755 index 0000000..2fcc5d2 --- /dev/null +++ b/etc/init.d/S80mdnsd @@ -0,0 +1,32 @@ +#!/bin/sh + +case "$1" in + start) + # Wait for network to come up... + ( + while [ ! -f /tmp/if-up ]; do + echo "mdnsd: waiting for network..." + sleep 1 + done + + interface="`/sbin/route | /bin/sed -n '$ { + s/.* // + p + }'`" + echo " MDNS interface: [$interface]" + [ -z "$interface" ] && interface=eth0 + + /bin/ip route add 224.0.0.0/4 dev $interface + /mod/sbin/mdnsd & + ) & + ;; + stop) + killall -q mdnsd + ;; + *) + exit 1 + ;; +esac + +exit 0 + diff --git a/opkg/CONTROL/control b/opkg/CONTROL/control new file mode 100644 index 0000000..e5e4fcc --- /dev/null +++ b/opkg/CONTROL/control @@ -0,0 +1,8 @@ +Package: zeroconf +Priority: optional +Section: net +Version: 1.5-2 +Architecture: mipsel +Maintainer: af123@hummypkg.org.uk +Depends: +Description: MDNS & LLMNR Responder diff --git a/opkg/CONTROL/postinst b/opkg/CONTROL/postinst new file mode 100755 index 0000000..a57546f --- /dev/null +++ b/opkg/CONTROL/postinst @@ -0,0 +1,6 @@ +#!/bin/sh + +/mod/etc/init.d/S80mdnsd start < /dev/null > /dev/null 2>&1 + +exit 0 + diff --git a/opkg/CONTROL/prerm b/opkg/CONTROL/prerm new file mode 100755 index 0000000..0286077 --- /dev/null +++ b/opkg/CONTROL/prerm @@ -0,0 +1,6 @@ +#!/bin/sh + +/mod/etc/init.d/S80mdnsd stop + +exit 0 +