#!/bin/sh DAEMON=privoxy DAEMON_CONFIG=/mod/etc/$DAEMON/config . /etc/init.d/modlibrc config() { [ ! -d "/mod/etc/$DAEMON" ] && mkdir -p /mod/etc/$DAEMON [ ! -r "/mod/etc/privoxy/default.filter" ] && ln -s /etc/privoxy/default.filter /mod/etc/privoxy/default.filter [ ! -r "/mod/etc/privoxy/default.action" ] && ln -s /etc/privoxy/default.action /mod/etc/privoxy/default.action [ ! -r "/mod/etc/privoxy/match-all.action" ] && ln -s /etc/privoxy/match-all.action /mod/etc/privoxy/match-all.action [ ! -d "/mod/etc/privoxy/templates" ] && ln -s /etc/privoxy/templates /mod/etc/privoxy/templates if [ "$PRIVOXY_GET_ADBLOCKLIST" -a -n "${PRIVOXY_ALT_PATH// /}" ]; then /mod/etc/default.privoxy/privoxy_loadadblocklist ${PRIVOXY_ALT_PATH} dowait fi modlib_config } start() { modlib_startdaemon $DAEMON --pidfile /var/run/$DAEMON.pid /mod/etc/privoxy/config } case $1 in ""|load) mkdir -p /tmp/flash/privoxy [ -r /tmp/flash/user.filter ] && mv /tmp/flash/user.filter /tmp/flash/privoxy/user.filter [ -r /tmp/flash/user.action ] && mv /tmp/flash/user.action /tmp/flash/privoxy/user.action [ -r "/tmp/flash/privoxy/user.filter" ] || cp -f /etc/privoxy/user.filter /tmp/flash/privoxy/user.filter [ -r "/tmp/flash/privoxy/user.action" ] || cp -f /etc/privoxy/user.action /tmp/flash/privoxy/user.action if [ "${PRIVOXY_ALT_PATH// /}" ]; then ln -sf ${PRIVOXY_ALT_PATH}/user.filter /tmp/flash/privoxy/user.filter.link ln -sf ${PRIVOXY_ALT_PATH}/user.action /tmp/flash/privoxy/user.action.link else ln -sf user.filter /tmp/flash/privoxy/user.filter.link ln -sf user.action /tmp/flash/privoxy/user.action.link fi modreg file privoxy user_filter 'user.filter' 0 "filter" modreg file privoxy user_action 'user.actions' 0 "action" modreg cgi 'privoxy' 'Privoxy' modreg daemon $DAEMON modreg status $DAEMON privoxy privoxy_log modlib_start $PRIVOXY_ENABLED ;; unload) modunreg status $DAEMON privoxy_log modunreg daemon $DAEMON modunreg cgi privoxy modunreg file privoxy modlib_stop ;; start) modlib_start ;; stop) modlib_stop ;; restart) modlib_restart ;; status) modlib_status ;; *) echo "Usage: $0 [load|unload|start|stop|restart|status]" 1>&2 exit 1 ;; esac exit 0