summaryrefslogtreecommitdiffstats
path: root/apache24.sh
blob: 5fce133e6dc75badba154b08df4a4b1f733980e9 (plain) (blame)
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
# This source code is released into the public domain.
#
# The Apache allow_internal.conf file is a list of "Require ip <prefix>",
# one per line.

APACHE_FILE="/usr/local/etc/apache24/allow_internal.conf"
APACHE_TEMP="${APACHE_FILE}.ldaptmp"

if [ ! -f "$APACHE_FILE" ]; then
	exit 0
fi

awk <"$NETWORKS_FILE" >"$APACHE_TEMP" '{ print "Require ip " $1 }'

if cmp -s "$APACHE_TEMP" "$APACHE_FILE"; then
	rm "$APACHE_TEMP"
	exit 0
fi

printf '%s updated:\n\n' "$APACHE_FILE"
diff "$APACHE_FILE" "$APACHE_TEMP"
printf '\n'

mv "$APACHE_TEMP" "$APACHE_FILE" 
/usr/local/sbin/apachectl graceful