From fc8375e97643815d779ceba50a101dcae84ce362e6ffd0a86ad5be83dcceab9c Mon Sep 17 00:00:00 2001 From: David Anes Date: Fri, 1 Dec 2023 11:33:45 +0000 Subject: [PATCH] Accepting request 1129809 from home:schubi2:branches:openSUSE:Factory - Moved rsyncd.conf and rsyncd.secrets to /usr/etc. OBS-URL: https://build.opensuse.org/request/show/1129809 OBS-URL: https://build.opensuse.org/package/show/network/rsync?expand=0&rev=114 --- rsync-usr-etc.patch | 76 +++++++++++++++++++++++++++++++++++++++++++++ rsync.changes | 5 +++ rsync.spec | 20 +++++++++--- 3 files changed, 96 insertions(+), 5 deletions(-) create mode 100644 rsync-usr-etc.patch diff --git a/rsync-usr-etc.patch b/rsync-usr-etc.patch new file mode 100644 index 0000000..a99cee2 --- /dev/null +++ b/rsync-usr-etc.patch @@ -0,0 +1,76 @@ +Nur in a: .cirrus.yml. +diff -ur a/clientserver.c b/clientserver.c +--- a/clientserver.c 2023-11-28 17:12:41.643268046 +0100 ++++ b/clientserver.c 2023-11-28 17:25:30.476279700 +0100 +@@ -1261,10 +1261,16 @@ + static int load_config(int globals_only) + { + if (!config_file) { +- if (am_daemon < 0 && am_root <= 0) ++ if (am_daemon < 0 && am_root <= 0) { + config_file = RSYNCD_USERCONF; +- else ++ } else { + config_file = RSYNCD_SYSCONF; ++#ifdef RSYNCD_DISTCONF ++ STRUCT_STAT st; ++ if (do_stat(RSYNCD_SYSCONF, &st) != 0) ++ config_file = RSYNCD_DISTCONF; ++#endif ++ } + } + return lp_load(config_file, globals_only); + } +diff -ur a/configure.ac b/configure.ac +--- a/configure.ac 2023-11-28 17:12:41.647268046 +0100 ++++ b/configure.ac 2023-11-28 17:40:15.678280030 +0100 +@@ -175,7 +175,7 @@ + AC_DEFINE_UNQUOTED(RSYNC_PATH, "$RSYNC_PATH", [location of rsync on remote machine]) + + AC_ARG_WITH(rsyncd-conf, +- AS_HELP_STRING([--with-rsyncd-conf=PATH],[set configuration file for rsync server to PATH (default: /etc/rsyncd.conf)]), ++ AS_HELP_STRING([--with-rsyncd-conf=PATH],[set user/admin defined configuration file for rsync server to PATH (default: /etc/rsyncd.conf)]), + [ if test ! -z "$with_rsyncd_conf" ; then + case $with_rsyncd_conf in + yes|no) +@@ -193,7 +193,27 @@ + fi ], + [ RSYNCD_SYSCONF="/etc/rsyncd.conf" ]) + +-AC_DEFINE_UNQUOTED(RSYNCD_SYSCONF, "$RSYNCD_SYSCONF", [location of configuration file for rsync server]) ++AC_DEFINE_UNQUOTED(RSYNCD_SYSCONF, "$RSYNCD_SYSCONF", [location of user/admin defined configuration file for rsync server]) ++ ++AC_ARG_WITH(rsyncd-distconf, ++ AS_HELP_STRING([--with-rsyncd-distconf=PATH],[set vendor configuration file for rsync server to PATH (default: not set)]), ++ [ if test ! -z "$with_rsyncd_distconf" ; then ++ case $with_rsyncd_distconf in ++ yes|no) ++ RSYNCD_DISTCONF="/usr/etc/rsyncd.conf" ++ ;; ++ /*) ++ RSYNCD_DISTCONF="$with_rsyncd_distconf" ++ ;; ++ *) ++ AC_MSG_ERROR(You must specify an absolute path to --with-rsyncd-distconf=PATH) ++ ;; ++ esac ++ fi ++ ], ++ []) ++ ++AC_DEFINE_UNQUOTED(RSYNCD_DISTCONF, "$RSYNCD_DISTCONF", [location of vendor configuration file for rsync server]) + + AC_ARG_WITH(rsh, + AS_HELP_STRING([--with-rsh=CMD],[set remote shell command to CMD (default: ssh)])) +diff -ur a/rsyncd.conf.5.md b/rsyncd.conf.5.md +--- a/rsyncd.conf.5.md 2023-11-28 17:12:41.643268046 +0100 ++++ b/rsyncd.conf.5.md 2023-11-29 13:08:32.125333095 +0100 +@@ -1235,7 +1235,7 @@ + + ## FILES + +-/etc/rsyncd.conf or rsyncd.conf ++rsyncd.conf or /etc/rsyncd.conf or /usr/etc/rsyncd.conf + + ## SEE ALSO + diff --git a/rsync.changes b/rsync.changes index ba41ba9..7f437eb 100644 --- a/rsync.changes +++ b/rsync.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Wed Nov 29 12:34:30 UTC 2023 - Stefan Schubert + +- Moved rsyncd.conf and rsyncd.secrets to /usr/etc. + ------------------------------------------------------------------- Wed Sep 6 09:52:41 UTC 2023 - David Anes diff --git a/rsync.spec b/rsync.spec index 50bd30d..0a48b72 100644 --- a/rsync.spec +++ b/rsync.spec @@ -56,6 +56,7 @@ Source12: %{name}.keyring Source13: rsyncd Patch0: rsync-no-libattr.patch Patch1: rsync-fortified-strlcpy-fix.patch +Patch2: rsync-usr-etc.patch BuildRequires: autoconf BuildRequires: automake BuildRequires: c++_compiler @@ -113,6 +114,9 @@ export LDFLAGS="-Wl,-z,relro,-z,now -fPIE -pie" --with-included-popt=no \ --with-included-zlib=no \ --disable-debug \ +%if 0%{?suse_version} > 1500 + --with-rsyncd-distconf=%{_distconfdir}/rsyncd.conf \ +%endif %if !%{with xxhash} --disable-xxhash\ %endif @@ -142,12 +146,16 @@ install -m 755 support/rsyncstats %{buildroot}%{_bindir} %if 0%{?suse_version} > 1500 install -d %{buildroot}%{_distconfdir}/logrotate.d install -m 644 %{SOURCE2} %{buildroot}%{_distconfdir}/logrotate.d/rsync +install -m 644 %{SOURCE5} %{buildroot}%{_distconfdir}/rsyncd.conf +install -m 600 %{SOURCE6} %{buildroot}%{_distconfdir}/rsyncd.secrets +echo "# This is a template only. Create your own entries in /etc/rsyncd.secrets" >>%{buildroot}%{_distconfdir}/rsyncd.secrets +echo %else install -d %{buildroot}%{_sysconfdir}/logrotate.d install -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/logrotate.d/rsync -%endif install -m 644 %{SOURCE5} %{buildroot}%{_sysconfdir}/rsyncd.conf install -m 600 %{SOURCE6} %{buildroot}%{_sysconfdir}/rsyncd.secrets +%endif install -D -m 0644 %{SOURCE9} %{buildroot}%{_unitdir}/rsyncd@.service install -D -m 0644 %{SOURCE8} %{buildroot}%{_unitdir}/rsyncd.service install -D -m 0644 %{SOURCE3} %{buildroot}%{_unitdir}/rsyncd.socket @@ -157,7 +165,7 @@ ln -sf service %{buildroot}%{_sbindir}/rcrsyncd %service_add_pre rsyncd.service %if 0%{?suse_version} > 1500 # Prepare for migration to /usr/etc; save any old .rpmsave -for i in logrotate.d/rsync ; do +for i in logrotate.d/rsync rsyncd.conf rsyncd.secrets; do test -f %{_sysconfdir}/${i}.rpmsave && mv -v %{_sysconfdir}/${i}.rpmsave %{_sysconfdir}/${i}.rpmsave.old ||: done %endif @@ -165,7 +173,7 @@ done %if 0%{?suse_version} > 1500 %posttrans # Migration to /usr/etc, restore just created .rpmsave -for i in logrotate.d/rsync ; do +for i in logrotate.d/rsync rsyncd.conf rsyncd.secrets; do test -f %{_sysconfdir}/${i}.rpmsave && mv -v %{_sysconfdir}/${i}.rpmsave %{_sysconfdir}/${i} ||: done %endif @@ -185,12 +193,14 @@ done %{_unitdir}/rsyncd@.service %{_unitdir}/rsyncd.service %{_unitdir}/rsyncd.socket -%config(noreplace) %{_sysconfdir}/rsyncd.conf -%config(noreplace) %{_sysconfdir}/rsyncd.secrets %if 0%{?suse_version} > 1500 %{_distconfdir}/logrotate.d/rsync +%{_distconfdir}/rsyncd.conf +%{_distconfdir}/rsyncd.secrets %else %config(noreplace) %{_sysconfdir}/logrotate.d/rsync +%config(noreplace) %{_sysconfdir}/rsyncd.conf +%config(noreplace) %{_sysconfdir}/rsyncd.secrets %endif %{_sbindir}/rcrsyncd %{_sbindir}/rsyncd