packages/net/imspector/files/imspector.init
nico 6eb76e31ba packages/imspector: use new service functions, change 'enable' option to 'enabled'
git-svn-id: svn://svn.openwrt.org/openwrt/packages@29089 3c298f89-4303-0410-b956-a3cf2f4a3e73
2011-11-14 02:38:30 +00:00

57 lines
1.5 KiB
Bash

#!/bin/sh /etc/rc.common
# Copyright (C) 2008-2011 OpenWrt.org
START=50
CFGFILE=/var/etc/imspector.conf
atom() {
local section="$1"
local option="$2"
config_get _value "$section" "$option"
[ -n "$_value" ] && echo "$option=${_value}"
}
start_instance() {
local section="$1"
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
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
filtered_mins filtered_response icq_protocol irc_protocol
msn_protocol yahoo_protocol gg_protocol jabber_protocol
https_protocol log_typing_events file_logging_dir mysql_server
mysql_database mysql_username mysql_password sqlite_file
pgsql_connect badwords_filename badwords_replace_character
badwords_block_count acl_filename db_filter_filename
block_files block_webcams censord'
for option in $options; do
atom "$section" "$option" '"' >> $CFGFILE
done
service_start /usr/sbin/imspector -c "$CFGFILE"
}
start() {
mkdir -m 0755 -p /var/etc
mkdir -m 0755 -p /var/log/imspector
config_load 'imspector'
config_foreach start_instance 'imspector'
}
stop() {
service_stop /usr/sbin/imspector
}