Subversion Repositories ALCASAR

Rev

Rev 2192 | Rev 2223 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 2192 Rev 2193
Line 1... Line 1...
1
#/bin/bash
1
#/bin/bash
2
 
2
 
3
# $Id: alcasar-bl.sh 2192 2017-05-01 19:52:53Z richard $
3
# $Id: alcasar-bl.sh 2193 2017-05-01 21:04:51Z richard $
4
 
4
 
5
# alcasar-bl.sh
5
# alcasar-bl.sh
6
# by Franck BOUIJOUX and Richard REY
6
# by Franck BOUIJOUX and Richard REY
7
# This script is distributed under the Gnu General Public License (GPL)
7
# This script is distributed under the Gnu General Public License (GPL)
8
 
8
 
Line 71... Line 71...
71
		# echo ".Include<$DIR_DG_BL/$ENABLE_CATEGORIE/domains>" >> $DIR_DG/bannedsitelist  # Blacklisted domains are managed by dnsmasq
71
		# echo ".Include<$DIR_DG_BL/$ENABLE_CATEGORIE/domains>" >> $DIR_DG/bannedsitelist  # Blacklisted domains are managed by dnsmasq
72
		echo ".Include<$DIR_DG_BL/$ENABLE_CATEGORIE/urls>" >> $DIR_DG/bannedurllist
72
		echo ".Include<$DIR_DG_BL/$ENABLE_CATEGORIE/urls>" >> $DIR_DG/bannedurllist
73
	done
73
	done
74
	sort +0.0 -0.2 $BL_CATEGORIES -o $FILE_tmp
74
	sort +0.0 -0.2 $BL_CATEGORIES -o $FILE_tmp
75
	mv $FILE_tmp $BL_CATEGORIES
75
	mv $FILE_tmp $BL_CATEGORIES
-
 
76
	sort +0.0 -0.2 $BL_CATEGORIES_ENABLED -o $FILE_tmp
-
 
77
	mv $FILE_tmp $BL_CATEGORIES_ENABLED
76
	chown root:apache $BL_CATEGORIES
78
	chown root:apache $BL_CATEGORIES $BL_CATEGORIES_ENABLED
77
	chmod 660 $BL_CATEGORIES
79
	chmod 660 $BL_CATEGORIES $BL_CATEGORIES_ENABLED
78
 
80
 
79
# process the file $WL_CATEGORIES with the choice of categories 
81
# process the file $WL_CATEGORIES with the choice of categories 
80
	for ENABLE_CATEGORIE in `cat $WL_CATEGORIES_ENABLED` 
82
	for ENABLE_CATEGORIE in `cat $WL_CATEGORIES_ENABLED` 
81
	do
83
	do
82
		$SED "/\/$ENABLE_CATEGORIE$/d" $WL_CATEGORIES 
84
		$SED "/\/$ENABLE_CATEGORIE$/d" $WL_CATEGORIES 
83
		$SED "1i\/etc\/dansguardian\/lists\/blacklists\/$ENABLE_CATEGORIE" $WL_CATEGORIES
85
		$SED "1i\/etc\/dansguardian\/lists\/blacklists\/$ENABLE_CATEGORIE" $WL_CATEGORIES
84
		ln -sf $DIR_DNS_WL/$ENABLE_CATEGORIE.conf $DIR_DNS_WL_ENABLED/$ENABLE_CATEGORIE
86
		ln -sf $DIR_DNS_WL/$ENABLE_CATEGORIE.conf $DIR_DNS_WL_ENABLED/$ENABLE_CATEGORIE
85
	done
87
	done
86
	sort +0.0 -0.2 $WL_CATEGORIES -o $FILE_tmp
88
	sort +0.0 -0.2 $WL_CATEGORIES -o $FILE_tmp
87
	mv $FILE_tmp $WL_CATEGORIES
89
	mv $FILE_tmp $WL_CATEGORIES
-
 
90
	sort +0.0 -0.2 $WL_CATEGORIES_ENABLED -o $FILE_tmp
-
 
91
	mv $FILE_tmp $WL_CATEGORIES_ENABLED
88
	chown root:apache $WL_CATEGORIES
92
	chown root:apache $WL_CATEGORIES $WL_CATEGORIES_ENABLED
89
	chmod 660 $WL_CATEGORIES
93
	chmod 660 $WL_CATEGORIES $WL_CATEGORIES_ENABLED
90
}
94
}
91
 
95
 
92
# cleaning file and split it ("domains" in $FILE_tmp & "IP" in $FILE_ip_tmp)
96
# cleaning file and split it ("domains" in $FILE_tmp & "IP" in $FILE_ip_tmp)
93
function clean_split (){
97
function clean_split (){
94
	$SED '/^#.*/d' $FILE_tmp # remove commented lines
98
	$SED '/^#.*/d' $FILE_tmp # remove commented lines