From patchwork Sat May 30 22:31:41 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Kehn X-Patchwork-Id: 478513 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from silver.osuosl.org (silver.osuosl.org [140.211.166.136]) by ozlabs.org (Postfix) with ESMTP id A31AB140F90 for ; Sun, 31 May 2015 08:32:17 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=yahoo.com header.i=@yahoo.com header.b=iFtLCx3n; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 9FC1632F2B; Sat, 30 May 2015 22:32:16 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hs5j5kASFqqK; Sat, 30 May 2015 22:32:13 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 05B9032EC7; Sat, 30 May 2015 22:32:13 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from hemlock.osuosl.org (hemlock.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id BE7F01BFC18 for ; Sat, 30 May 2015 22:32:12 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id BB1499592D for ; Sat, 30 May 2015 22:32:12 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id v1eNZZB1PwEi for ; Sat, 30 May 2015 22:32:12 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from nm18-vm4.bullet.mail.ne1.yahoo.com (nm18-vm4.bullet.mail.ne1.yahoo.com [98.138.91.178]) by hemlock.osuosl.org (Postfix) with ESMTPS id 08D1295932 for ; Sat, 30 May 2015 22:32:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1433025131; bh=s2H8llYIUA79KrumIsubHNnOCIfx6JXDoS8DfcLjGI4=; h=From:To:Cc:Subject:Date:From:Subject; b=iFtLCx3nsSw1G3zAQcpcWfC712lM3nK4ho/2FAAPF3Damnlsb4vDgFMUYPoRsOAIZyJRIqQZM6XrGXMb86fbnbPUZLYbV52KFWX9yFgda1qJx724aRkIXzDxnyGb84qntexg5LvUevGydFaRVt/ObS3lroGpQQGZhlR6tF5N4W9o1Fk5eKgnhBebTaCwfywg9fBs1AmQkWxz2sJQLG+b6jtbTZjmlwB1RRTeUyHrefc/rqkX8QwnuiM4f+PprrtMZQoOvgWj0DvtrBNowUxT1nalBgjxRMEOfgxK0BQyuQUcyhQ0wTCLWUHHIChrB1KHNa8yWgAK3yJHRAAb5II0/Q== Received: from [98.138.100.118] by nm18.bullet.mail.ne1.yahoo.com with NNFMP; 30 May 2015 22:32:11 -0000 Received: from [98.138.84.39] by tm109.bullet.mail.ne1.yahoo.com with NNFMP; 30 May 2015 22:32:11 -0000 Received: from [127.0.0.1] by smtp107.mail.ne1.yahoo.com with NNFMP; 30 May 2015 22:32:11 -0000 X-Yahoo-Newman-Id: 220034.35148.bm@smtp107.mail.ne1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: fHroXlAVM1nCCwbkv8bgXHJlFC2Xi4AGueZFv2kTje1nQ6z ju.gCkyivV1W1bbmLy_E0vMPmlcB0vx9KfoixjTr.yWc3i3yjm.Jg9Oddek. LR7ce3Of1pNSu9KvcF_seVJCh_BeS5CYK6lUR7ZPUIi7Dz.SLyGSiLErP1ev X35xm8seZOdFx28oya4cFtpI1NU.Tr0wgfsL.oFdhSDseh3mqdJ3OFL8qZb3 2ZylU7v6I7PXv_vyF_uVfmX7qQ67JkbzulcaXkvmPuU8TmO460kExNIo8Y.f GulN_djsX137rhldcYxdEpoUrLd_ZW3ze70hskY.puLLPFy4zC3bH.tq6eFX Rs5F_zMvsXNspTVtsj0W5vPNCebXvaolvyK6MrE84x9AnGITJJGHIM1k4hjw YR8vRicoEEzAp2THzpT46UsrNP9DNOwMzY_p6kii0nR7N9h2MvDUdDlWxgjC Tht4HNPWIDVKSfxCv10Bvcup35UKFgt4jyMN2wdk8NaBx4YlhfnDTQr1uVVY N8Nfsj6WgdPgH6kxCSP8HTqWj1sSjCw-- X-Yahoo-SMTP: tVp.douswBADms9I1_pvnFcs0w-- From: Doug Kehn To: buildroot@buildroot.org Date: Sat, 30 May 2015 17:31:41 -0500 Message-Id: <1433025101-7335-1-git-send-email-rdkehn@yahoo.com> X-Mailer: git-send-email 2.4.1 Cc: "Yann E. MORIN" Subject: [Buildroot] [PATCH 1/1 v2] package/unscd: new package X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" 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 Signed-off-by: Doug Kehn --- Changes v1 -> v2 - Incorporate feedback/suggestions by Yann (from nss-pam-ldapd patch). package/Config.in | 1 + package/unscd/Config.in | 8 +++++++ package/unscd/S46unscd | 25 +++++++++++++++++++++ package/unscd/unscd.hash | 4 ++++ package/unscd/unscd.mk | 55 +++++++++++++++++++++++++++++++++++++++++++++ package/unscd/unscd.service | 11 +++++++++ 6 files changed, 104 insertions(+) create mode 100644 package/unscd/Config.in create mode 100644 package/unscd/S46unscd create mode 100644 package/unscd/unscd.hash create mode 100644 package/unscd/unscd.mk create mode 100644 package/unscd/unscd.service diff --git a/package/Config.in b/package/Config.in index e0c2e2a..39ef6c4 100644 --- a/package/Config.in +++ b/package/Config.in @@ -1420,6 +1420,7 @@ endif if BR2_PACKAGE_BUSYBOX_SHOW_OTHERS source "package/sysvinit/Config.in" endif + source "package/unscd/Config.in" source "package/util-linux/Config.in" endmenu diff --git a/package/unscd/Config.in b/package/unscd/Config.in new file mode 100644 index 0000000..937aeb2 --- /dev/null +++ b/package/unscd/Config.in @@ -0,0 +1,8 @@ +config BR2_PACKAGE_UNSCD + bool "unscd" + depends on BR2_TOOLCHAIN_USES_GLIBC + help + Micro Name Service Caching Daemon + +comment "unscd needs an (e)glibc toolchain" + depends on !BR2_TOOLCHAIN_USES_GLIBC diff --git a/package/unscd/S46unscd b/package/unscd/S46unscd new file mode 100644 index 0000000..03691db --- /dev/null +++ b/package/unscd/S46unscd @@ -0,0 +1,25 @@ +#!/bin/sh + +NAME="nscd" +DAEMON="/usr/sbin/${NAME}" + +case "$1" in +start) + echo -n "Starting ${NAME}: " + start-stop-daemon -S -x ${DAEMON} + [ $? -eq 0 ] && echo "OK" || echo "FAIL" + ;; +stop) + echo -n "Stopping ${NAME}: " + start-stop-daemon -K -x ${DAEMON} + [ $? -eq 0 ] && echo "OK" || echo "FAIL" + ;; +restart|reload) + $0 stop + $0 start + ;; +*) + echo "Usage: $0 {start|stop|restart|reload}" + exit 1 +esac + diff --git a/package/unscd/unscd.hash b/package/unscd/unscd.hash new file mode 100644 index 0000000..173c59f --- /dev/null +++ b/package/unscd/unscd.hash @@ -0,0 +1,4 @@ +# From http://snapshot.debian.org/archive/debian/20150519T094547Z/pool/main/u/unscd/unscd_0.51-1.dsc +sha256 0dbf717726e1c29af8f4ef7d2d2695e5eedb342320a730a56ae0d56fe32891f8 unscd_0.51.orig.tar.gz +sha256 8ae16a826afd464639f6c6372fabafee5b93aea9645b3fbf23970296d4961f27 unscd_0.51-1.debian.tar.gz + diff --git a/package/unscd/unscd.mk b/package/unscd/unscd.mk new file mode 100644 index 0000000..4d4c8b9 --- /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 - +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; \ + 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 + ln -fs ../../../../usr/lib/systemd/system/unscd.service \ + $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/unscd.service +endef + +define UNSCD_INSTALL_INIT_SYSV + $(INSTALL) -m 755 -D package/unscd/S46unscd \ + $(TARGET_DIR)/etc/init.d/S46unscd +endef + +define UNSCD_USERS + unscd -1 unscd -1 * - - - unscd user +endef + +$(eval $(generic-package)) diff --git a/package/unscd/unscd.service b/package/unscd/unscd.service new file mode 100644 index 0000000..d82155c --- /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