chillispot: use service wrappers, use network.sh to find ip address
authorJo-Philipp Wich <jow@openwrt.org>
Mon, 28 May 2012 15:45:55 +0000 (15:45 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Mon, 28 May 2012 15:45:55 +0000 (15:45 +0000)
SVN-Revision: 31951

net/chillispot/Makefile
net/chillispot/files/chillispot.init

index f55253001b7c3d4ab8f4b5af7e99604cc305b812..0f007ba4578cbb49a7408d58da2e4ea3a18c3e4e 100644 (file)
@@ -1,5 +1,5 @@
 #
-# Copyright (C) 2006-2010 OpenWrt.org
+# Copyright (C) 2006-2012 OpenWrt.org
 #
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=chillispot
 PKG_VERSION:=1.1.0
-PKG_RELEASE:=3
+PKG_RELEASE:=4
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=http://www.chillispot.info/download
index bf0e3f6486d3de829be12662b1bb09c87d299ca9..3fbba8d7fec43272532be114e725bf571fa4aac6 100644 (file)
@@ -1,19 +1,19 @@
 #!/bin/sh /etc/rc.common
-# Copyright (C) 2006 OpenWrt.org
+# Copyright (C) 2006-2012 OpenWrt.org
+
 START=50
 
-RUN_D=/var/run
-PID_F=$RUN_D/chilli.pid
+SERVICE_USE_PID=1
+SERVICE_PID_FILE=/var/run/chilli.pid
 
 start() {
-       include /lib/network
-       scan_interfaces
-       /sbin/insmod tun >/dev/null 2>&1
-       [ -d $RUN_D ] || mkdir -p $RUN_D
-       config_get ipaddr lan ipaddr
-       /usr/sbin/chilli --dns1="$ipaddr"
+       . /lib/functions/network.sh
+
+       local ipaddr
+       network_get_ipaddr ipaddr lan && \
+               service_start /usr/sbin/chilli --dns1="$ipaddr"
 }
 
 stop() {
-       [ -f $PID_F ] && kill $(cat $PID_F) >/dev/null 2>&1
+       service_stop /usr/sbin/chilli
 }