Added service file and package generation

This commit is contained in:
df 2020-07-28 00:28:33 +01:00
parent cfdf09a1dc
commit 7223f118a7
5 changed files with 59 additions and 1 deletions

View File

@ -21,7 +21,7 @@ BIN=testmdnsd
LIBTINYSVCMDNS_OBJS = mdns.o mdnsd.o LIBTINYSVCMDNS_OBJS = mdns.o mdnsd.o
.PHONY: all clean .PHONY: all clean opkg
all: $(BIN) libtinysvcmdns.a all: $(BIN) libtinysvcmdns.a
@ -44,4 +44,10 @@ libtinysvcmdns.a: $(patsubst %, libtinysvcmdns.a(%), $(LIBTINYSVCMDNS_OBJS))
mdnsd: testmdnsd mdnsd: testmdnsd
strip -o $@ $< 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

32
etc/init.d/S80mdnsd Executable file
View File

@ -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

8
opkg/CONTROL/control Normal file
View File

@ -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

6
opkg/CONTROL/postinst Executable file
View File

@ -0,0 +1,6 @@
#!/bin/sh
/mod/etc/init.d/S80mdnsd start < /dev/null > /dev/null 2>&1
exit 0

6
opkg/CONTROL/prerm Executable file
View File

@ -0,0 +1,6 @@
#!/bin/sh
/mod/etc/init.d/S80mdnsd stop
exit 0