Merge pull request #94 from kergoth/glibc-external-nscd-fixup

glibc-external: include nscd startup scripts & .conf
This commit is contained in:
Christopher Larson
2015-09-08 12:09:43 -07:00
4 changed files with 230 additions and 1 deletions

View File

@@ -1,4 +1,10 @@
SRC_URI = "file://SUPPORTED"
SRC_URI = "\
file://SUPPORTED \
file://nscd.init;subdir=${REL_S}/nscd \
file://nscd.conf;subdir=${REL_S}/nscd \
file://nscd.service;subdir=${REL_S}/nscd \
"
REL_S = "${@os.path.relpath('${S}', '${WORKDIR}')}"
require recipes-core/glibc/glibc-common.inc
inherit external-toolchain

View File

@@ -0,0 +1,88 @@
#
# /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 <user who is allowed to request statistics>
# reload-count unlimited|<number>
# paranoia <yes|no>
# restart-interval <time in seconds>
#
# 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> <yes|no>
# shared <service> <yes|no>
# max-db-size <service> <number bytes>
# auto-propagate <service> <yes|no>
#
# Currently supported cache names (services): passwd, group, hosts, services
#
# logfile /var/log/nscd.log
# threads 4
# max-threads 32
# server-user nobody
# stat-user somebody
debug-level 0
# reload-count 5
paranoia no
# restart-interval 3600
enable-cache passwd yes
positive-time-to-live passwd 600
negative-time-to-live passwd 20
suggested-size passwd 211
check-files passwd yes
persistent passwd yes
shared passwd yes
max-db-size passwd 33554432
auto-propagate passwd yes
enable-cache group yes
positive-time-to-live group 3600
negative-time-to-live group 60
suggested-size group 211
check-files group yes
persistent group yes
shared group yes
max-db-size group 33554432
auto-propagate group yes
enable-cache hosts yes
positive-time-to-live hosts 3600
negative-time-to-live hosts 20
suggested-size hosts 211
check-files hosts yes
persistent hosts yes
shared hosts yes
max-db-size hosts 33554432
enable-cache services yes
positive-time-to-live services 28800
negative-time-to-live services 20
suggested-size services 211
check-files services yes
persistent services yes
shared services yes
max-db-size services 33554432
enable-cache netgroup yes
positive-time-to-live netgroup 28800
negative-time-to-live netgroup 20
suggested-size netgroup 211
check-files netgroup yes
persistent netgroup yes
shared netgroup yes
max-db-size netgroup 33554432

View File

@@ -0,0 +1,116 @@
#!/bin/bash
#
# nscd: Starts the Name Switch Cache Daemon
#
# chkconfig: - 30 74
# description: This is a daemon which handles passwd and group lookups \
# for running programs and cache the results for the next \
# query. You should start this daemon if you use \
# slow naming services like NIS, NIS+, LDAP, or hesiod.
# processname: /usr/sbin/nscd
# config: /etc/nscd.conf
#
### BEGIN INIT INFO
# Provides: nscd
# Required-Start: $syslog
# Default-Stop: 0 1 6
# Short-Description: Starts the Name Switch Cache Daemon
# Description: This is a daemon which handles passwd and group lookups \
# for running programs and cache the results for the next \
# query. You should start this daemon if you use \
# slow naming services like NIS, NIS+, LDAP, or hesiod.
### END INIT INFO
# Sanity checks.
[ -f /etc/nscd.conf ] || exit 0
[ -x /usr/sbin/nscd ] || exit 0
# Source function library.
. /etc/init.d/functions
# nscd does not run on any kernel lower than 2.2.0 because of threading
# problems, so we require that in first place.
case $(uname -r) in
2.[2-9].*)
# this is okay
;;
[3-9]*)
# these are of course also okay
;;
*)
#this is not
exit 1
;;
esac
RETVAL=0
prog=nscd
start () {
[ -d /var/run/nscd ] || mkdir /var/run/nscd
[ -d /var/db/nscd ] || mkdir /var/db/nscd
echo -n $"Starting $prog: "
daemon /usr/sbin/nscd
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/nscd
return $RETVAL
}
stop () {
echo -n $"Stopping $prog: "
/usr/sbin/nscd -K
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
rm -f /var/lock/subsys/nscd
# nscd won't be able to remove these if it is running as
# a non-privileged user
rm -f /var/run/nscd/nscd.pid
rm -f /var/run/nscd/socket
success $"$prog shutdown"
else
failure $"$prog shutdown"
fi
echo
return $RETVAL
}
restart() {
stop
start
}
# See how we were called.
case "$1" in
start)
start
RETVAL=$?
;;
stop)
stop
RETVAL=$?
;;
status)
status nscd
RETVAL=$?
;;
restart)
restart
RETVAL=$?
;;
try-restart | condrestart)
[ -e /var/lock/subsys/nscd ] && restart
RETVAL=$?
;;
force-reload | reload)
echo -n $"Reloading $prog: "
killproc /usr/sbin/nscd -HUP
RETVAL=$?
echo
;;
*)
echo $"Usage: $0 {start|stop|status|restart|reload|condrestart}"
RETVAL=1
;;
esac
exit $RETVAL

View File

@@ -0,0 +1,19 @@
# systemd service file for nscd
[Unit]
Description=Name Service Cache Daemon
[Service]
Type=forking
ExecStart=/usr/sbin/nscd
ExecStop=/usr/sbin/nscd --shutdown
ExecReload=/usr/sbin/nscd -i passwd
ExecReload=/usr/sbin/nscd -i group
ExecReload=/usr/sbin/nscd -i hosts
ExecReload=/usr/sbin/nscd -i services
ExecReload=/usr/sbin/nscd -i netgroup
Restart=always
PIDFile=/run/nscd/nscd.pid
[Install]
WantedBy=multi-user.target