summaryrefslogtreecommitdiffstats
path: root/net/privoxy/test.sh
blob: 1a08394123d94929fca5f6e73d4b1b09806deb65 (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
#!/bin/sh

[ "$1" = "privoxy" ] || exit 0

# Verify key filter and action files are installed
[ -f /etc/privoxy/default.filter ]
[ -f /etc/privoxy/match-all.action ]
[ -x /etc/init.d/privoxy ]

# Write a minimal config and verify privoxy starts and listens
cat > /tmp/privoxy-test.conf << 'EOF'
listen-address 127.0.0.1:18118
logdir /tmp
logfile privoxy-test.log
confdir /etc/privoxy
filterfile default.filter
actionsfile match-all.action
EOF

timeout 3 privoxy --no-daemon /tmp/privoxy-test.conf &
PRIVOXY_PID=$!
sleep 1
if kill -0 "$PRIVOXY_PID" 2>/dev/null; then
	echo "privoxy is running"
	kill "$PRIVOXY_PID"
	wait "$PRIVOXY_PID" 2>/dev/null || true
else
	echo "privoxy did not start"
	false
fi