Project

General

Profile

« Previous | Next » 

Revision e173dd74

Added by Phil Davis over 10 years ago

Code style for etc files

View differences:

etc/rc.update_bogons.sh
13 13
	local url=$2
14 14
	local filename=${url##*/}
15 15
	local ext=${filename#*.}
16
	
16

  
17 17
	/usr/bin/fetch -a -w 600 -T 30 -q -o $file "${url}"
18
	
18

  
19 19
	if [ ! -f $file ]; then
20 20
		echo "Could not download ${url}" | logger
21 21
		proc_error="true"
22 22
	fi
23
	
23

  
24 24
	case "$ext" in
25 25
		tar)
26 26
			mv $file $file.tmp
......
41 41
		*)
42 42
			;;
43 43
	esac
44
	
44

  
45 45
	if [ -f $file.tmp ]; then
46 46
		rm $file.tmp
47 47
	fi
48
	
48

  
49 49
	if [ ! -f $file ]; then
50 50
		echo "Could not extract ${filename}" | logger
51 51
		proc_error="true"
......
56 56

  
57 57
# Sleep for some time, unless an argument is specified.
58 58
if [ "$1" = "" ]; then
59
    # Grab a random value  
60
    value=`od -A n -d -N2 /dev/random | awk '{ print $1 }'`
61
    echo "rc.update_bogons.sh is sleeping for $value" | logger
62
    sleep $value
63
fi    
59
	# Grab a random value
60
	value=`od -A n -d -N2 /dev/random | awk '{ print $1 }'`
61
	echo "rc.update_bogons.sh is sleeping for $value" | logger
62
	sleep $value
63
fi
64 64

  
65 65
echo "rc.update_bogons.sh is beginning the update cycle." | logger
66 66

  
......
92 92
if [ "$BOGON_V4_CKSUM" = "$ON_DISK_V4_CKSUM" ] || [ "$BOGON_V6_CKSUM" = "$ON_DISK_V6_CKSUM" ]; then
93 93
	# At least one of the downloaded checksums matches, so mount RW
94 94
	/etc/rc.conf_mount_rw
95
	
95

  
96 96
	ENTRIES_MAX=`pfctl -s memory | awk '/table-entries/ { print $4 }'`
97
	
97

  
98 98
	if [ "$BOGON_V4_CKSUM" = "$ON_DISK_V4_CKSUM" ]; then
99 99
		ENTRIES_TOT=`pfctl -vvsTables | awk '/Addresses/ {s+=$2}; END {print s}'`
100 100
		ENTRIES_V4=`pfctl -vvsTables | awk '/-\tbogons$/ {getline; print $2}'`
......
138 138
		echo "Could not download ${v6url} (checksum mismatch)" | logger
139 139
		checksum_error="true"
140 140
	fi
141
	
141

  
142 142
	# We mounted RW, so switch back to RO
143 143
	/etc/rc.conf_mount_ro
144 144
fi
145 145

  
146 146
if [ "$checksum_error" != "" ]; then
147 147
	# Relaunch and sleep
148
	sh /etc/rc.update_bogons.sh & 
148
	sh /etc/rc.update_bogons.sh &
149 149
	exit
150 150
fi
151 151

  

Also available in: Unified diff