]> git.donarmstrong.com Git - unscd.git/commitdiff
Update upstream source from tag 'upstream/0.53'
authorDon Armstrong <don@donarmstrong.com>
Sat, 28 Apr 2018 00:20:34 +0000 (17:20 -0700)
committerDon Armstrong <don@donarmstrong.com>
Sat, 28 Apr 2018 00:20:34 +0000 (17:20 -0700)
Update to upstream version '0.53'
with Debian dir 8fbc6a5ea8ef29d75303089c0f8f71482f70f8fa

20 files changed:
debian/NEWS [new file with mode: 0644]
debian/changelog [new file with mode: 0644]
debian/compat [new file with mode: 0644]
debian/control [new file with mode: 0644]
debian/copyright [new file with mode: 0644]
debian/help2man [new file with mode: 0644]
debian/manpages [new file with mode: 0644]
debian/nscd.8 [new file with mode: 0644]
debian/nscd.conf [new file with mode: 0644]
debian/patches/change_invalidate_request_info_output [new file with mode: 0644]
debian/patches/no_debug_on_invalidate [new file with mode: 0644]
debian/patches/series [new file with mode: 0644]
debian/patches/support_large_numbers_in_config [new file with mode: 0644]
debian/repack [new file with mode: 0644]
debian/rules [new file with mode: 0755]
debian/source/format [new file with mode: 0644]
debian/unscd.init [new file with mode: 0644]
debian/unscd.postinst [new file with mode: 0644]
debian/unscd.service [new file with mode: 0644]
debian/watch [new file with mode: 0644]

