1
|
#!/bin/sh
|
2
|
|
3
|
if [ ! -x `which fetch` ];then
|
4
|
echo "no fetch found, I think databeestje lost that part"
|
5
|
exit 0
|
6
|
fi
|
7
|
|
8
|
baseurl='http://pfsense.com/cgi-bin/cvsweb.cgi/pfSense'
|
9
|
urlrev='?rev='
|
10
|
urlcon=';content-type=text%2Fplain'
|
11
|
rev='1'
|
12
|
|
13
|
if [ -z $1 ];then
|
14
|
echo "No file to update given"
|
15
|
echo "Usage: `basename $0` /path/to/file [revision]"
|
16
|
echo "Usage: `basename $0` -all"
|
17
|
exit 0
|
18
|
fi
|
19
|
|
20
|
/etc/rc.conf_mount_rw
|
21
|
|
22
|
if [ "$1" = "-all" ];then
|
23
|
echo "This will update all .php .js and .inc pages on your pfsense box!"
|
24
|
FMATCHES=`find /etc/inc/ /usr/local/www /usr/local/captiveportal -name "*.php" -or -name "*.inc" -or -name "*.js"`
|
25
|
elif [ ! -f $1 ];then
|
26
|
echo "File $1 doesn't exist"
|
27
|
exit 0
|
28
|
else
|
29
|
FMATCHES=$1
|
30
|
fi
|
31
|
|
32
|
for file in $FMATCHES ;do
|
33
|
|
34
|
if [ ! -z $2 ];then
|
35
|
rev=$2
|
36
|
echo "trying to fetch $rev $file"
|
37
|
else
|
38
|
echo "trying to fetch latest $file"
|
39
|
fi
|
40
|
|
41
|
/usr/bin/fetch -T 60 -q -o "$file" "$baseurl$file$urlrev$rev$urlcon"
|
42
|
|
43
|
if [ $? -eq 0 ]; then
|
44
|
echo "File updated."
|
45
|
else
|
46
|
echo "An error occured during update."
|
47
|
fi
|
48
|
|
49
|
done
|
50
|
|
51
|
/etc/rc.conf_mount_ro
|
52
|
|