ocserv and user-profile=profile.xml
Running OpenConnect’s ocserv with user-profile=profile.xml creates some headache as all files are removed from /var/run at reboot. Enabling ocserv_prep in /etc/rc.conf and adding this shell script solves that problem.
#!/bin/sh
#
# PROVIDE: ocserv_prep
# BEFORE: ocserv
#
# Add the following to /etc/rc.conf to enable ocserv_prep:
#
# ocserv_prep_enable="YES"
#
. /etc/rc.subr
: ${ocserv_prep_enable:="NO"}
name="ocserv_prep"
rcvar="ocserv_prep_enable"
load_rc_config ${name}
start_cmd=ocserv_prep_start
stop_cmd=:
ocserv_prep_start()
{
echo Starting ${name}.
mkdir -p /var/run/ocserv
cp -p /usr/local/etc/ocserv/profile.xml /var/run/ocserv
}
run_rc_command "$1"