summaryrefslogtreecommitdiff
path: root/net-vpn/openconnect/files/openconnect.initd
blob: 69f9999f6ad9a6160435a1ce3de29b55870cc78a (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
#!/sbin/openrc-run
# Copyright 2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

vpn=${RC_SVCNAME#*.}
command="/usr/sbin/openconnect"
pidfile="/run/openconnect/${vpn}.pid"
command_args="--syslog ${command_args}"
command_args_background="--background --pid-file \"${pidfile}\""
stopsig="SIGINT"

start_pre() {
	checkpath -d /run/openconnect
}

start() {
	if [ -n "${password}" ]; then
		command_args="${command_args} --passwd-on-stdin"
		default_start <<EOF
${password}
EOF
	elif [ -n "${password_file}" ]; then
		command_args="${command_args} --passwd-on-stdin"
		default_start <"${password_file}"
	else
		default_start
	fi
}