Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions contrib/build-openwrt-global/wifidog/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#
# Copyright (C) 2006,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:=wifidog
PKG_VERSION:=20130917
PKG_RELEASE:=1.1.6


PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=git://github.com/wifidog/wifidog-gateway.git
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)
PKG_SOURCE_VERSION:=master
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE).tar.gz

PKG_FIXUP:=autoreconf
PKG_INSTALL:=1

include $(INCLUDE_DIR)/package.mk

### Adjust "files" directory to suit $RELEASE
# Setting a default "files" directory
OPENWRT_FILESDIR:=common
# Managing exceptions
ifeq ($(RELEASE),Barrier Breaker)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't work for Chaos Calmer :(
Either

  1. Check against all (relevant) previous releases in the if statement
  2. Somehow detect the presence of procd: the SDK has CONFIG_PACKAGE_procd=y in .config.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Chaos Calmer not beeing stable, I did not include it, but it is pretty easy to fix the Makefile.
By the way, rather than checking $(RELEASE), check for procd, as you suggest, or check for a versioning or a commit number would reduce code maintenance.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please wait for a moment, we will fork openwrt/packages , then submit this code to there, should not in this project.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sinkcup : Do you plan to delete "contrib" directory ?

OPENWRT_FILESDIR:=Barrier_Breaker
endif

define Package/wifidog
SUBMENU:=Captive Portals
SECTION:=net
CATEGORY:=Network
DEPENDS:=+iptables-mod-extra +iptables-mod-ipopt +iptables-mod-nat-extra +libpthread
TITLE:=A wireless captive portal solution
URL:=http://www.wifidog.org
endef

define Package/wifidog/description
The Wifidog project is a complete and embeddable captive
portal solution for wireless community groups or individuals
who wish to open a free Hotspot while still preventing abuse
of their Internet connection.
endef

define Package/wifidog/conffiles
/etc/wifidog.conf
endef

define Package/wifidog/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/scripts/init.d/wifidog $(1)/usr/bin/wifidog-init
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/wifidog $(1)/usr/bin/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/wdctl $(1)/usr/bin/
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libhttpd.so* $(1)/usr/lib/
$(INSTALL_DIR) $(1)/etc/
$(INSTALL_CONF) $(PKG_BUILD_DIR)/wifidog.conf $(1)/etc/
$(INSTALL_CONF) $(PKG_BUILD_DIR)/wifidog-msg.html $(1)/etc/
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) $(PKG_BUILD_DIR)/contrib/build-openwrt-global/wifidog/files/$(OPENWRT_FILESDIR)/wifidog.init $(1)/etc/init.d/wifidog
endef

$(eval $(call BuildPackage,wifidog))
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
# Updated from post https://dev.openwrt.org/ticket/14761

USE_PROCD=1

START=99
EXTRA_COMMANDS="status"
EXTRA_HELP=" status Print the status of the service"

WIFIDOG_CONF=/etc/wifidog.conf


start_service() {
procd_open_instance
procd_set_param command /usr/bin/wifidog-init start
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this work? I think wifidog-init defaults to daemon mode. Wifidog -f is required for procd.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should work. "start" parameter should be added to another line.
As already written, wifidog-init should be avoided, for a more robust approach.

procd_set_param respawn # respawn automatically if something died, be careful if you have an alternative process supervisor
procd_set_param file $WIFIDOG_CONF
procd_close_instance
}

stop_service() {
/usr/bin/wifidog-init stop
}

status() {
/usr/bin/wifidog-init status
}

service_triggers() {
### Trigger, reload service on network change
procd_add_reload_interface_trigger "$(grep 'GatewayInterface' $WIFIDOG_CONF | grep -v ^# | awk '{print $2}')"
procd_add_reload_trigger "$WIFIDOG_CONF"
}

18 changes: 18 additions & 0 deletions contrib/build-openwrt-global/wifidog/files/common/wifidog.init
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
START=65
EXTRA_COMMANDS="status"
EXTRA_HELP=" status Print the status of the service"


start() {
/usr/bin/wifidog-init start
}

stop() {
/usr/bin/wifidog-init stop
}

status() {
/usr/bin/wifidog-init status
}