add unscd to replace nscd removed from glibc

This commit is contained in:
joborun linux 2023-09-26 02:21:29 +03:00
parent 8f221ae261
commit 7737659a2b
9 changed files with 234 additions and 0 deletions

60
unscd/PKGBUILD Normal file
View file

@ -0,0 +1,60 @@
#!/usr/bin/bash
# JOBoRun : Jwm OpenBox Obarun RUNit
# Maintainer : Joe Bo Run <joborun@disroot.org>
# PkgSource : url="https://gittea.disroot.org/joborun-pkg/jobcomm/$pkgname"
# Website : https://pozol.eu
#-----------------------------------------| DESCRIPTION |---------------------------------------
pkgname=unscd
pkgver=0.54
pkgrel=02
pkgdesc='Drop-in replacement for glibc nscd which is designed for simplicity and stability - since Arch decided to leave it out of glibc'
url='http://busybox.net/~vda/unscd/'
source=("http://busybox.net/~vda/unscd/nscd-$pkgver.c"
'unscd.service'
'unscd.conf'
'unscd.8'
'glibc-nonscd.patch')
prepare() {
sed -i 's,/etc/nscd.conf,/etc/unscd.conf,g' "nscd-$pkgver.c"
sed -i 's,/var/run/,/run/,g' "nscd-$pkgver.c"
# The source incorporated a function to disable glibc nscd which no longer applies
# so we patched the function off till a proper check if nscd exist is added upstream
patch -Np1 -i "$srcdir/glibc-nonscd.patch"
}
build() {
gcc -fomit-frame-pointer -Wl,--sort-section -Wl,alignment -Wl,--sort-common \
-Os $CFLAGS $LDFLAGS -o $pkgname "nscd-$pkgver.c"
}
package() {
install -D -m 755 unscd -t "$pkgdir/usr/bin/"
install -D -m 644 unscd.conf -t "$pkgdir/etc/"
install -D -m 644 unscd.8 -t "$pkgdir/usr/share/man/man8/"
# we added the service file for reference so one can create a runit or s6 service file easier
install -D -m 644 unscd.service -t "$pkgdir/usr/share/docs/$pkgname/"
}
#---- arch license gpg-key & sha256sums ----
arch=(x86_64)
license=('GPL2')
md5sums=(ddff52893cfc48d0e61035e2596f70d2
f66fcf467518d51880bdf3b85511c53a
cfbab3d1c5b0fe362a218ad15ad2d6e3
9069ba3a3a07673ab1a7cc70018b387e
7c70efff03638b3d931a7d6e19c8bedc) # glibc-nonscd.patch
sha256sums=(90e12c71732474cac4d055bf9d104e599178b4e1ecb6d3b8c556eaa11f8f6447 # nscd-0.54.c
4bf40c386b26a27da03aff241cca3be08f8f031c96be69bed097de44cf445aba # unscd.service
1869ee6edc68157a2791da98fbf643dc2fae7411e6c9472f6a3ac5f1f8b50068 # unscd.conf
fd334f4a51ddd2266eedc9bdcdb2ff543d2790c12178034af5f9b76f1b2e7e65 # unscd.8
f574e94572ddd27c2ef4195d21d88a4428752d9ac9b82d06e6e87d2d567486fb) # glibc-nonscd.patch
## 1e8f9392440369a95ddad5c84296c874b52bd841e64d226853ffa1b92588549f unscd-0.54-02-x86_64.pkg.tar.lz

36
unscd/PKGBUILD-aur Normal file
View file

@ -0,0 +1,36 @@
# Maintainer: Spider.007 <aur@spider007.net>
# Contributor: asukaminato
# Submitter: Sébastien Luttringer <seblu@aur.archlinux.org>
pkgname=unscd
pkgver=0.54
pkgrel=1
pkgdesc='Drop-in replacement for glibc nscd which is designed for simplicity and stability'
arch=('i686' 'x86_64')
url='http://busybox.net/~vda/unscd/'
license=('GPL2')
source=("http://busybox.net/~vda/unscd/nscd-$pkgver.c"
'unscd.service' 'unscd.conf' 'unscd.8')
md5sums=('ddff52893cfc48d0e61035e2596f70d2'
'f66fcf467518d51880bdf3b85511c53a'
'cfbab3d1c5b0fe362a218ad15ad2d6e3'
'9069ba3a3a07673ab1a7cc70018b387e')
prepare() {
sed -i 's,/etc/nscd.conf,/etc/unscd.conf,g' "nscd-$pkgver.c"
sed -i 's,/var/run/,/run/,g' "nscd-$pkgver.c"
}
build() {
gcc -fomit-frame-pointer -Wl,--sort-section -Wl,alignment -Wl,--sort-common \
-Os $CFLAGS $LDFLAGS -o $pkgname "nscd-$pkgver.c"
}
package() {
install -D -m 755 unscd -t "$pkgdir/usr/bin/"
install -D -m 644 unscd.conf -t "$pkgdir/etc/"
install -D -m 644 unscd.8 -t "$pkgdir/usr/share/man/man8/"
install -D -m 644 unscd.service -t "$pkgdir/usr/lib/systemd/system/"
}
# vim:set ts=2 sw=2 ft=sh et:

1
unscd/clean Normal file
View file

@ -0,0 +1 @@
rm -rf {src,pkg,nscd*.c}

2
unscd/deps Normal file
View file

@ -0,0 +1,2 @@

11
unscd/glibc-nonscd.patch Normal file
View file

@ -0,0 +1,11 @@
--- src/nscd-0.54.c 2023-09-26 00:12:49.041415894 +0300
+++ src/nscd-0.54.c 2023-09-26 00:48:44.445594474 +0300
@@ -2486,7 +2486,7 @@
const char *conffile;
/* make sure we don't get recursive calls */
- __nss_disable_nscd(do_nothing);
+ /*__nss_disable_nscd(do_nothing); */
if (argv[0][0] == 'w') /* "worker_nscd" */
worker(argv[1]);

6
unscd/time Normal file
View file

@ -0,0 +1,6 @@
real 0m2.601s
user 0m2.203s
sys 0m0.571s

31
unscd/unscd.8 Normal file
View file

@ -0,0 +1,31 @@
.TH UNSCD "8" "October 2010" "unscd - nscd which does not hang" "User Commands"
.SH NAME
unscd \- nscd which does not hang
.SH SYNOPSIS
.B unscd
[\fIOPTION\fR...]
.SH DESCRIPTION
Micro 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/unscd.conf
.SH AUTHOR
unscd was written by Denys Vlasenko and is licensed under the GPL version 2.
.TP
This manpage was written by Don Armstrong <don@debian.org> and updated to Archlinux by Sebastien Luttringer <seblu+arch@seblu.net>

71
unscd/unscd.conf Normal file
View file

@ -0,0 +1,71 @@
# This file is currently taken verbatim from the version distributed
# with GNU glibc's nscd with unused configurations removed
#
# /etc/unscd.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)x
#
# 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/unscd.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
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
auto-propagate group yes
# hosts caching is broken with gethostby* calls, hence is now disabled per default.
enable-cache hosts no
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
# unscd does not support services caching

16
unscd/unscd.service Normal file
View file

@ -0,0 +1,16 @@
[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
Restart=always
PIDFile=/run/nscd/nscd.pid
[Install]
WantedBy=multi-user.target