[packages_10.03.2] imspector: merge r29089
authorJo-Philipp Wich <jow@openwrt.org>
Sun, 5 Feb 2012 15:17:28 +0000 (15:17 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Sun, 5 Feb 2012 15:17:28 +0000 (15:17 +0000)
SVN-Revision: 30208

net/imspector/Makefile
net/imspector/files/imspector.config
net/imspector/files/imspector.init

index 2e0f8693d2bc2087ec7cf0f7b40b49d90f04297d..999087208267ef1d95c401a62da07dc69574d6cc 100644 (file)
@@ -1,16 +1,17 @@
-# Copyright (C) 2007-2009 OpenWrt.org
+#
+# Copyright (C) 2007-2011 OpenWrt.org
 #
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
 #
-#
 # Author: Carlos Cesario
+#
 
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=imspector
 PKG_VERSION:=0.9
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=http://www.imspector.org/downloads
index 4eb687aff5f0b6ef69d5585293c66dac40a026b5..571cd64f7109966050bc0e5bff31f6ea961c299d 100644 (file)
@@ -1,6 +1,6 @@
 config imspector
        # Enable the proxy
-       option enable 1
+       option enabled 1
 
        # The listening ip address for redirected connections
        option listenaddr 0.0.0.0
index 99d4798f52d1eb7f2ff4da955e167bbcdb7dc9c2..8c0b991632a9f501e167245a897297a810df44f4 100644 (file)
@@ -1,41 +1,30 @@
 #!/bin/sh /etc/rc.common
-# Copyright (C) 2008 OpenWrt.org
+# Copyright (C) 2008-2011 OpenWrt.org
+
 START=50
 
-DAEMON=/usr/sbin/imspector
-CFG_D=/var/etc
-CFGFILE=$CFG_D/imspector.conf
-LOG_D=/var/log/imspector
+CFGFILE=/var/etc/imspector.conf
 
-start() {
-       [ -d $CFG_D ] || mkdir -p $CFG_D
-       [ -d $LOG_D ] || mkdir -p $LOG_D
+atom() {
+       local section="$1"
+       local option="$2"
 
-       config_load imspector
-       config_foreach start_imspector imspector
-}
-
-stop() {
-       start-stop-daemon -q -x "$DAEMON" -K
-       rm -f $CFGFILE
+       config_get _value "$section" "$option"
+       [ -n "$_value" ] && echo "$option=${_value}"
 }
 
-restart() {
-       stop
-       sleep 2
-       start
-}
+start_instance() {
+       local section="$1"
 
-start_imspector() {
-       config_get_bool enable "$1" enable
-       [ "$enable" -eq "1" ] || return 0
+       config_get_bool enabled "$section" enabled '0'
+       [ $enabled -gt 0 ] || return 1
 
        echo '### AUTOGENERATED CONFIGURATION' > $CFGFILE
        echo '### DO NOT EDIT' >> $CFGFILE
        echo '### SEE /etc/config/imspector INSTEAD' >> $CFGFILE
        echo '' >> $CFGFILE
 
-       imspector_options='listenaddr port http_port pidfilename plugin_dir
+       options='listenaddr port http_port pidfilename plugin_dir
                user group ssl ssl_key ssl_cert ssl_ca_key ssl_ca_cert
                ssl_cert_dir ssl_verify_dir ssl_verify response_prefix
                response_postfix responder_filename notice_days notice_response
@@ -47,19 +36,21 @@ start_imspector() {
                badwords_block_count acl_filename db_filter_filename
                block_files block_webcams censord'
        
-       for option in $imspector_options; do
-               imspector_atom "$1" "$option" '"' >> $CFGFILE
+       for option in $options; do
+               atom "$section" "$option" '"' >> $CFGFILE
        done
 
-       start-stop-daemon -S -q -x "$DAEMON" -- -c "$CFGFILE"
+       service_start /usr/sbin/imspector -c "$CFGFILE"
 }
 
-imspector_atom() {
-       local SECTION=$1
-       local OPTION=$2
+start() {
+       mkdir -m 0755 -p /var/etc
+       mkdir -m 0755 -p /var/log/imspector
 
-       config_get _value "$SECTION" "$OPTION"
-       [ -n "$_value" -o "$EMPTY_DISABLED" -eq "1" ] && {
-               echo "$OPTION=${_value}"
-       }
+       config_load 'imspector'
+       config_foreach start_instance 'imspector'
+}
+
+stop() {
+       service_stop /usr/sbin/imspector
 }