diff --git a/debian/NEWS b/debian/NEWS
new file mode 100644 (file)
index 0000000..90268cf
--- /dev/null
@@ -0,0 +1,9 @@
+unscd (0.47-2) unstable; urgency=low
+
+  * NB: Because insserv is slightly broken (#606593), we cannot provide
+    nscd, as this would break installs which hadn't already purged nscd.
+    However, if you have init scripts which depend on nscd, feel free to
+    change Provides: unscd to Provides: unscd nscd after purging nscd.
+
+ -- Don Armstrong <don@debian.org>  Sun, 12 Dec 2010 20:30:10 -0800
+
diff --git a/debian/changelog b/debian/changelog
new file mode 100644 (file)
index 0000000..bf21cec
--- /dev/null
@@ -0,0 +1,74 @@
+unscd (0.52-2) unstable; urgency=medium
+
+  * Update standards version to 4.1.1, no changes.
+  * Add missing #!/bin/sh to postinst (Closes: #843283)
+  * Use compat level 10
+  * Do not stop on upgrade, just restart after upgrade
+  * Do not always print debugging info upon invalidate. (Closes: #844447)
+
+ -- Don Armstrong <don@debian.org>  Thu, 26 Oct 2017 15:52:19 -0700
+
+unscd (0.52-1) unstable; urgency=medium
+
+  * New upstream release (Closes: #795618)
+
+  [ Thanks to Chris Kuehl <ckuehl@ocf.berkeley.edu> ]
+  * Add manpage for unscd and nscd (Closes: #789871)
+  * Add systemd unit file (Closes: #795621)
+
+ -- Don Armstrong <don@debian.org>  Thu, 03 Dec 2015 10:40:56 -0800
+
+unscd (0.51-1) unstable; urgency=low
+
+  * New upstream release
+  * Silence the cache invalidation output (Closes: #622230)
+  * Update to debhelper 9
+  * Support at least INT_MAX numbers in config (Closes: #676689)
+  * Use saner settings in nscd.conf; thanks to Harald Dunkel (Closes:
+    #702211).
+  * Run unscd as the unscd user instead of root by default
+
+ -- Don Armstrong <don@debian.org>  Mon, 21 Oct 2013 17:02:22 -0700
+
+unscd (0.49-1) unstable; urgency=low
+
+  * New upstream release
+
+ -- Don Armstrong <don@debian.org>  Tue, 07 May 2013 11:54:45 -0700
+
+unscd (0.48-2) unstable; urgency=low
+
+  * Actually distribute the nscd binary and configuration file (Closes:
+    #657721) and locate a brown paper bag.
+
+ -- Don Armstrong <don@debian.org>  Sat, 28 Jan 2012 09:27:24 -0800
+
+unscd (0.48-1) unstable; urgency=low
+
+  * New upstream release
+  * Fix typo in nscd.conf (Closes: #656615)
+  * Add newline to nscd.conf (Closes: #656603)
+  * Switch to dh7 style rules file
+  * Update standards version; no changes
+
+ -- Don Armstrong <don@debian.org>  Sat, 21 Jan 2012 13:36:59 -0800
+
+unscd (0.47-3) unstable; urgency=low
+
+  * Only indicate that the cache is being invalidated when in debug mode
+    (Closes: #622230)
+
+ -- Don Armstrong <don@debian.org>  Mon, 30 May 2011 08:56:33 -0700
+
+unscd (0.47-2) unstable; urgency=low
+
+  * Remove the Provides: nscd as a workaround for (Closes: #606588) to
+    avoid issues due to #606593 in insserv.
+
+ -- Don Armstrong <don@debian.org>  Sun, 12 Dec 2010 20:32:11 -0800
+
+unscd (0.47-1) unstable; urgency=low
+
+  * Initial packaging for Debian (Closes: #513305)
+
+ -- Don Armstrong <don@debian.org>  Tue, 19 Oct 2010 22:21:13 -0700
diff --git a/debian/compat b/debian/compat
new file mode 100644 (file)
index 0000000..f599e28
--- /dev/null
@@ -0,0 +1 @@
+10
diff --git a/debian/control b/debian/control
new file mode 100644 (file)
index 0000000..3a6f5d2
--- /dev/null
@@ -0,0 +1,31 @@
+Source: unscd
+Section: admin
+Priority: optional
+Standards-Version: 4.1.1
+Build-Depends: debhelper (>= 10), groff-base, help2man, dh-systemd
+Maintainer: Don Armstrong <don@debian.org>
+Vcs-Browser: https://git.donarmstrong.com/unscd.git
+Vcs-Git: https://git.donarmstrong.com/unscd.git
+
+
+Package: unscd
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}, lsb-base
+Conflicts: nscd
+Replaces: nscd
+Provides: nscd
+Homepage: http://busybox.net/~vda/unscd/
+Description: Micro Name Service Caching Daemon
+ 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.
diff --git a/debian/copyright b/debian/copyright
new file mode 100644 (file)
index 0000000..a7615c7
--- /dev/null
@@ -0,0 +1,8 @@
+Authors: Denys Vlasenko <vda.linux@googlemail.com>
+Webpage: http://busybox.net/~vda/unscd/
+Download: http://busybox.net/~vda/unscd/
+Debianized: Don Armstrong <don@debian.org> Tuesday, January 27, 2009 16:58:55 PST
+
+Copyright: Copyright (C) 2007 Denys Vlasenko. Licensed under the GPL version 2. 
+
+License: GPL version 2, available at /usr/share/common-licenses/GPL-2
diff --git a/debian/help2man b/debian/help2man
new file mode 100644 (file)
index 0000000..c5208a0
--- /dev/null
@@ -0,0 +1,3 @@
+[authors]
+.B unscd
+was written primarily by Denys Vlasenko.
\ No newline at end of file
diff --git a/debian/manpages b/debian/manpages
new file mode 100644 (file)
index 0000000..1cc6819
--- /dev/null
@@ -0,0 +1,2 @@
+debian/unscd.man
+debian/nscd.man
diff --git a/debian/nscd.8 b/debian/nscd.8
new file mode 100644 (file)
index 0000000..dd91f04
--- /dev/null
@@ -0,0 +1,31 @@
+.TH NSCD "8" "October 2010" "unscd - nscd which does not hang" "User Commands"
+.SH NAME
+unscd \- nscd which does not hang
+.SH SYNOPSIS
+.B nscd
+[\fIOPTION\fR...]
+.SH DESCRIPTION
+Name Service Cache Daemon
+.TP
+\fB\-d\fR,\-\-debug
+Do not daemonize; log to stderr
+.HP
+\fB\-f\fR,\-\-config\-file File to read configuration from
+.TP
+\fB\-i\fR,\-\-invalidate
+Invalidate cache
+.TP
+\fB\-K\fR,\-\-shutdown
+Shut the server down
+.TP
+\fB\-t\fR,\-\-nthreads
+Serve N requests in parallel
+.TP
+\fB\-V\fR,\-\-version
+Version
+.SH FILES
+.B /etc/nscd.conf
+.SH AUTHOR
+unscd is written by Denys Vlasenko and is licensed under the GPL version 2.
+.TP
+This manpage was written by Don Armstrong <don@debian.org> with help from help2man and is licensed under the same terms as unscd.
diff --git a/debian/nscd.conf b/debian/nscd.conf
new file mode 100644 (file)
index 0000000..fe77d05
--- /dev/null
@@ -0,0 +1,65 @@
+# This file is currently taken verbatim from the version distributed
+# with GNU glibc's nscd with unused configurations removed
+# 
+# /etc/nscd.conf
+#
+# An example Name Service Cache config file.  This file is needed by nscd.
+#
+# Legal entries are:
+#
+#      logfile                 <file>
+#      debug-level             <level>
+#      threads                 <initial #threads to use>
+#      max-threads             <maximum #threads to use>
+#      server-user             <user to run server as instead of root>
+#              server-user is ignored if nscd is started with -S parameters
+#       stat-user               (ignored; any user can stat)
+#      reload-count            (ignored; unscd should never crash)
+#      paranoia                (ignored)
+#      restart-interval        (ignored; unscd should never crash)
+#
+#       enable-cache           <service> <yes|no>
+#      positive-time-to-live   <service> <time in seconds>
+#      negative-time-to-live   <service> <time in seconds>
+#       suggested-size         <service> <prime number>
+#      check-files             <service> <yes|no>
+#      persistent              <service> (ignored)
+#      shared                  <service> (ignored)
+#      auto-propagate          <service> (ignored)
+#
+# Currently supported cache names (services): passwd, group, hosts
+
+
+
+# logfile /var/log/nscd.log
+# threads 14
+# max-threads 32
+server-user unscd
+debug-level 0
+
+enable-cache            passwd  yes
+positive-time-to-live   passwd  600
+negative-time-to-live   passwd  20
+suggested-size          passwd  1001
+check-files             passwd  yes
+
+enable-cache            group   yes
+positive-time-to-live   group   3600
+negative-time-to-live   group   60
+suggested-size          group   1001
+check-files             group   yes
+
+# hosts caching is broken with gethostby* calls, hence is now disabled
+# by default. Specifically, the caching does not obey DNS TTLs, and
+# thus could lead to problems if the positive-time-to-live is
+# significantly larger than the actual TTL.
+#
+# You should really use a caching nameserver instead of nscd for this
+# sort of request. However, you can easily re-enable this by default.
+enable-cache            hosts   no
+positive-time-to-live   hosts   3600
+negative-time-to-live   hosts   20
+suggested-size         hosts   1001
+check-files             hosts   yes
+
+# unscd does not support services caching
diff --git a/debian/patches/change_invalidate_request_info_output b/debian/patches/change_invalidate_request_info_output
new file mode 100644 (file)
index 0000000..01b0396
--- /dev/null
@@ -0,0 +1,26 @@
+From: Don Armstrong <don@debian.org>
+Subject: Silence cache invalidation requests unless in debug mode
+Origin: debian
+Bug-Debian: http://bugs.debian.org/622230
+--- a/nscd.c
++++ b/nscd.c
+@@ -2437,7 +2437,7 @@
+       if (!arg) { /* shutdown */
+               xfull_write(sock, &ureq, sizeof(ureq));
+-              printf("sent shutdown request, exiting\n");
++              fprintf(stderr,"sent shutdown request, exiting\n");
+       } else { /* invalidate */
+               size_t arg_len = strlen(arg) + 1;
+               struct {
+@@ -2449,7 +2449,9 @@
+               reqdata.req.key_len = arg_len;
+               memcpy(reqdata.arg, arg, arg_len);
+               xfull_write(sock, &reqdata, arg_len + sizeof(ureq));
+-              printf("sent invalidate(%s) request, exiting\n", arg);
++        if (debug) {
++          fprintf(stderr,"sent invalidate(%s) request, exiting\n", arg);
++        }
+       }
+       exit(0);
+ }
diff --git a/debian/patches/no_debug_on_invalidate b/debian/patches/no_debug_on_invalidate
new file mode 100644 (file)
index 0000000..e386c87
--- /dev/null
@@ -0,0 +1,12 @@
+--- a/nscd.c
++++ b/nscd.c
+@@ -2518,6 +2518,9 @@
+                       conffile = optarg;
+                       break;
+               case 'i':
++                      debug &= ~D_DAEMON;
++            if (opt_d_cnt != 0)
++                debug |= (((1U << opt_d_cnt+1) >> 1) - 1) & L_ALL;
+                       /* invalidate */
+                       special_op(optarg); /* exits */
+               case 'K':
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644 (file)
index 0000000..9689a28
--- /dev/null
@@ -0,0 +1,3 @@
+change_invalidate_request_info_output
+support_large_numbers_in_config
+no_debug_on_invalidate
diff --git a/debian/patches/support_large_numbers_in_config b/debian/patches/support_large_numbers_in_config
new file mode 100644 (file)
index 0000000..fbc7813
--- /dev/null
@@ -0,0 +1,86 @@
+From: Don Armstrong <don@debian.org>
+Subject: Support at least INT_MAX numbers in config
+Origin: debian
+Bug-Debian: http://bugs.debian.org/676689
+--- a/nscd.c
++++ b/nscd.c
+@@ -439,7 +439,8 @@
+               char *p;
+               unsigned long l = strtoul(str, &p, 10);
+               /* must not overflow int even after x1000 */
+-              if (!*p && l <= INT_MAX / 1000)
++        /* This is not required with the changes to have a unsigned long ttl */
++              if (!*p && l <= INT_MAX)
+                       return l;
+       }
+       error_and_die("malformed or too big number '%s'", str);
+@@ -511,8 +512,8 @@
+       const char *user;
+       smallint srv_enable[3];
+       smallint check_files[3];
+-      unsigned pttl[3];
+-      unsigned nttl[3];
++      unsigned long pttl[3];
++      unsigned long nttl[3];
+       unsigned size[3];
+ } config = {
+       /* We try to closely mimic glibc nscd */
+@@ -747,11 +748,11 @@
+       return sizeof(user_req_header) + ureq->key_len;
+ }
+-static unsigned cache_age(const user_req *ureq)
++static unsigned long cache_age(const user_req *ureq)
+ {
+       if (!CACHED_ENTRY(ureq))
+               return 0;
+-      return (uint32_t) (g_now_ms - (ureq->timestamp24 << 8));
++      return (unsigned long) (g_now_ms - (ureq->timestamp24 << 8));
+ }
+ static void set_cache_timestamp(user_req *ureq)
+@@ -1276,9 +1277,9 @@
+       }
+       unsigned oldest_idx = 0;
+-      unsigned oldest_age = 0;
++      unsigned long oldest_age = 0;
+       for (i = 0; i < 8; i++) {
+-              unsigned age = cache_age(cacheline[i]);
++              unsigned long age = cache_age(cacheline[i]);
+               if (age > oldest_age) {
+                       oldest_age = age;
+                       oldest_idx = i;
+@@ -1295,7 +1296,7 @@
+               return NULL;
+       }
+       i = oldest_idx;
+-      log(L_DEBUG, "not found, freeing and reusing cache[%u][%u] (age %u)", hash, i, oldest_age);
++      log(L_DEBUG, "not found, freeing and reusing cache[%u][%u] (age %ul)", hash, i, oldest_age);
+       free_refcounted_ureq(&cacheline[i]);
+  ret:
+@@ -1322,11 +1323,11 @@
+                                       cached_cnt--;
+                                       free_refcounted_ureq(cp);
+                               } else {
+-                                      unsigned age = cache_age(cached);
++                                      unsigned long age = cache_age(cached);
+                                       response_header *resp = ureq_response(cached);
+-                                      unsigned ttl = (resp->found ? config.pttl : config.nttl)[csrv];
++                                      unsigned long ttl = (resp->found ? config.pttl : config.nttl)[csrv];
+                                       if (age >= ttl) {
+-                                              log(L_DEBUG2, "freeing: age %u positive %d ttl %u", age, resp->found, ttl);
++                                              log(L_DEBUG2, "freeing: age %ul positive %d ttl %ul", age, resp->found, ttl);
+                                               cached_cnt--;
+                                               free_refcounted_ureq(cp);
+                                       } else if (srv == -1) {
+@@ -2646,7 +2647,7 @@
+       }
+       for (n = 0; n < 3; n++) {
+-              log(L_DEBUG, "%s cache enabled:%u pttl:%u nttl:%u",
++              log(L_DEBUG, "%s cache enabled:%u pttl:%ul nttl:%ul",
+                               srv_name[n],
+                               config.srv_enable[n],
+                               config.pttl[n],
diff --git a/debian/repack b/debian/repack
new file mode 100644 (file)
index 0000000..dbd6b6c
--- /dev/null
@@ -0,0 +1,85 @@
+#!/usr/bin/perl
+# repack repacks unscd upstream tarball
+# and is released under the terms of the GNU GPL version 3, or any
+# later version, at your option. See the file README and COPYING for
+# more information.
+# Copyright 2013 by Don Armstrong <don@donarmstrong.com>.
+
+
+use warnings;
+use strict;
+
+use Getopt::Long;
+use Pod::Usage;
+
+=head1 NAME
+
+repack - repacks unscd upstream tarball
+
+=head1 SYNOPSIS
+
+repack --upstream-version version filename
+
+ Options:
+
+=head1 OPTIONS
+
+=over
+
+=item B<--upstream-version>
+
+Upstream version
+
+=back
+
+=head1 EXAMPLES
+
+repack --upstream-version 0.48 nscd-0.48.c
+
+=cut
+
+use vars qw($DEBUG);
+
+use Cwd;
+use File::Temp qw(tempdir);
+use File::Copy qw(copy);
+
+my %options = (debug           => 0,
+               help            => 0,
+               man             => 0,
+              );
+
+GetOptions(\%options,
+           'upstream_version|upstream-version=s',
+          );
+
+$DEBUG = $options{debug};
+
+my @USAGE_ERRORS;
+if (not exists $options{upstream_version}) {
+     push @USAGE_ERRORS,"You must give the  --upstream-version option";
+}
+if (@ARGV!=1) {
+     push @USAGE_ERRORS,"You must give exactly one filename on the command line";
+}
+
+
+pod2usage(join("\n",@USAGE_ERRORS)) if @USAGE_ERRORS;
+
+
+my $tdir = tempdir(CLEANUP => 1);
+my $curdir = getcwd;
+
+my $orig_dir_name = 'unscd-'.$options{upstream_version};
+my $orig_dir_path = File::Spec->catfile($tdir,$orig_dir_name);
+mkdir($orig_dir_path) or die "Unable to mkdir $orig_dir_path: $!";
+copy($ARGV[0],File::Spec->catfile($orig_dir_path,'nscd.c')) or
+    die "Unable to copy $ARGV[0] to $orig_dir_path/nscd.c: $!";
+system('tar','-zcf',File::Spec->catfile($curdir,
+                                        File::Spec->updir(),
+                                        'unscd_'.$options{upstream_version}.'.orig.tar.gz'),
+       '-C',$tdir,$orig_dir_name) == 0 or
+    die "Tar failed";
+
+__END__
+
diff --git a/debian/rules b/debian/rules
new file mode 100755 (executable)
index 0000000..413cdd5
--- /dev/null
@@ -0,0 +1,25 @@
+#!/usr/bin/make -f
+
+%:
+       dh $@ --with systemd
+
+override_dh_auto_clean:
+       rm -f nscd
+       dh_auto_clean
+
+override_dh_auto_build:
+       gcc $(CFLAGS) $(LDFLAGS) -o nscd nscd.c
+       help2man --name 'nscd which does not hang' \
+               --include debian/help2man \
+               --no-info \
+               ./nscd > debian/unscd.man
+       ln -fs unscd.man debian/nscd.man
+
+override_dh_auto_install:
+       install -d debian/unscd/usr/sbin/
+       install -t debian/unscd/usr/sbin/ nscd
+       install -d debian/unscd/etc/
+       install -m644 -t debian/unscd/etc/ debian/nscd.conf
+
+override_dh_systemd_start:
+       dh_systemd_start --restart-after-upgrade --no-stop-on-upgrade
diff --git a/debian/source/format b/debian/source/format
new file mode 100644 (file)
index 0000000..163aaf8
--- /dev/null
@@ -0,0 +1 @@
+3.0 (quilt)
diff --git a/debian/unscd.init b/debian/unscd.init
new file mode 100644 (file)
index 0000000..3c14f6c
--- /dev/null
@@ -0,0 +1,135 @@
+#!/bin/sh
+### BEGIN INIT INFO
+# Provides:          unscd
+# Required-Start:    $remote_fs
+# Required-Stop:     $remote_fs
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: Starts the Micro Name Service Cache Daemon
+# Description:  This is a daemon which handles passwd and group lookups
+#              for running programs and caches the results for the next
+#              query.  You should start this daemon only if you use
+#              slow Services like NIS or NIS+
+### END INIT INFO
+
+# NB: Because insserv is slightly broken (#606593), we cannot provide
+# nscd, as this would break installs which hadn't already purged nscd.
+# However, if you have init scripts which depend on nscd, feel free to
+# change Provides: unscd to Provides: unscd nscd after purging nscd.
+
+#
+# unscd:       Starts the Micro Name Service Cache Daemon
+#
+# description:  This is a daemon which handles passwd and group lookups
+#              for running programs and caches the results for the next
+#              query.  You should start this daemon only if you use
+#              slow Services like NIS or NIS+
+
+# Sanity checks.
+
+NAME="unscd"
+DESC="Micro Name Service Cache Daemon"
+DAEMON="/usr/sbin/nscd"
+PIDFILE="/var/run/nscd/nscd.pid"
+
+# Sanity checks.
+umask 022
+[ -f /etc/nscd.conf ] || exit 0
+[ -x "$DAEMON" ] || exit 0
+[ -d /var/run/nscd ] || mkdir -p /var/run/nscd
+. /lib/lsb/init-functions
+
+start_unscd()
+{
+       # Return
+       #   0 if daemon has been started
+       #   1 if daemon was already running
+       #   2 if daemon could not be started
+       start-stop-daemon --start --quiet --pidfile "$PIDFILE" --exec "$DAEMON" --test > /dev/null || return 1
+       start-stop-daemon --start --quiet --pidfile "$PIDFILE" --exec "$DAEMON" || return 2
+}
+
+stop_unscd()
+{
+       # Return
+       #   0 if daemon has been stopped
+       #   1 if daemon was already stopped
+       #   2 if daemon could not be stopped
+
+       # we try to stop using unscd --shutdown, that fails also if unscd is not present.
+       # in that case, fallback to "good old methods"
+       RETVAL=0
+       if ! $DAEMON --shutdown; then
+               start-stop-daemon --stop --quiet --pidfile "$PIDFILE" --name "$NAME" --test > /dev/null
+               RETVAL="$?"
+               [ "$?" -ne 0  -a  "$?" -ne 1 ] && return 2
+       fi
+
+       # Wait for children to finish too
+       start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec "$DAEMON" > /dev/null
+       [ "$?" -ne 0  -a  "$?" -ne 1 ] && return 2
+       rm -f "$PIDFILE"
+       return "$RETVAL"
+}
+
+status()
+{
+       # Return
+       #   0 if daemon is stopped
+       #   1 if daemon is running
+       start-stop-daemon --start --quiet --pidfile "$PIDFILE" --exec "$DAEMON" --test > /dev/null || return 1
+       return 0
+}
+
+case "$1" in
+start)
+       log_daemon_msg "Starting $DESC" "$NAME"
+       start_unscd
+       case "$?" in
+               0) log_end_msg 0 ; exit 0 ;;
+               1) log_warning_msg " (already running)." ; exit 0 ;;
+               *) log_end_msg 1 ; exit 1 ;;
+       esac
+       ;;
+stop)
+       log_daemon_msg "Stopping $DESC" "$NAME"
+       stop_unscd
+       case "$?" in
+               0) log_end_msg 0 ; exit 0 ;;
+               1) log_warning_msg " (not running)." ; exit 0 ;;
+               *) log_end_msg 1 ; exit 1 ;;
+       esac
+       ;;
+restart|force-reload|reload)
+       log_daemon_msg "Restarting $DESC" "$NAME"
+       stop_unscd
+       $DAEMON --invalidate passwd --invalidate group --invalidate hosts
+       case "$?" in
+       0|1)
+               start_unscd
+               case "$?" in
+                       0) log_end_msg 0 ; exit 0 ;;
+                       1) log_failure_msg " (failed -- old process is still running)." ; exit 1 ;;
+                       *) log_failure_msg " (failed to start)." ; exit 1 ;;
+               esac
+               ;;
+       *)
+               log_failure_msg " (failed to stop)."
+               exit 1
+               ;;
+       esac
+       ;;
+status)
+       log_daemon_msg "Status of $DESC service: "
+       status
+       case "$?" in
+               0) log_failure_msg "not running." ; exit 1 ;;
+               1) log_success_msg "running." ; exit 0 ;;
+       esac
+       ;;
+*)
+       echo "Usage: /etc/init.d/$NAME {start|stop|reload|force-reload|restart|status}" >&2
+       exit 1
+       ;;
+esac
+
diff --git a/debian/unscd.postinst b/debian/unscd.postinst
new file mode 100644 (file)
index 0000000..27b83e2
--- /dev/null
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+set -e
+
+case "$1" in
+    configure)
+        # Create the unscd user
+           if which adduser >/dev/null 2>&1 &&
+               which getent >/dev/null 2>&1 &&
+               which id >/dev/null 2>&1 &&
+               which addgroup >/dev/null 2>&1; then
+               if ! getent group unscd >/dev/null 2>&1; then
+                       addgroup --system unscd;
+               fi;
+               if ! id -u unscd >/dev/null 2>&1; then
+                       adduser --quiet --system --ingroup unscd --no-create-home --home /var/lib/unscd unscd;
+               fi;
+           fi;
+           ;;
+    *)
+           # do nothing
+           ;;
+esac
+
+###DEBHELPER###
+
+exit 0;
diff --git a/debian/unscd.service b/debian/unscd.service
new file mode 100644 (file)
index 0000000..fc1f060
--- /dev/null
@@ -0,0 +1,10 @@
+[Unit]
+Description=Name Service Cache Daemon
+
+[Service]
+User=root
+ExecStart=/usr/sbin/nscd -d
+Restart=always
+
+[Install]
+WantedBy=multi-user.target
diff --git a/debian/watch b/debian/watch
new file mode 100644 (file)
index 0000000..cd2191a
--- /dev/null
@@ -0,0 +1,4 @@
+version=3
+http://busybox.net/~vda/unscd/nscd-([\d\.]+).c \
+  debian \
+  perl debian/repack
\ No newline at end of file