]> git.ipfire.org Git - ipfire-2.x.git/blame - config/urlfilter/prebuild.pl
Connections.cgi neu geschrieben.
[ipfire-2.x.git] / config / urlfilter / prebuild.pl
CommitLineData
10e4f239
MT
1#!/usr/bin/perl
2#
3# This code is distributed under the terms of the GPL
4#
5# (c) written from scratch
6#
10e4f239
MT
7
8$dbdir="/var/ipfire/urlfilter/blacklists";
9
10system("/usr/bin/squidGuard -C all");
11
12if (-e "$dbdir/custom/allowed/domains.db") { unlink("$dbdir/custom/allowed/domains.db"); }
13if (-e "$dbdir/custom/allowed/urls.db") { unlink("$dbdir/custom/allowed/urls.db"); }
14if (-e "$dbdir/custom/blocked/domains.db") { unlink("$dbdir/custom/blocked/domains.db"); }
15if (-e "$dbdir/custom/blocked/urls.db") { unlink("$dbdir/custom/blocked/urls.db"); }
16
17system("chown -R nobody.nobody $dbdir");
18
1465b127
MT
19&setpermissions ($dbdir);
20
21# -------------------------------------------------------------------
22
23sub setpermissions
10e4f239 24{
1465b127
MT
25 my $bldir = $_[0];
26
27 foreach $category (<$bldir/*>)
28 {
29 if (-d $category){
30 system("chmod 755 $category &> /dev/null");
31 foreach $blacklist (<$category/*>)
32 {
33 if (-f $blacklist) { system("chmod 644 $blacklist &> /dev/null"); }
34 if (-d $blacklist) { system("chmod 755 $blacklist &> /dev/null"); }
35 }
36 system("chmod 666 $category/*.db &> /dev/null");
37 &setpermissions ($category);
10e4f239 38 }
10e4f239
MT
39 }
40}
1465b127
MT
41
42# -------------------------------------------------------------------