clean up miniupnpd package and update to latest version (resync with x-wrt)
authorFelix Fietkau <nbd@openwrt.org>
Fri, 8 Dec 2006 18:36:31 +0000 (18:36 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Fri, 8 Dec 2006 18:36:31 +0000 (18:36 +0000)
SVN-Revision: 5728

net/miniupnpd/Makefile
net/miniupnpd/files/miniupnpd.hotplug [new file with mode: 0644]
net/miniupnpd/files/miniupnpd.init
net/miniupnpd/files/upnpd.config
net/miniupnpd/ipkg/miniupnp.postinst [deleted file]
net/miniupnpd/patches/001-makefile-tweaks.patch [deleted file]

index cd66d1c5c4b38fdfad0fe09f1aaade655a8d49cf..2ce3002be5ea84d851652aef634866e1b8a7504e 100644 (file)
@@ -9,15 +9,15 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=miniupnpd
-PKG_VERSION:=20061129
+PKG_VERSION:=1.0-RC1
 PKG_RELEASE:=1
-PKG_MD5SUM:=1826c480e61e0573dfa1d835ee9d8802
+PKG_MD5SUM:=ab752eebbebcfa84178de0a4632d7688
 
 PKG_SOURCE_URL:=http://miniupnp.tuxfamily.org/files
-PKG_SOURCE:=$(PKG_NAME)$(PKG_VERSION).tar.gz
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_CAT:=zcat
 
-PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
 PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
 
 include $(INCLUDE_DIR)/package.mk
@@ -32,18 +32,26 @@ define Package/miniupnpd
   URL:=http://miniupnp.tuxfamily.org/
 endef
 
+define Package/miniupnpd/postinst
+/etc/init.d/miniupnpd enable
+endef
+
 define Build/Compile
-       $(MAKE) -C $(PKG_BUILD_DIR) -f Makefile.openwrt
+       $(MAKE) \
+               -C $(PKG_BUILD_DIR) \
+               -f Makefile.linux \
+               $(TARGET_CONFIGURE_OPTS) \
+               CFLAGS="$(TARGET_CFLAGS) -I $(STAGING_DIR)/usr/include" \
+               LIBS="$(STAGING_DIR)/usr/lib/libiptc.a"
 endef
 
 define Package/miniupnpd/install
-       $(INSTALL_DIR) $(1)/usr/bin $(1)/etc/init.d $(1)/etc/config $(1)/CONTROL
+       $(INSTALL_DIR) $(1)/usr/bin $(1)/etc/init.d $(1)/etc/config $(1)/etc/hotplug.d/iface
        $(INSTALL_BIN) $(PKG_BUILD_DIR)/miniupnpd $(1)/usr/bin/
        $(INSTALL_BIN) $(PKG_BUILD_DIR)/linux/*.sh $(1)/usr/bin/
        $(INSTALL_BIN) ./files/miniupnpd.init $(1)/etc/init.d/miniupnpd
        $(INSTALL_BIN) ./files/upnpd.config $(1)/etc/config/upnpd
-       $(INSTALL_BIN) ./ipkg/miniupnp.postinst $(1)/CONTROL/postinst
-       $(STRIP) $(1)/usr/bin/miniupnpd
+       $(INSTALL_DATA) ./files/miniupnpd.hotplug $(1)/etc/hotplug.d/iface/10-miniupnpd
 endef
 
 $(eval $(call BuildPackage,miniupnpd))
diff --git a/net/miniupnpd/files/miniupnpd.hotplug b/net/miniupnpd/files/miniupnpd.hotplug
new file mode 100644 (file)
index 0000000..7bcab5a
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh
+[ "$ACTION" = "ifup" -a "$INTERFACE" = "wan" ] && /etc/init.d/miniupnpd enabled && /etc/init.d/miniupnpd restart
index 5d307a9f4cab60a3c65f8f88c48d7bcaa5cb3de8..446a37cecbff775f069b12f072334a893fdd9006 100644 (file)
@@ -1,30 +1,36 @@
 #!/bin/sh /etc/rc.common
 START=95
 start() {
+       config_load "upnpd"
+       include /lib/network
+       scan_interfaces
+       config_get ifname wan ifname
+       config_get ipaddr lan ipaddr
+       
        echo "miniupnpd starting ..."
-       iptables_flush.sh 2>&- >&-
-       killall miniupnpd 2>&-
-       iptables_removeall.sh 2>&- >&-
+       stop
        iptables_init.sh
        # get bitspeed information, if provided
-       upnpd_up_bitspeed=$(uci get upnpd.general.up_bitspeed)
-       upnpd_down_bitspeed=$(uci get upnpd.general.down_bitspeed)
+       config_get upnp_up_bitspeed config upload
+       config_get upnp_down_bitspeed config download
        bitspeed_str=""
        [ -n "$upnpd_up_bitspeed" ] && [ -n "$upnpd_down_bitspeed" ] && {
                # covert to bytespeed
-               let upnpd_up_bytespeed=$upnpd_up_bitspeed*1024/8
-               let upnpd_down_bytespeed=$upnpd_down_bitspeed*1024/8
+               upnpd_up_bytespeed=$(($upnpd_up_bitspeed * 1024 / 8))
+               upnpd_down_bytespeed=$(($upnpd_down_bitspeed * 1024 / 8))
                bitspeed_str="-B $upnpd_down_bytespeed $upnpd_up_bytespeed"
        }
-       upnpd_log=$(uci get upnpd.general.log_output)
-       if [ "$upnpd_log" = "1" ]; then
-               miniupnpd -i $(uci get network.wan.ifname) -a $(uci get network.lan.ipaddr) -p 5000 -U $bitspeed_str -d | logger -t miniupnpd &
+       config_get log_output config log_output
+       if [ "$log_output" = "1" ]; then
+               miniupnpd -i "$ifname" -a "$ipaddr" -p 5000 -U $bitspeed_str -d | logger -t miniupnpd &
        else
-               miniupnpd -i $(uci get network.wan.ifname) -a $(uci get network.lan.ipaddr) -p 5000 -U $bitspeed_str
+               miniupnpd -i "$ifname" -a "$ipaddr" -p 5000 -U $bitspeed_str
        fi
 }
+
 stop() {
+       pnpd_pid=$(cat /var/run/miniupnpd.pid) 2>&- >&-
        iptables_flush.sh 2>&- >&-
-       killall miniupnpd 2>&-
+       kill $pnpd_pid 2>&-
        iptables_removeall.sh 2>&- >&-
-}
\ No newline at end of file
+}
index 35448db0eae67a49f9890cfb04cb6c05a0bac432..b369266a419db8917539bfba2d3a55ecfc03ad29 100644 (file)
@@ -1,4 +1,5 @@
-config upnpd general
-       option log_output    '0'
-       option down_bitspeed '1024'
-       option up_bitspeed   '512'
+config upnpd config
+       option enabled          1
+       option log_output       0
+       option download         1024
+       option upload           512
diff --git a/net/miniupnpd/ipkg/miniupnp.postinst b/net/miniupnpd/ipkg/miniupnp.postinst
deleted file mode 100644 (file)
index d868a6c..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-/etc/init.d/miniupnpd enable
-
diff --git a/net/miniupnpd/patches/001-makefile-tweaks.patch b/net/miniupnpd/patches/001-makefile-tweaks.patch
deleted file mode 100644 (file)
index 0dfbc21..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
---- miniupnpd/Makefile.openwrt.orig    2006-11-26 16:44:21.000000000 -0600
-+++ miniupnpd/Makefile.openwrt 2006-11-28 19:48:06.000000000 -0600
-@@ -11,7 +11,7 @@
- CFLAGS += -D_GNU_SOURCE
- RM = rm -f
- INSTALL = install
--IPTABLESINC=$(BUILD_DIR)/iptables-1.3.3/include
-+IPTABLESINC=$(STAGING_DIR)/usr/include
- BASEOBJS = miniupnpd.o upnphttp.o upnpdescgen.o upnpsoap.o \
-            upnpreplyparse.o minixml.o \
-@@ -19,7 +19,7 @@
- LNXOBJS = linux/getifstats.o linux/iptcrdr.o
--LIBS = $(BUILD_DIR)/iptables-1.3.3/libiptc/libiptc.a
-+LIBS = $(STAGING_DIR)/usr/lib/libiptc.a
- TESTUPNPDESCGENOBJS = testupnpdescgen.o upnpdescgen.o
-@@ -36,6 +36,7 @@
-       @echo no install for now...
- miniupnpd:    $(BASEOBJS) $(LNXOBJS) $(LIBS)
-+      $(CC) $(CFLAGS) -o $@ $(BASEOBJS) $(LNXOBJS) $(LIBS)
- testupnpdescgen:      $(TESTUPNPDESCGENOBJS)