Hi, > > About the former matter: It's good for omitting redundant code > > for parsing rc_directories, rcvar and name. If you want to > > restart a service currently, you have to parse rc.conf and in > > some cases also all rc scripts manually for their names and > > rcvar to get the right one. > > What redundant code would be eliminated, and what manual parsing > would be eliminated? I am just not seeing it. > > Sure, there are a few lines of redundant code at the top of each > rc.d script, but adding a wrapper does nothing to remove that > redundant code. Getting rid of the rc.d scripts would get rid of > the redundant code, but I thought you explicitly said that you did > not want to do that. this is not about changing anything about rc.d scripts, they shall remain in place and not be touched. It's just for userland programs to simplify restarting things. > When I want to restart a service like "named", I don't have to do > any manual parsing; I just run "/etc/rc.d/named restart". This is the easiest case. But say, you have several rc_directories and you want to know if a specific additional service is enabled, which does not have the same name as its rc variable. Then you have to parse rc.conf, check all rc directories, check their rc variables, evaluate their rc variables and names and then check back rc.conf whether it is enabled. But, though it might be bad style, there's also the name variable in each rc script, still forcing you to check all scripts. If there is e.g. no /etc/rc.d/named, you would have to check all files in all rc_directories by hand for the name named you're looking for. Either a few lines of sh code or one bad-ass line of sed-sh-mix. Doing any rc magic from a C program must use shell scripts for that, because otherwise parsing rc scripts manually in C is too much effort. I know these use cases are very... constructed ones. Perhaps there's only one use case (for me), so I'd better pack it together with th eother things I'm doing. I just thought it could be a nice addition, maybe only for pkgsrc. Regards, Julian
Attachment:
signature.asc
Description: PGP signature