Permalink
Browse files

Add trondah's minisdpd to the build

  • Loading branch information...
Dave Taht
Dave Taht committed Sep 24, 2012
1 parent 64deb85 commit 49a0b575e9ddcbeda418e612afebe653d7af790d
View
@@ -0,0 +1,42 @@
+#
+# Copyright (C) 2006-2009 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=minissdpd
+PKG_VERSION:=1.2
+PKG_RELEASE:=1
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://miniupnp.free.fr/files/
+PKG_MD5SUM:=3f831d9586861ba5548dc2142049cb46
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/minissdpd
+ SECTION:=net
+ CATEGORY:=Network
+ TITLE:=Simple Service Discovery Protocol daemon
+ URL:=http://miniupnp.free.fr/minissdpd.html
+endef
+
+define Build/Compile
+ $(MAKE) -C $(PKG_BUILD_DIR) \
+ $(TARGET_CONFIGURE_OPTS) \
+ CFLAGS="$(TARGET_CFLAGS)"
+endef
+
+define Package/minissdpd/install
+ $(INSTALL_DIR) $(1)/usr/bin $(1)/etc/init.d $(1)/etc/config $(1)/etc/hotplug.d/iface
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/minissdpd $(1)/usr/bin/minissdpd
+ $(INSTALL_BIN) ./files/minissdpd.init $(1)/etc/init.d/minissdpd
+ $(INSTALL_CONF) ./files/minissdpd.config $(1)/etc/config/minissdpd
+ $(INSTALL_DATA) ./files/minissdpd.iface.hotplug $(1)/etc/hotplug.d/iface/49-minissdpd
+endef
+
+$(eval $(call BuildPackage,minissdpd))
@@ -0,0 +1,4 @@
+config 'minissdpd' 'config'
+ option 'enabled' '1'
+ option 'log_output' '0'
+ option 'internal_iface' 'lan'
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+/etc/init.d/minissdpd enabled && {
+ local intif="$(uci_get minissdpd config.internal_iface)"
+ [ "$ACTION" = "ifup" ] && [ "$INTERFACE" = "$intif" ] && {
+ logger -t minissdpd-hotplug "ifup for interface '$intif', restart minissdpd"
+ /etc/init.d/minissdpd restart
+ }
+}
@@ -0,0 +1,38 @@
+#!/bin/sh /etc/rc.common
+START=49
+
+start() {
+ config_load "minissdpd"
+ local intiface enabled logging
+
+ config_get intiface config internal_iface
+ config_get_bool enabled config enabled 0
+ config_get_bool logging config log_output 0
+
+ include /lib/network
+ scan_interfaces
+
+ local ifname
+ config_get ifname ${intiface:-lan} ifname
+
+ if [ -n "$ifname" ]; then
+ for iface in ${intiface:-lan}; do
+ local ipaddr
+ config_get ipaddr "$iface" ipaddr
+ [ -n "$ipaddr" ] && append args "-i $ipaddr"
+ done
+
+ if [ "$logging" = "1" ]; then
+ [ "$enabled" -gt 0 ] && eval start-stop-daemon -S -x minissdpd -- $args -d | logger -t minissdpd &
+ else
+ [ "$enabled" -gt 0 ] && eval start-stop-daemon -S -x minissdpd -- $args 2>/dev/null
+ fi
+ else
+ logger -t "minissdpd daemon" "internal interface not found, not starting"
+ fi
+}
+
+stop() {
+ start-stop-daemon -K -q -x minissdpd -p /var/run/minissdpd.pid
+ rm -f /var/run/minissdpd.pid
+}

0 comments on commit 49a0b57

Please sign in to comment.