restore nscd

This commit is contained in:
jiangheng 2022-05-12 22:07:50 +08:00
parent 6b68fd5bf5
commit ecb0d526a0
3 changed files with 124 additions and 5 deletions

38
glibc-1070416.patch Normal file
View File

@ -0,0 +1,38 @@
Short description: Add syslog.target dependency.
Author(s): Fedora glibc team <glibc@lists.fedoraproject.org>
Origin: PATCH
Bug-Fedora: #1070416
Upstream status: not-needed
Fedora-specific changes to the nscd.service file.
See also: glibc-nscd-sysconfig.patch.
--- a/nscd/nscd.service
+++ b/nscd/nscd.service
@@ -2,6 +2,7 @@
[Unit]
Description=Name Service Cache Daemon
+After=syslog.target
[Service]
Type=forking
@@ -17,3 +18,4 @@
[Install]
WantedBy=multi-user.target
+Also=nscd.socket
diff --git a/nscd/nscd.socket b/nscd/nscd.socket
new file mode 100644
index 0000000..7e512d5
--- /dev/null
+++ b/nscd/nscd.socket
@@ -0,0 +1,8 @@
+[Unit]
+Description=Name Service Cache Daemon Socket
+
+[Socket]
+ListenDatagram=/var/run/nscd/socket
+
+[Install]
+WantedBy=sockets.target

View File

