define Package/rtpproxy/install
$(INSTALL_DIR) $(1)/usr/bin
- $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/rtpproxy $(1)/usr/bin/
+ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/rtpproxy $(1)/usr/bin
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/rtpproxy.init $(1)/etc/init.d/rtpproxy
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_CONF) ./files/rtpproxy.config $(1)/etc/config/rtpproxy
+
+ $(INSTALL_DIR) $(1)/etc/hotplug.d/iface
+ $(INSTALL_BIN) ./files/rtpproxy.hotplug $(1)/etc/hotplug.d/iface
endef
define Package/rtpproxy-mod-acct-csv/install
option socket 'udp:127.0.0.1:7724'
option ipaddr '192.168.1.1'
+config rtpproxy 'hotplug'
+ #option interface 'wan' # uncomment to enable hotplug
+
--- /dev/null
+#!/bin/sh
+
+[ "$ACTION" = ifup ] || exit 0
+
+NAME=rtpproxy
+COMMAND=/etc/init.d/$NAME
+LOGGER="/usr/bin/logger -t hotplug"
+
+$COMMAND enabled || exit 0
+
+. /lib/functions.sh
+
+config_load $NAME
+
+config_get_bool enabled global enabled 0
+[ $enabled -eq 0 ] && exit 0
+
+config_get hotplug_iface hotplug interface
+
+[ "$INTERFACE" = "$hotplug_iface" ] && {
+ $LOGGER "Restarting $NAME due to \"$ACTION\" of \"$INTERFACE\""
+ $COMMAND restart
+}
+