diff --git a/rpcbind-0.2.3-systemd-envfile.patch b/rpcbind-0.2.3-systemd-envfile.patch new file mode 100644 index 0000000000000000000000000000000000000000..2bfc248900c61eef0249264ffa41341e6128b820 --- /dev/null +++ b/rpcbind-0.2.3-systemd-envfile.patch @@ -0,0 +1,11 @@ +diff -up rpcbind-0.2.4/systemd/rpcbind.service.in.orig rpcbind-0.2.4/systemd/rpcbind.service.in +--- rpcbind-0.2.4/systemd/rpcbind.service.in.orig 2017-12-16 15:49:07.830889473 -0500 ++++ rpcbind-0.2.4/systemd/rpcbind.service.in 2017-12-16 15:49:43.156610673 -0500 +@@ -12,6 +12,7 @@ Wants=rpcbind.target + [Service] + Type=notify + # distro can provide a drop-in adding EnvironmentFile=-/??? if needed. ++EnvironmentFile=/etc/sysconfig/rpcbind + ExecStart=@_sbindir@/rpcbind $RPCBIND_OPTIONS -w -f + + [Install] diff --git a/rpcbind-0.2.3-systemd-tmpfiles.patch b/rpcbind-0.2.3-systemd-tmpfiles.patch new file mode 100644 index 0000000000000000000000000000000000000000..b9a84576ecc50c61b7a6de69ea65ddae2038c31a --- /dev/null +++ b/rpcbind-0.2.3-systemd-tmpfiles.patch @@ -0,0 +1,40 @@ +diff -up rpcbind-1.2.5/configure.ac.orig rpcbind-1.2.5/configure.ac +--- rpcbind-1.2.5/configure.ac.orig 2018-08-15 10:51:19.000000000 -0400 ++++ rpcbind-1.2.5/configure.ac 2018-08-15 11:14:23.933946110 -0400 +@@ -56,6 +56,17 @@ AC_ARG_WITH([systemdsystemunitdir], + fi + AM_CONDITIONAL(SYSTEMD, [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ]) + ++AC_ARG_WITH([systemdtmpfilesdir], ++ AS_HELP_STRING([--with-systemdtmpfilesdir=DIR], [Directory for systemd tmp files]), ++ [], [with_systemdtmpfilesdir=$($PKG_CONFIG --variable=tmpfilesdir systemd)]) ++ if test "x$with_systemdtmpfilesdir" != xno; then ++ AC_SUBST([systemdtmpfilesdir], [$with_systemdtmpfilesdir]) ++ PKG_CHECK_MODULES([SYSTEMD], [libsystemd], [], ++ [PKG_CHECK_MODULES([SYSTEMD], [libsystemd-daemon], [], ++ AC_MSG_ERROR([libsystemd support requested but found]))]) ++ fi ++AM_CONDITIONAL(SYSTEMD, [test -n "$with_systemdtmpfilesdir" -a "x$with_systemdtmpfilesdir" != xno ]) ++ + AS_IF([test x$enable_libwrap = xyes], [ + AC_CHECK_LIB([wrap], [hosts_access], , + AC_MSG_ERROR([libwrap support requested but unable to find libwrap])) +diff -up rpcbind-1.2.5/Makefile.am.orig rpcbind-1.2.5/Makefile.am +--- rpcbind-1.2.5/Makefile.am.orig 2018-08-15 10:51:19.000000000 -0400 ++++ rpcbind-1.2.5/Makefile.am 2018-08-15 11:14:23.934946111 -0400 +@@ -59,6 +59,9 @@ rpcbind_LDADD += $(SYSTEMD_LIBS) + systemdsystemunit_DATA = \ + systemd/rpcbind.service \ + systemd/rpcbind.socket ++ ++systemdtmpfiles_DATA = \ ++ systemd/rpcbind.conf + endif + + rpcinfo_SOURCES = src/rpcinfo.c +diff -up rpcbind-1.2.5/systemd/rpcbind.conf.orig rpcbind-1.2.5/systemd/rpcbind.conf +--- rpcbind-1.2.5/systemd/rpcbind.conf.orig 2018-08-15 11:14:23.934946111 -0400 ++++ rpcbind-1.2.5/systemd/rpcbind.conf 2018-08-15 11:14:23.934946111 -0400 +@@ -0,0 +1,2 @@ ++#Type Path Mode UID GID Age Argument ++D /run/rpcbind 0700 rpc rpc - - diff --git a/rpcbind-0.2.4-runstatdir.patch b/rpcbind-0.2.4-runstatdir.patch new file mode 100644 index 0000000000000000000000000000000000000000..90c1dae5075d22255eeaa5a3cd7f40c0717f3180 --- /dev/null +++ b/rpcbind-0.2.4-runstatdir.patch @@ -0,0 +1,61 @@ +diff -up rpcbind-1.2.5/configure.ac.orig rpcbind-1.2.5/configure.ac +--- rpcbind-1.2.5/configure.ac.orig 2018-08-15 11:15:14.188974027 -0400 ++++ rpcbind-1.2.5/configure.ac 2018-08-15 11:15:44.948991114 -0400 +@@ -26,8 +26,8 @@ AC_ARG_ENABLE([rmtcalls], + AM_CONDITIONAL(RMTCALLS, test x$enable_rmtcalls = xyes) + + AC_ARG_WITH([statedir], +- AS_HELP_STRING([--with-statedir=ARG], [use ARG as state dir @<:@default=/var/run/rpcbind@:>@]) +- ,, [with_statedir=/var/run/rpcbind]) ++ AS_HELP_STRING([--with-statedir=ARG], [use ARG as state dir @<:@default=/run/rpcbind@:>@]) ++ ,, [with_statedir=/run/rpcbind]) + AC_SUBST([statedir], [$with_statedir]) + + AC_ARG_WITH([rpcuser], +diff -up rpcbind-1.2.5/configure.orig rpcbind-1.2.5/configure +--- rpcbind-1.2.5/configure.orig 2018-08-15 11:00:32.000000000 -0400 ++++ rpcbind-1.2.5/configure 2018-08-15 11:15:44.951991115 -0400 +@@ -1391,7 +1391,7 @@ Optional Features: + Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) +- --with-statedir=ARG use ARG as state dir [default=/var/run/rpcbind] ++ --with-statedir=ARG use ARG as state dir [default=/run/rpcbind] + + --with-rpcuser=ARG use ARG for RPC [default=root] + +@@ -3901,7 +3901,7 @@ fi + if test "${with_statedir+set}" = set; then : + withval=$with_statedir; + else +- with_statedir=/var/run/rpcbind ++ with_statedir=/run/rpcbind + fi + + statedir=$with_statedir +diff -up rpcbind-1.2.5/man/rpcbind-fr.8.orig rpcbind-1.2.5/man/rpcbind-fr.8 +--- rpcbind-1.2.5/man/rpcbind-fr.8.orig 2018-08-15 10:51:19.000000000 -0400 ++++ rpcbind-1.2.5/man/rpcbind-fr.8 2018-08-15 11:15:44.951991115 -0400 +@@ -138,8 +138,8 @@ est redémarré. + .Xr rpcbind 3 , + .Xr rpcinfo 8 + .Sh FILES +-.Bl -tag -width /var/run/rpcbind.sock -compact +-.It Pa /var/run/rpcbind.sock ++.Bl -tag -width /run/rpcbind.sock -compact ++.It Pa /run/rpcbind.sock + .Sh TRADUCTION + Aurelien CHARBON (Sept 2003) + .El +diff -up rpcbind-1.2.5/src/rpcbind.c.orig rpcbind-1.2.5/src/rpcbind.c +--- rpcbind-1.2.5/src/rpcbind.c.orig 2018-08-15 10:51:19.000000000 -0400 ++++ rpcbind-1.2.5/src/rpcbind.c 2018-08-15 11:15:44.952991116 -0400 +@@ -106,7 +106,7 @@ char *nss_modules = "files"; + /* who to suid to if -s is given */ + #define RUN_AS "daemon" + +-#define RPCBINDDLOCK "/var/run/rpcbind.lock" ++#define RPCBINDDLOCK RPCBIND_STATEDIR "/rpcbind.lock" + + int runasdaemon = 0; + int insecure = 0; diff --git a/rpcbind-0.2.4-systemd-rundir.patch b/rpcbind-0.2.4-systemd-rundir.patch new file mode 100644 index 0000000000000000000000000000000000000000..da08d7a1f294174f5e3dd5cc3c9a5ed9bc2c9a2d --- /dev/null +++ b/rpcbind-0.2.4-systemd-rundir.patch @@ -0,0 +1,35 @@ +diff -up rpcbind-0.2.4/src/rpcbind.c.orig rpcbind-0.2.4/src/rpcbind.c +--- rpcbind-0.2.4/src/rpcbind.c.orig 2017-03-21 10:12:35.005190509 -0400 ++++ rpcbind-0.2.4/src/rpcbind.c 2017-03-21 10:36:45.510507649 -0400 +@@ -144,6 +144,8 @@ static void rbllist_add(rpcprog_t, rpcve + static void terminate(int); + static void parseargs(int, char *[]); + ++char *systemdtmp = "/usr/bin/systemd-tmpfiles --create rpcbind.conf"; ++ + int + main(int argc, char *argv[]) + { +@@ -151,13 +153,21 @@ main(int argc, char *argv[]) + void *nc_handle; /* Net config handle */ + struct rlimit rl; + int maxrec = RPC_MAXDATASIZE; ++ int once = 1; + + parseargs(argc, argv); + ++tryagain: + /* Check that another rpcbind isn't already running. */ + if ((rpcbindlockfd = (open(RPCBINDDLOCK, +- O_RDONLY|O_CREAT, 0444))) == -1) ++ O_RDONLY|O_CREAT, 0444))) == -1) { ++ if (once) { ++ once = system(systemdtmp); /* set once to avoid a warning */ ++ once = 0; ++ goto tryagain; ++ } + err(1, "%s", RPCBINDDLOCK); ++ } + + if(flock(rpcbindlockfd, LOCK_EX|LOCK_NB) == -1 && errno == EWOULDBLOCK) + errx(1, "another rpcbind is already running. Aborting"); diff --git a/rpcbind-0.2.4-systemd-service.patch b/rpcbind-0.2.4-systemd-service.patch new file mode 100644 index 0000000000000000000000000000000000000000..0350020cdac6bf73b63d45b2f7d00a6cc535c17c --- /dev/null +++ b/rpcbind-0.2.4-systemd-service.patch @@ -0,0 +1,13 @@ +diff -up rpcbind-0.2.4/systemd/rpcbind.service.in.orig rpcbind-0.2.4/systemd/rpcbind.service.in +--- rpcbind-0.2.4/systemd/rpcbind.service.in.orig 2017-12-16 15:46:12.896270101 -0500 ++++ rpcbind-0.2.4/systemd/rpcbind.service.in 2017-12-16 15:46:43.672027210 -0500 +@@ -7,7 +7,8 @@ RequiresMountsFor=@statedir@ + # Make sure we use the IP addresses listed for + # rpcbind.socket, no matter how this unit is started. + Requires=rpcbind.socket +-Wants=rpcbind.target ++Wants=rpcbind.target systemd-tmpfiles-setup.service ++After=systemd-tmpfiles-setup.service + + [Service] + Type=notify diff --git a/rpcbind-1.2.6.tar.bz2 b/rpcbind-1.2.6.tar.bz2 new file mode 100644 index 0000000000000000000000000000000000000000..311c2e710bdb3ab299a1172aafd02a15ea1390f1 Binary files /dev/null and b/rpcbind-1.2.6.tar.bz2 differ diff --git a/rpcbind.spec b/rpcbind.spec new file mode 100644 index 0000000000000000000000000000000000000000..f5c40bb8141787982da442ee6f49d8dd8b0ae8f0 --- /dev/null +++ b/rpcbind.spec @@ -0,0 +1,121 @@ +%define anolis_release 1 + +# These are macros to be usable outside of the build section +%global rpcbind_user_group rpc +%global rpcbind_state_dir %{_rundir}/rpcbind + +Name: rpcbind +Version: 1.2.6 +Release: %{anolis_release}%{?dist} +Summary: Universal Addresses to RPC Program Number Mapper +License: BSD +URL: http://nfsv4.bullopensource.org + +Source0: http://downloads.sourceforge.net/rpcbind/%{name}-%{version}.tar.bz2 +Source1: %{name}.sysconfig + +Requires: glibc-common setup +Conflicts: man-pages < 2.43-12 +BuildRequires: make +BuildRequires: automake, autoconf, libtool, systemd, systemd-devel +BuildRequires: libtirpc-devel, quota-devel +Requires(pre): coreutils shadow-utils +Requires(post): systemd +Requires(preun): systemd +Requires(postun): systemd coreutils + +# modify service file to keep backend compat +Patch100: rpcbind-0.2.3-systemd-envfile.patch +Patch101: rpcbind-0.2.3-systemd-tmpfiles.patch +Patch102: rpcbind-0.2.4-runstatdir.patch +Patch103: rpcbind-0.2.4-systemd-service.patch +Patch104: rpcbind-0.2.4-systemd-rundir.patch + +Provides: portmap = %{version}-%{release} +Obsoletes: portmap <= 4.0-65.3 + +%description +The rpcbind utility is a server that converts RPC program numbers into +universal addresses. It must be running on the host to be able to make +RPC calls on a server on that machine. + +%prep +%autosetup -p1 + +%build +autoreconf -fisv +%configure \ + --enable-warmstarts \ + --with-statedir="%rpcbind_state_dir" \ + --with-rpcuser="%rpcbind_user_group" \ + --with-nss-modules="files altfiles" \ + --sbindir=%{_bindir} \ + --enable-rmtcalls \ + --enable-debug + +make all + +%install +mkdir -p %{buildroot}{%{_sbindir},%{_bindir},/etc/sysconfig} +mkdir -p %{buildroot}%{_unitdir} +mkdir -p %{buildroot}%{_tmpfilesdir} +mkdir -p %{buildroot}%{_mandir}/man8 +mkdir -p %{buildroot}%{rpcbind_state_dir} +make DESTDIR=$RPM_BUILD_ROOT install + +install -m644 %{SOURCE1} %{buildroot}/etc/sysconfig/rpcbind + +# The binaries now live in /usr/bin, moving from /usr/sbin +# For compatibility create a couple symlinks. +cd ${RPM_BUILD_ROOT}%{_sbindir} +ln -sf ../bin/rpcbind +ln -sf ../bin/rpcinfo + + +%pre + +# Softly static allocate the rpc uid and gid. +getent group rpc >/dev/null || groupadd -f -g 32 -r rpc +if ! getent passwd rpc >/dev/null ; then + if ! getent passwd 32 >/dev/null ; then + useradd -l -c "Rpcbind Daemon" -d /var/lib/rpcbind \ + -g rpc -M -s /sbin/nologin -o -u 32 rpc > /dev/null 2>&1 + else + useradd -l -c "Rpcbind Daemon" -d /var/lib/rpcbind \ + -g rpc -M -s /sbin/nologin rpc > /dev/null 2>&1 + fi +fi + +%post +%systemd_post rpcbind.service rpcbind.socket + +%preun +%systemd_preun rpcbind.service rpcbind.socket + +%postun +%systemd_postun_with_restart rpcbind.service rpcbind.socket + +%triggerin -- rpcbind > 0.2.2-2.0 +if systemctl -q is-enabled rpcbind.socket +then + /bin/systemctl reenable rpcbind.socket >/dev/null 2>&1 || : + /bin/systemctl restart rpcbind.socket >/dev/null 2>&1 || : +fi + +%files +%license COPYING +%config(noreplace) /etc/sysconfig/rpcbind +%doc AUTHORS ChangeLog README +%{_bindir}/rpcbind +%{_bindir}/rpcinfo +%{_sbindir}/rpcbind +%{_sbindir}/rpcinfo +%{_mandir}/man8/* +%{_unitdir}/%{name}.service +%{_unitdir}/%{name}.socket +%{_tmpfilesdir}/%{name}.conf +%attr(0700, %{rpcbind_user_group}, %{rpcbind_user_group}) %dir %{rpcbind_state_dir} + +%changelog +* Fri Mar 11 2022 Chunmei Xu - 1.2.6-1 +- init from upstream 1.2.6 diff --git a/rpcbind.sysconfig b/rpcbind.sysconfig new file mode 100644 index 0000000000000000000000000000000000000000..4b35e3749ab07be29a3ed38a631f85eaa655ac2e --- /dev/null +++ b/rpcbind.sysconfig @@ -0,0 +1,3 @@ +# +# Optional arguments passed to rpcbind. See rpcbind(8) +RPCBIND_ARGS=""