aboutsummaryrefslogtreecommitdiff
blob: 25e6b309655a5ae790171c8054927d1b9a519ad9 (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
#!/sbin/openrc-run
# Copyright 2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

name="fort validator daemon"
description="FORT validator is an open source RPKI validator."
command=/usr/bin/fort
command_args="${FORT_OPTS}"
command_user="fort"
pidfile="/run/${RC_SVCNAME}.pid"
command_background=true

depend() {
	need net
}

start_pre() {
	if [ -z "${FORT_BASEDIR}" ]; then
		FORT_BASEDIR=$(awk -F '"' '/local-repository/ { print $4 }' \
			/etc/fort/config.json)
		FORT_BASEDIR="${FORT_BASEDIR:-/var/cache/fort/repository/}"
	fi

	checkpath -d -m 0755 -o fort:fort "$(dirname "${FORT_BASEDIR}")"
	checkpath -d -m 0755 -o fort:fort "${FORT_BASEDIR}"
}