Changeset 29089


Ignore:
Timestamp:
2011-11-14T03:38:30+01:00 (4 years ago)
Author:
nico
Message:

packages/imspector: use new service functions, change 'enable' option to 'enabled'

Location:
packages/net/imspector
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • packages/net/imspector/Makefile

    r25319 r29089  
    1 # Copyright (C) 2007-2009 OpenWrt.org 
     1# 
     2# Copyright (C) 2007-2011 OpenWrt.org 
    23# 
    34# This is free software, licensed under the GNU General Public License v2. 
    45# See /LICENSE for more information. 
    56# 
     7# Author: Carlos Cesario 
    68# 
    7 # Author: Carlos Cesario 
    89 
    910include $(TOPDIR)/rules.mk 
     
    1112PKG_NAME:=imspector 
    1213PKG_VERSION:=0.9 
    13 PKG_RELEASE:=1 
     14PKG_RELEASE:=2 
    1415 
    1516PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz 
  • packages/net/imspector/files/imspector.config

    r16494 r29089  
    11config imspector 
    22        # Enable the proxy 
    3         option enable 1 
     3        option enabled 1 
    44 
    55        # The listening ip address for redirected connections 
  • packages/net/imspector/files/imspector.init

    r16494 r29089  
    11#!/bin/sh /etc/rc.common 
    2 # Copyright (C) 2008 OpenWrt.org 
     2# Copyright (C) 2008-2011 OpenWrt.org 
     3 
    34START=50 
    45 
    5 DAEMON=/usr/sbin/imspector 
    6 CFG_D=/var/etc 
    7 CFGFILE=$CFG_D/imspector.conf 
    8 LOG_D=/var/log/imspector 
     6CFGFILE=/var/etc/imspector.conf 
    97 
    10 start() { 
    11         [ -d $CFG_D ] || mkdir -p $CFG_D 
    12         [ -d $LOG_D ] || mkdir -p $LOG_D 
     8atom() { 
     9        local section="$1" 
     10        local option="$2" 
    1311 
    14         config_load imspector 
    15         config_foreach start_imspector imspector 
     12        config_get _value "$section" "$option" 
     13        [ -n "$_value" ] && echo "$option=${_value}" 
    1614} 
    1715 
    18 stop() { 
    19         start-stop-daemon -q -x "$DAEMON" -K 
    20         rm -f $CFGFILE 
    21 } 
     16start_instance() { 
     17        local section="$1" 
    2218 
    23 restart() { 
    24         stop 
    25         sleep 2 
    26         start 
    27 } 
    28  
    29 start_imspector() { 
    30         config_get_bool enable "$1" enable 
    31         [ "$enable" -eq "1" ] || return 0 
     19        config_get_bool enabled "$section" enabled '0' 
     20        [ $enabled -gt 0 ] || return 1 
    3221 
    3322        echo '### AUTOGENERATED CONFIGURATION' > $CFGFILE 
     
    3625        echo '' >> $CFGFILE 
    3726 
    38         imspector_options='listenaddr port http_port pidfilename plugin_dir 
     27        options='listenaddr port http_port pidfilename plugin_dir 
    3928                user group ssl ssl_key ssl_cert ssl_ca_key ssl_ca_cert 
    4029                ssl_cert_dir ssl_verify_dir ssl_verify response_prefix 
     
    4837                block_files block_webcams censord' 
    4938         
    50         for option in $imspector_options; do 
    51                 imspector_atom "$1" "$option" '"' >> $CFGFILE 
     39        for option in $options; do 
     40                atom "$section" "$option" '"' >> $CFGFILE 
    5241        done 
    5342 
    54         start-stop-daemon -S -q -x "$DAEMON" -- -c "$CFGFILE" 
     43        service_start /usr/sbin/imspector -c "$CFGFILE" 
    5544} 
    5645 
    57 imspector_atom() { 
    58         local SECTION=$1 
    59         local OPTION=$2 
     46start() { 
     47        mkdir -m 0755 -p /var/etc 
     48        mkdir -m 0755 -p /var/log/imspector 
    6049 
    61         config_get _value "$SECTION" "$OPTION" 
    62         [ -n "$_value" -o "$EMPTY_DISABLED" -eq "1" ] && { 
    63                 echo "$OPTION=${_value}" 
    64         } 
     50        config_load 'imspector' 
     51        config_foreach start_instance 'imspector' 
    6552} 
     53 
     54stop() { 
     55        service_stop /usr/sbin/imspector 
     56} 
Note: See TracChangeset for help on using the changeset viewer.