[systemd-devel] PATCH: support for parsing /etc/insserv.conf for LSB system facilities

Frederic Crozat fcrozat at suse.com
Mon Jul 4 02:39:57 PDT 2011


Le vendredi 01 juillet 2011 à 23:30 +0200, Lennart Poettering a écrit :
> On Fri, 01.07.11 11:20, Frederic Crozat (fcrozat at suse.com) wrote:
> 
> > Hi,
> 
> Heya,
> > 
> > as discussed on irc, I've implemented parsing /etc/insserv.conf, which,
> > on SUSE (and maybe on Debian), provides LSB System Facilities (instead
> > of using Provides: in LSB initscripts, for things like $network,
> > $portmap, etc..).
> 
> Michael, Tollef, can you comment on this too, plz? Would be good to have
> some input from you if this is useful for Debian, too.

Please note that I didn't put parsing of /etc/insserv.d in the current
patch, as it is not used on openSUSE (but I can add it, if requested ;)

> > I didn't implement the <interactive> part of insserv.conf, since
> > X-Interactive is currently broken in systemd and we'd like to keep
> > sysvinit for openSUSE 12.1 (so, we could just remove X-Interactive flags
> > from legacy initscripts on openSUSE, but when booting with old sysvinit,
> > <interactive> list would be used to tell boot scripts which one are
> > interactive).
> 
> I think the idea of X-Interactive is unfixably broken, i.e. if you end
> up starting a service after boot-up at which time tty1 is blocked by a
> getty, then this will necessarily deadlock. I am not sure how this could
> ever be fixed.

This is why I excluded parsing the list ;)

> > +                t = strstrip(l);
> > +                if ((*t != '$') && (*t != '<'))
> 
> Please don't place redundant brackets here. 

Fixed.
> 
> > +                        continue;
> > +
> > +                parsed = strv_split (t,WHITESPACE);
> 
> Please no spaces between a function and the opening bracket. This is
> good: sin(x), this is bad: sin (x).

Oops, missed this.. Fixed.

> > +                /* we ignore <interactive>, not used, equivalent to X-Interactive */
> > +                if (parsed && !startswith_no_case (parsed[0], "<interactive>")) {
> > +                        char *facility;
> > +                        Unit *u;
> > +                        if (sysv_translate_facility(parsed[0], NULL, &facility) < 0)
> > +                                continue;
> > +                        if ((u = manager_get_unit (mgr, facility)) && (u->meta.type == UNIT_TARGET)) {
> > +                                UnitDependency e;
> > +                                char *dep = NULL, *name;
> > +                                int j;
> > +
> > +                                for (j=1;parsed[j]; j++) {
> 
> Please use STRV_FOREACH for iterating through string arrays.

Forgot about it.. Fixed.

Here is new version attached

-- 
Frederic Crozat <fcrozat at suse.com>
SUSE


More information about the systemd-devel mailing list