Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: rdkehn at yahoo.com <rdkehn@yahoo.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 1/1 v3] package/unscd: new package
Date: Mon, 12 Oct 2015 09:35:42 -0500	[thread overview]
Message-ID: <20151012143542.GA21707@dkarchlinux64.gateway.pace.com> (raw)
In-Reply-To: <CAGduivzbZ7254DV3ya++mSQ1wj1QT93xViq7urj2WP2SS7z9Tw@mail.gmail.com>

Hi Maxime, All,

On Mon, Oct 12, 2015 at 10:34:09AM +0200, Maxime Hadjinlian wrote:
> Hello Doug, Yann, all
> 
> On Sat, Oct 10, 2015 at 4:50 PM, Yann E. MORIN <yann.morin.1998@free.fr>
> wrote:
> 
> > Doug, All,
> >
> > [CCing Maxime, as he knows systemd better than I do]
> >
> > On 2015-10-09 09:10 -0500, Doug Kehn spake thusly:
> > > A daemon which handles passwd, group and host lookups for running
> > programs and
> > > caches the results for the next query. You only need this package if you
> > are
> > > using slow Name Services like LDAP, NIS or NIS+.
> > >
> > > This particular NSCD is a complete rewrite of the GNU glibc nscd which
> > is a
> > > single threaded server process which offloads all NSS lookups to worker
> > > children; cache hits are handled by the parent, and only cache misses
> > start
> > > worker children, making the parent immune to resource leaks, hangs, and
> > crashes
> > > in NSS libraries.
> > >
> > > It should mostly be a drop-in replacement for existing installs using
> > nscd.
> > >
> > > Cc: Yann E. MORIN <yann.morin.1998@free.fr>
> > > Signed-off-by: Doug Kehn <rdkehn@yahoo.com>
> > [--SNIP--]
> > > diff --git a/package/unscd/S46unscd b/package/unscd/S46unscd
> > > new file mode 100644
> > > index 0000000..387ab32
> > > --- /dev/null
> > > +++ b/package/unscd/S46unscd
> > > @@ -0,0 +1,24 @@
> > > +#!/bin/sh
> > > +
> > > +NAME="nscd"
> > > +DAEMON="/usr/sbin/${NAME}"
> > > +
> > > +case "$1" in
> > > +start)
> > > +        echo -n "Starting ${NAME}: "
> >
> > We have recently readicated use of 'echo -n' and all other non-POSIX use
> > of echo. Please, use printf instead.
> >
> > [--SNIP--]
> > > diff --git a/package/unscd/unscd.mk b/package/unscd/unscd.mk
> > > new file mode 100644
> > > index 0000000..e8cccd3
> > > --- /dev/null
> > > +++ b/package/unscd/unscd.mk
> > > @@ -0,0 +1,55 @@
> > >
> > +################################################################################
> > > +#
> > > +# unscd
> > > +#
> > >
> > +################################################################################
> > > +
> > > +UNSCD_VERSION = 0.51
> > > +UNSCD_SOURCE = unscd_$(UNSCD_VERSION).orig.tar.gz
> > > +UNSCD_SITE =
> > http://snapshot.debian.org/archive/debian/20150519T094547Z/pool/main/u/unscd
> > > +UNSCD_EXTRA_DOWNLOADS = unscd_$(UNSCD_VERSION)-1.debian.tar.gz
> > > +UNSCD_LICENSE = GPLv2
> > > +UNSCD_LICENSE_FILES = debian/copyright
> > > +
> > > +define UNSCD_EXTRACT_DEBIAN
> > > +     gzip -d -c $(BR2_DL_DIR)/$(UNSCD_EXTRA_DOWNLOADS) | tar -C $(@D)
> > -xf -
> >
> > Please use suitable-extractor, like so:
> >
> >     $(call suitable-extractor,$(UNSCD_EXTRA_DOWNLOADS))
> > $(DL_DIR)/$(UNSCD_EXTRA_DOWNLOADS) \
> >     |$(TAR) xf -C $(@D) -
> >
> > > +endef
> > > +
> > > +UNSCD_POST_EXTRACT_HOOKS += UNSCD_EXTRACT_DEBIAN
> > > +
> > > +define UNSCD_APPLY_DEBIAN_PATCHES
> > > +     for f in `grep -Ev "^#" $(@D)/debian/patches/series 2> /dev/null`;
> > do \
> > > +             cat "$(@D)/debian/patches/$${f}" | patch -g0 -p1 -E -d
> > "$(@D)" -t -N; \
> >
> > Please use apply-patches, like so:
> >
> >     $(APPLY_PATCHES) $(@D) $(@D)/debian
> >
> > > +     done
> > > +endef
> > > +
> > > +UNSCD_POST_PATCH_HOOKS += UNSCD_APPLY_DEBIAN_PATCHES
> > > +
> > > +define UNSCD_BUILD_CMDS
> > > +     $(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_LDFLAGS) \
> > > +             $(@D)/nscd.c -o $(@D)/nscd
> > > +endef
> > > +
> > > +define UNSCD_INSTALL_TARGET_CMDS
> > > +     $(INSTALL) -m 755 -D $(@D)/nscd $(TARGET_DIR)/usr/sbin/nscd
> > > +     $(INSTALL) -m 600 -D $(@D)/debian/nscd.conf
> > $(TARGET_DIR)/etc/nscd.conf
> > > +endef
> > > +
> > > +define UNSCD_INSTALL_INIT_SYSTEMD
> > > +     $(INSTALL) -m 755 -D package/unscd/unscd.service \
> > > +             $(TARGET_DIR)/usr/lib/systemd/system/unscd.service
> > > +     mkdir -p $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants
> >
> > Not that it matters a lot, but I think using $(INSTALL) to create
> > directories should be favoured, like so:
> >
> >     $(INSTALL) -d $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants
> >
> At the moment, I think all the packages that install systemd are using
> mkdir -p, so I would keep that so it's coherent, as said in another mail, a
> helper is needed to simplify theses few lines.
> 
> >
> > > +     ln -fs ../../../../usr/lib/systemd/system/unscd.service \
> > > +
> >  $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/unscd.service
> > > +endef
> > [--SNIP--]
> > > diff --git a/package/unscd/unscd.service b/package/unscd/unscd.service
> > > new file mode 100644
> > > index 0000000..58dd7eb
> > > --- /dev/null
> > > +++ b/package/unscd/unscd.service
> > > @@ -0,0 +1,11 @@
> > > +[Unit]
> > > +Description=Micro Name Service Caching Daemon.
> > > +After=syslog.target network.target
> > > +
> > > +[Service]
> > > +Type=forking
> > > +PIDFile=/var/run/nscd/nscd.pid
> > > +ExecStart=/usr/sbin/nscd
> > > +
> > > +[Install]
> > > +WantedBy=multi-user.target
> >
> > Maxime, what's your opinion on this systemd unit?
> >
> nscd is a part of glibc, and looking at the code of glibc 2.22, the startup
> script and systemd init file are included in the source. So I have a few
> questions:
> 
> Why is this not a part of the glibc package as an option ?