@ -65,12 +65,13 @@
############################################################################## ##############################################################################
Name: glibc Name: glibc
Version: 2.35 Version: 2.35
Release: 8 Release: 9
Summary: The GNU libc libraries Summary: The GNU libc libraries
License: %{all_license} License: %{all_license}
URL: http://www.gnu.org/software/glibc/ URL: http://www.gnu.org/software/glibc/
Source0: https://ftp.gnu.org/gnu/glibc/%{name}-%{version}.tar.xz Source0: https://ftp.gnu.org/gnu/glibc/%{name}-%{version}.tar.xz
Source1: nscd.conf
Source2: nsswitch.conf Source2: nsswitch.conf
Source3: bench.mk Source3: bench.mk
Source4: glibc-bench-compare Source4: glibc-bench-compare
@ -82,6 +83,8 @@ Source7: replace_same_file_to_hard_link.py
Source8: testsuite_whitelist.%{_target_cpu} Source8: testsuite_whitelist.%{_target_cpu}
%endif %endif
Patch0: glibc-1070416.patch
#Patch9000: turn-default-value-of-x86_rep_stosb_threshold_form_2K_to_1M.patch #Patch9000: turn-default-value-of-x86_rep_stosb_threshold_form_2K_to_1M.patch
#Patch9001: delete-no-hard-link-to-avoid-all_language-package-to.patch #Patch9001: delete-no-hard-link-to-avoid-all_language-package-to.patch
#Patch9002: 0001-add-base-files-for-libphtread-condition-family.patch #Patch9002: 0001-add-base-files-for-libphtread-condition-family.patch
@ -96,7 +99,6 @@ Source8: testsuite_whitelist.%{_target_cpu}
Patch9011: use-region-to-instead-of-country-for-extract-timezon.patch Patch9011: use-region-to-instead-of-country-for-extract-timezon.patch
Patch9012: malloc-use-__get_nprocs-replace-__get_nprocs_sched.patch Patch9012: malloc-use-__get_nprocs-replace-__get_nprocs_sched.patch
Obsoletes: nscd < 2.35
Provides: ldconfig rtld(GNU_HASH) bundled(gnulib) Provides: ldconfig rtld(GNU_HASH) bundled(gnulib)
BuildRequires: audit-libs-devel >= 1.1.3, sed >= 3.95, libcap-devel, gettext BuildRequires: audit-libs-devel >= 1.1.3, sed >= 3.95, libcap-devel, gettext
@ -254,6 +256,24 @@ The glibc-devel package contains the object files necessary for developing
programs which use the standard C libraries. Besides, it contains the programs which use the standard C libraries. Besides, it contains the
headers. Thus, it is necessory to install glibc-devel if you ned develop programs. headers. Thus, it is necessory to install glibc-devel if you ned develop programs.
##############################################################################
# glibc "nscd" sub-package
##############################################################################
%package -n nscd
Summary: Name caching service daemon.
Requires: %{name} = %{version}-%{release}
%if %{without bootstrap}
Requires: libselinux >= 1.17.10-1
%endif
Requires: audit-libs >= 1.1.3
Requires(pre): shadow-utils, coreutils
Requires: systemd
Requires(postun): shadow-utils
%description -n nscd
The nscd package is able to daemon caches name service lookups and improve
the performance with LDAP.
############################################################################## ##############################################################################
# nss modules sub-package # nss modules sub-package
############################################################################## ##############################################################################
@ -440,8 +460,7 @@ pushd $builddir
%if 0%{rpm_version_ge_412} %if 0%{rpm_version_ge_412}
--disable-crypt \ --disable-crypt \
%endif %endif
--disable-build-nscd \ ||
--disable-nscd ||
{ cat config.log; false; } { cat config.log; false; }
make %{?_smp_mflags} -O -r %{glibc_make_flags} make %{?_smp_mflags} -O -r %{glibc_make_flags}
@ -533,11 +552,20 @@ install -p -m 644 %{SOURCE2} $RPM_BUILD_ROOT/etc/nsswitch.conf
install -p -m 755 build-%{target}/nptl/libpthread-2.17.so $RPM_BUILD_ROOT%{_libdir} install -p -m 755 build-%{target}/nptl/libpthread-2.17.so $RPM_BUILD_ROOT%{_libdir}
%endif %endif
# This is for ncsd - in glibc 2.2
install -m 644 nscd/nscd.conf $RPM_BUILD_ROOT/etc
mkdir -p $RPM_BUILD_ROOT%{_tmpfilesdir}
install -m 644 %{SOURCE1} %{buildroot}%{_tmpfilesdir}
mkdir -p $RPM_BUILD_ROOT/lib/systemd/system
install -m 644 nscd/nscd.service nscd/nscd.socket $RPM_BUILD_ROOT/lib/systemd/system
# Include ld.so.conf # Include ld.so.conf
echo 'include ld.so.conf.d/*.conf' > $RPM_BUILD_ROOT/etc/ld.so.conf echo 'include ld.so.conf.d/*.conf' > $RPM_BUILD_ROOT/etc/ld.so.conf
truncate -s 0 $RPM_BUILD_ROOT/etc/ld.so.cache truncate -s 0 $RPM_BUILD_ROOT/etc/ld.so.cache
chmod 644 $RPM_BUILD_ROOT/etc/ld.so.conf chmod 644 $RPM_BUILD_ROOT/etc/ld.so.conf
mkdir -p $RPM_BUILD_ROOT/etc/ld.so.conf.d mkdir -p $RPM_BUILD_ROOT/etc/ld.so.conf.d
mkdir -p $RPM_BUILD_ROOT/etc/sysconfig
truncate -s 0 $RPM_BUILD_ROOT/etc/sysconfig/nscd
truncate -s 0 $RPM_BUILD_ROOT/etc/gai.conf truncate -s 0 $RPM_BUILD_ROOT/etc/gai.conf
# Include %{_libdir}/gconv/gconv-modules.cache # Include %{_libdir}/gconv/gconv-modules.cache
@ -589,6 +617,10 @@ popd
rm -f $RPM_BUILD_ROOT%{_infodir}/dir rm -f $RPM_BUILD_ROOT%{_infodir}/dir
%endif %endif
mkdir -p $RPM_BUILD_ROOT/var/{db,run}/nscd
touch $RPM_BUILD_ROOT/var/{db,run}/nscd/{passwd,group,hosts,services}
touch $RPM_BUILD_ROOT/var/run/nscd/{socket,nscd.pid}
mkdir -p $RPM_BUILD_ROOT%{_libdir} mkdir -p $RPM_BUILD_ROOT%{_libdir}
mv -f $RPM_BUILD_ROOT/%{_lib}/lib{pcprofile,memusage}.so \ mv -f $RPM_BUILD_ROOT/%{_lib}/lib{pcprofile,memusage}.so \
$RPM_BUILD_ROOT%{_libdir} $RPM_BUILD_ROOT%{_libdir}
@ -617,6 +649,7 @@ touch master.filelist
touch glibc.filelist touch glibc.filelist
touch common.filelist touch common.filelist
touch devel.filelist touch devel.filelist
touch nscd.filelist
touch nss_modules.filelist touch nss_modules.filelist
touch nss-devel.filelist touch nss-devel.filelist
touch libnsl.filelist touch libnsl.filelist
@ -671,6 +704,7 @@ cat master.filelist \
-e '%{_libdir}/lib.*\.a' \ -e '%{_libdir}/lib.*\.a' \
-e '%{_libdir}/.*\.o' \ -e '%{_libdir}/.*\.o' \
-e '%{_libdir}/lib.*\.so' \ -e '%{_libdir}/lib.*\.so' \
-e 'nscd' \
-e '%{_prefix}/bin' \ -e '%{_prefix}/bin' \
-e '%{_prefix}/lib/locale' \ -e '%{_prefix}/lib/locale' \
-e '%{_prefix}/sbin/[^i]' \ -e '%{_prefix}/sbin/[^i]' \
@ -697,7 +731,8 @@ echo '%{_libdir}/libpcprofile.so' >> glibc.filelist
############################################################################## ##############################################################################
grep '%{_prefix}/bin' master.filelist > common.filelist grep '%{_prefix}/bin' master.filelist > common.filelist
grep '%{_prefix}/sbin' master.filelist \ grep '%{_prefix}/sbin' master.filelist \
| grep -v '%{_prefix}/sbin/iconvconfig' >> common.filelist | grep -v '%{_prefix}/sbin/iconvconfig' \
| grep -v 'nscd' >> common.filelist
grep '%{_prefix}/share' master.filelist \ grep '%{_prefix}/share' master.filelist \
| grep -v \ | grep -v \
@ -729,6 +764,11 @@ grep '%{_libdir}/lib.*\.a' < master.filelist \
>> devel.filelist >> devel.filelist
##############################################################################
# glibc "nscd" sub-package
##############################################################################
echo '%{_prefix}/sbin/nscd' > nscd.filelist
############################################################################## ##############################################################################
# nss modules sub-package # nss modules sub-package
############################################################################## ##############################################################################
@ -1091,6 +1131,24 @@ if [ -L %{_prefix}/include/scsi ] ; then
rm -f %{_prefix}/include/scsi rm -f %{_prefix}/include/scsi
fi fi
%pre -n nscd
getent group nscd >/dev/null || /usr/sbin/groupadd -g 28 -r nscd
getent passwd nscd >/dev/null ||
/usr/sbin/useradd -M -o -r -d / -s /sbin/nologin \
-c "NSCD Daemon" -u 28 -g nscd nscd
%post -n nscd
%systemd_post nscd.service
%preun -n nscd
%systemd_preun nscd.service
%postun -n nscd
if test $1 = 0; then
/usr/sbin/userdel nscd > /dev/null 2>&1 || :
fi
%systemd_postun_with_restart nscd.service
############################################################################## ##############################################################################
# Files list # Files list
############################################################################## ##############################################################################
@ -1140,6 +1198,25 @@ fi
%files -f devel.filelist devel %files -f devel.filelist devel
%files -f nscd.filelist -n nscd
%config(noreplace) /etc/nscd.conf
%dir %attr(0755,root,root) /var/run/nscd
%dir %attr(0755,root,root) /var/db/nscd
/lib/systemd/system/nscd.service
/lib/systemd/system/nscd.socket
%{_tmpfilesdir}/nscd.conf
%attr(0644,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/run/nscd/nscd.pid
%attr(0666,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/run/nscd/socket
%attr(0600,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/run/nscd/passwd
%attr(0600,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/run/nscd/group
%attr(0600,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/run/nscd/hosts
%attr(0600,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/run/nscd/services
%attr(0600,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/db/nscd/passwd
%attr(0600,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/db/nscd/group
%attr(0600,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/db/nscd/hosts
%attr(0600,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/db/nscd/services
%ghost %config(missingok,noreplace) /etc/sysconfig/nscd
%files -f nss_modules.filelist -n nss_modules %files -f nss_modules.filelist -n nss_modules
/var/db/Makefile /var/db/Makefile
@ -1168,6 +1245,9 @@ fi
%endif %endif
%changelog %changelog
* Thu May 12 2022 jiangheng <jiangheng14@huawei.com> - 2.35-9
- restore nscd
* Wed Mar 30 2022 Yang Yanchao <yangyanchao@huawei.com> - 2.35-8 * Wed Mar 30 2022 Yang Yanchao <yangyanchao@huawei.com> - 2.35-8
- delete the BuildRequires:gcc_secure. - delete the BuildRequires:gcc_secure.

1
nscd.conf Normal file
View File

@ -0,0 +1 @@
d /run/nscd 0755 root root