appfilter.init revision 04b70135
1#!/bin/sh /etc/rc.common 2. /usr/share/libubox/jshn.sh 3. /lib/functions.sh 4 5START=96 6USE_PROCD=1 7OAFD_BIN="/usr/bin/oafd" 8FEATURE_FILE="/tmp/feature.cfg" 9CLASS_FILE="/tmp/app_class.txt" 10service_triggers() 11{ 12 procd_add_reload_trigger "appfilter" 13} 14 15stop_service(){ 16 killall -9 oafd 17 rmmod oaf 18} 19 20start_service(){ 21 lang=`uci get luci.main.lang` 22 test -f $FEATURE_FILE && rm $FEATURE_FILE 23 test -f $CLASS_FILE && rm $CLASS_FILE 24 if [ x"" == x"$lang" -o x"auto" == x"$lang" ];then 25 ln -s /etc/appfilter/feature.cfg $FEATURE_FILE 26 ln -s /etc/appfilter/app_class.txt $CLASS_FILE 27 else 28 if [ -f "/etc/appfilter/feature_$lang.cfg" ];then 29 ln -s /etc/appfilter/feature_$lang.cfg $FEATURE_FILE 30 else 31 ln -s /etc/appfilter/feature.cfg $FEATURE_FILE 32 fi 33 34 if [ -f "/etc/appfilter/app_class_$lang.txt" ];then 35 ln -s /etc/appfilter/app_class_$lang.txt $CLASS_FILE 36 else 37 ln -s /etc/appfilter/app_class.txt $CLASS_FILE 38 fi 39 fi 40 gen_class.sh /tmp/feature.cfg 41 insmod oaf 42 /usr/bin/oaf_rule reload 43 procd_open_instance 44 procd_set_param respawn 60 5 5 45 procd_set_param stderr 1 46 procd_set_param command "$OAFD_BIN" 47 procd_close_instance 48} 49