summaryrefslogtreecommitdiff
path: root/debian/if-up.d/arti
blob: df305efbd23cbc760706bbb5477fd86b9d0312fa (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
#! /bin/sh
# Reload Arti proxy when an interface comes up, to allow Arti to
# reconstruct new circuits.
# https://gitlab.torproject.org/tpo/core/arti/-/issues/1861

set -e

# Don't bother to restart Arti when lo is configured.
if [ "$IFACE" = "lo" ]; then
	exit 0
fi

# Only run from ifup.
if [ "$MODE" != "start" ]; then
	exit 0
fi

# Arti only cares about inet and inet6.
if [ "$ADDRFAM" != "inet" ] && [ "$ADDRFAM" != "inet6" ]; then
	exit 0
fi

# Is Arti installed?
if [ ! -e /usr/bin/arti ]; then
	exit 0
fi

if [ "$(pgrep arti)" ]; then
	service arti restart
fi

exit 0