diff --git a/ohybridproxy/Makefile b/ohybridproxy/Makefile new file mode 100644 index 0000000..08be347 --- /dev/null +++ b/ohybridproxy/Makefile @@ -0,0 +1,49 @@ +# +# Copyright (C) 2012-2013 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:=ohybridproxy +PKG_SOURCE_VERSION:=49d11552ee1f8c6cf8851f12d2458b3b5e565182 +PKG_VERSION:=2014-02-18-$(PKG_SOURCE_VERSION) +PKG_RELEASE:=1 + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=git://github.com/sbyx/ohybridproxy.git +PKG_MAINTAINER:=Steven Barth + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/cmake.mk + +define Package/ohybridproxy + SECTION:=net + CATEGORY:=Network + SUBMENU:=IP Addresses and Names + TITLE:=mdns/dns hybrid-proxy + URL:=https://github.com/sbyx/ohybridproxy + DEPENDS+=+libubox +mdnsd +endef + +define Package/ohybridproxy/description + This package provides a statically configured daemon for translating DNS + requests to Multicast DNS and back again. +endef + +define Package/ohybridproxy/install + $(INSTALL_DIR) $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/ohybridproxy $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/etc/config/ + $(INSTALL_DATA) ./files/ohybridproxy.config $(1)/etc/config/ohybridproxy + $(INSTALL_DIR) $(1)/etc/init.d/ + $(INSTALL_BIN) ./files/ohybridproxy.init $(1)/etc/init.d/ohybridproxy + $(INSTALL_DIR) $(1)/etc/hotplug.d/iface + $(INSTALL_DATA) ./files/ohybridproxy.hotplug $(1)/etc/hotplug.d/iface/ohybridproxy +endef + +$(eval $(call BuildPackage,ohybridproxy)) diff --git a/ohybridproxy/files/ohybridproxy.config b/ohybridproxy/files/ohybridproxy.config new file mode 100644 index 0000000..b8d0dd0 --- /dev/null +++ b/ohybridproxy/files/ohybridproxy.config @@ -0,0 +1,7 @@ +config main main + option host '::' + option port '53' + +#config interface +# option interface lan +# option domain lan.home. diff --git a/ohybridproxy/files/ohybridproxy.hotplug b/ohybridproxy/files/ohybridproxy.hotplug new file mode 100644 index 0000000..39090df --- /dev/null +++ b/ohybridproxy/files/ohybridproxy.hotplug @@ -0,0 +1,4 @@ +#!/bin/sh +/etc/init.d/ohybridproxy enabled || exit 0 +[ "$ACTION" = ifupdate ] && exit 0 +/etc/init.d/ohybridproxy restart diff --git a/ohybridproxy/files/ohybridproxy.init b/ohybridproxy/files/ohybridproxy.init new file mode 100755 index 0000000..568303d --- /dev/null +++ b/ohybridproxy/files/ohybridproxy.init @@ -0,0 +1,50 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2009-2014 OpenWrt.org + +START=60 +STOP=10 +USE_PROCD=1 + +HAS_IFACES= + +service_triggers() +{ + procd_add_reload_trigger "ohybridproxy" +} + +ohp_interface() +{ + local section="$1" + config_get interface "$section" interface + config_get domain "$section" domain + + [ -n "$interface" ] && network_get_device interface "$interface" + if [ -n "$interface" -a -n "$domain" ]; then + procd_append_param command "$interface=$domain" + HAS_IFACES=1 + fi +} + +start_service() +{ + . /lib/functions.sh + . /lib/functions/network.sh + + procd_open_instance + procd_set_param command /usr/sbin/ohybridproxy + + config_load ohybridproxy + + config_get val main host + [ -n "$val" ] && procd_append_param command -a "${val}" + + config_get val main port + [ -n "$val" ] && procd_append_param command -p "${val}" + + config_foreach ohp_interface interface + + [ "$HAS_IFACES" = 1 ] || return 0 + + procd_close_instance +} +