summaryrefslogtreecommitdiffstats
path: root/usr/local/sbin/update_file.sh
blob: a4575159f5df44569a64244f2a41183d36d2c2c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/sh

if [ ! -x `which fetch` ];then
    echo "no fetch found, I think databeestje lost that part"
    exit 0
fi

baseurl='http://pfsense.com/cgi-bin/cvsweb.cgi/pfSense'
urlrev='?rev='
urlcon=';content-type=text%2Fplain'
rev='1'

if [ -z $1 ];then
    echo "No file to update given"
    echo "Usage: $0 /path/to/file [revision]"
    exit 0
fi

if [ ! -f $1 ];then
    echo "File $1 doesn't exist"
    exit 0
fi

if [ ! -z $2 ];then
    rev=$2
    echo "trying to fetch $rev"
else
    echo "trying to fetch latest"
fi

/etc/rc.conf_mount_rw

`which fetch` -o "$1" "$baseurl$1$urlrev$rev$urlcon"

/etc/rc.conf_mount_ro
OpenPOWER on IntegriCloud