openwrt_archive/net/imspector/files/imspector.init
Steven Barth 9e3c3c00e1 Added package imspector
SVN-Revision: 13107
2008-11-03 19:27:06 +00:00

60 lines
1.4 KiB
Bash

#!/bin/sh /etc/rc.common
# Copyright (C) 2008 OpenWrt.org
START=50
DAEMON=/usr/sbin/imspector
CFGFILE=/var/etc/imspector.conf
start() {
config_load imspector
config_foreach start_imspector imspector
}
stop() {
start-stop-daemon -q -x "$DAEMON" -K
rm -f $CFGFILE
}
restart() {
stop
sleep 2
start
}
start_imspector() {
config_get_bool enable "$1" enable
[ "$enable" -eq "1" ] || return 0
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
user group ssl ssl_key ssl_cert icq_protocol irc_protocol
msn_protocol yahoo_protocol gg_protocol jabber_protocol
https_protocol log_typing_events file_logging_dir
badwords_filename badwords_replace_character badwords_block_count
acl_filename db_filter_filename block_unlisted block_files block_webcams
mysql_server mysql_database mysql_username mysql_password
sqlite_file pgsql_connect censord'
for option in $imspector_options; do
imspector_atom "$1" "$option" '"' >> $CFGFILE
done
start-stop-daemon -S -q -x "$DAEMON" -- -c "$CFGFILE"
}
imspector_atom() {
local SECTION=$1
local OPTION=$2
config_get _value "$SECTION" "$OPTION"
[ -n "$_value" -o "$EMPTY_DISABLED" -eq "1" ] && {
echo "$OPTION=${_value}"
}
}