On 2/6/19 11:15 AM, Leonid Bobrov wrote:
Hi Brian!

First, I tried setting up daemon at init level, I added to
/usr/ports/infrastructure/db/user.list the following:
831 _toxdht _toxdht net/toxcore

Then I added toxdht.rc to net/toxcore/pkg with contents:
```
#!/bin/ksh
daemon="${TRUEPREFIX}/bin/tox-bootstrapd --config /etc/tox-bootstrapd.conf"

. /etc/rc.d/rc.subr

rc_pre() {
         rm -f /var/run/tox-bootstrapd/tox-bootstrapd.pid
}
```

Then I appended to plist (with post-install target in Makefile to have
sample configuration file):
```
@newgroup _toxdht:831
@newuser _toxdht:831:831:daemon:Tox DHT bootstrap 
daemon:/var/lib/tox-bootstrapd:/sbin/nologin
@rcscript ${RCDIR}/toxdht
share/examples/tox-bootstrapd/tox-bootstrapd.conf.sample
@sample ${SYSCONFDIR}/tox-bootstrapd.conf
@mode 750
@owner _toxdht
@group _toxdht
@sample /var/lib/tox-bootstrapd/
@mode 755
@sample /var/run/tox-bootstrapd/
```

After that I ran `rcctl start toxdht` and got output "toxdht(ok)", it
created /var/run/tox-bootstrapd/tox-bootstrapd.pid file and exited,
I couldn't find it by running both ps(1) (with -aux flags) and top(1),
then I tried manually running it:
```
$ doas -u _toxdht tox-bootstrapd --config /etc/tox-boostrapd.conf
$ echo $?
0
```

Again it created /var/run/tox-bootstrapd/tox-bootstrapd.pid file, but
again I couldn't find its process. Here's default config I used:
https://github.com/TokTok/c-toxcore/blob/master/other/bootstrap_daemon/tox-bootstrapd.conf

I can't understand how to make it run at init level.

I think we're looking at two independent issues:
1. Does the bootstrap daemon work?
2. Does it work through init with a fancy rcctl script?

The answer to question 1 is unequivocally "yes" since I was running it on my machine and it worked. The answer to question 2 is a little trickier. At the moment it seems to be "no" but in reality it's more like "not yet."

Because the answer to question 1 is yes, I think we should return to building and shipping the daemon. Because toxcore is a dependency of other ports, I don't think the answer to question 2 should block the update but it should be something to be worked on for future inclusion (or more likely upstreaming).

~Brian

Reply via email to