File: run

package info (click to toggle)
tor 0.4.8.16-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 50,308 kB
  • sloc: ansic: 314,413; sh: 7,386; python: 1,829; makefile: 620; perl: 249; pascal: 141
file content (33 lines) | stat: -rw-r--r-- 962 bytes parent folder | download | duplicates (7)
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
#!/usr/bin/env /lib/runit/invoke-run
readonly daemon=/usr/bin/tor
exec 2>&1

# This directory is referenced in /usr/share/tor/tor-service-defaults-torrc
# and must exist.
readonly rundir=/run/tor
if ! [ -d "${rundir}" ]; then
	mkdir -m 02755 "${rundir}"
	chown debian-tor:debian-tor "${rundir}"
	! [ -x /sbin/restorecon ] || /sbin/restorecon "${rundir}"
fi

MAX_FILEDESCRIPTORS="${MAX_FILEDESCRIPTORS:-65536}"
ulimit -n "${MAX_FILEDESCRIPTORS}"

# default invocation
set -- "${daemon}"                                             \
	--defaults-torrc /usr/share/tor/tor-service-defaults-torrc \
	-f /etc/tor/torrc                                          \
	--Log 'notice stdout'                                      \
	--RunAsDaemon 0

if ! "$@" --verify-config ; then
	echo "persistent error: Tor configuration is not valid"
	exec sv down tor
fi

if aa-status --enabled ; then
	set -- /usr/bin/aa-exec --profile=system_tor -- "$@"
fi

exec /usr/bin/env -i "$@"