... good point.

I see glibc nscd (I'm using glibc 2.21) is built but not installed.
Is the suggestion to add a nscd configuration option to glibc for
native nscd or unscd?

If unscd is selected, only glibc nscd support files will be
installed.

> 
> And I think, we should use the service and init scripts given by upstream,
> unless they cause real trouble with a BR rootfs. And since we handle many
> versions of glibc, maybe extract them from the latests versions and simply
> install them.

I will test the glibc init script with unscd to see if there are any
issues.

Would using the 'selected' glibc version, versus latest version, of
the support files be okay here?

> For the systemd part, there's much more than the initial service it seems,
> from the source I found:
> 
> nscd.service and nscd.tmpfiles which will create the /run/nscd directory
> with the correct ACL, which doesn't seem to be done by your init script but
> it's done by the shipped init script

I will see what I can do with respect to systemd support.

Regards,
...doug

  reply	other threads:[~2015-10-12 14:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-09 14:10 [Buildroot] [PATCH 1/1 v3] package/unscd: new package Doug Kehn
2015-10-10 14:50 ` Yann E. MORIN
2015-10-12  8:34   ` Maxime Hadjinlian
2015-10-12 14:35     ` rdkehn at yahoo.com [this message]
2015-10-12 16:42       ` Yann E. MORIN
2015-10-12 16:34     ` Yann E. MORIN
2015-10-12 16:43       ` Yann E. MORIN
2015-10-13  7:38       ` Maxime Hadjinlian

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151012143542.GA21707@dkarchlinux64.gateway.pace.com \
    --to=rdkehn@yahoo.com \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox