From aa41bdd23579b8d67153fcc260c1406dc3c29fa20d0b9c743f35893d0cdcc71e Mon Sep 17 00:00:00 2001 From: "Dr. Werner Fink" Date: Mon, 11 Dec 2023 07:07:14 +0000 Subject: [PATCH] Accepting request 1131341 from home:schubi2:branches:openSUSE:Factory - Moving /etc/mailrc to /usr/etc/mail.rc OBS-URL: https://build.opensuse.org/request/show/1131341 OBS-URL: https://build.opensuse.org/package/show/server:mail/mailx?expand=0&rev=77 --- mailx-usr-etc.patch | 33 +++++++++++++++++++++++++++++++++ mailx.changes | 5 +++++ mailx.spec | 36 +++++++++++++++++++++++++++++++++++- 3 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 mailx-usr-etc.patch diff --git a/mailx-usr-etc.patch b/mailx-usr-etc.patch new file mode 100644 index 0000000..96df48a --- /dev/null +++ b/mailx-usr-etc.patch @@ -0,0 +1,33 @@ +diff -ur a/main.c b/main.c +--- a/main.c 2023-12-05 09:54:32.727382197 +0100 ++++ b/main.c 2023-12-06 11:07:50.176112126 +0100 +@@ -454,8 +454,15 @@ + input = stdin; + rcvmode = !to && !tflag; + spreserve(); +- if (!nosrc) +- load(PATH_MASTER_RC); ++ if (!nosrc) { ++#ifdef DISTCONFMAILRC ++ struct stat st; ++ if (stat(PATH_MASTER_RC, &st) < 0) ++ load(DISTCONFMAILRC); ++ else ++#endif ++ load(PATH_MASTER_RC); ++ } + /* + * Expand returns a savestr, but load only uses the file name + * for fopen, so it's safe to do this. +diff -ur a/Makefile b/Makefile +--- a/Makefile 2023-12-05 09:54:32.727382197 +0100 ++++ b/Makefile 2023-12-06 11:08:00.418064025 +0100 +@@ -60,7 +60,7 @@ + ########################################################################### + ########################################################################### + +-FEATURES = $(IPv6) ++FEATURES = $(IPv6) $(DISTCONF) + + OBJ = aux.o base64.o cache.o cmd1.o cmd2.o cmd3.o cmdtab.o collect.o \ + dotlock.o edit.o fio.o getname.o getopt.o head.o hmac.o \ diff --git a/mailx.changes b/mailx.changes index ac46661..4b15a3c 100644 --- a/mailx.changes +++ b/mailx.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Wed Dec 6 12:02:04 UTC 2023 - Stefan Schubert + +- Moving /etc/mailrc to /usr/etc/mail.rc + ------------------------------------------------------------------- Tue Nov 7 09:10:38 UTC 2023 - Dominique Leuenberger diff --git a/mailx.spec b/mailx.spec index 5d327e2..916a969 100644 --- a/mailx.spec +++ b/mailx.spec @@ -72,6 +72,8 @@ Patch13: mailx-12.5-openssl-1.1.0f.patch Patch14: fix-sendmail-name.patch #PATCH-FIX-SUSE: bsc#1192916 - mailx does not send mails unless run via strace or in verbose mode Patch15: mailx-12.5-systemd.patch +#Moving /etc/mailrc to /usr/etc/mail.rc +Patch16: mailx-usr-etc.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build %description @@ -99,13 +101,18 @@ minor enhancements like the ability to set a "From:" address. %patch14 -p1 -b .sendmail %patch15 -p0 -b .systemd %patch0 -p1 -b .0 +%patch16 -p1 -b .usretc %build CC=gcc CFLAGS="%{optflags} -pipe -D_GNU_SOURCE -DOPENSSL_NO_SSL_INTERN $(pkg-config --cflags openssl)" export CC CFLAGS $SHELL ./makeconfig +%if 0%{?suse_version} > 1500 + make %{?_smp_mflags} PREFIX=/usr CC="$CC" CFLAGS="$CFLAGS" DISTCONF="-DDISTCONFMAILRC=\"\\\"/usr/etc/mail.rc\\\"\"" +%else make %{?_smp_mflags} PREFIX=/usr CC="$CC" CFLAGS="$CFLAGS" +%endif tbl < mailx.1 | groff -mandocdb -Tps | grep -v %%%%CreationDate > manual.ps gzip -9fn manual.ps @@ -153,7 +160,14 @@ man=mailx.1 group=mail, Mail EOF %endif + +%if 0%{?suse_version} > 1500 + mkdir -p %{buildroot}%{_distconfdir} + install -m 0644 mail.rc %{buildroot}%{_distconfdir} + rm %{buildroot}/etc/mail.rc +%else install -m 0644 mail.rc %{buildroot}/etc +%endif mkdir -p %{buildroot}%{_defaultdocdir}/%{name} %if ! %{with libalternatives} @@ -171,20 +185,40 @@ EOF if test ! -e %{_bindir}/mailx; then %{_sbindir}/update-alternatives --quiet --force --remove mail %{_bindir}/mailx fi -%else +%endif %pre +echo "Calling pre installation script" +%if %{with libalternatives} # removing old update-alternatives entries if [ "$1" -gt 0 ] && [ -f %{_sbindir}/update-alternatives ] ; then %{_sbindir}/update-alternatives --quiet --force --remove mail %{_bindir}/mailx fi %endif +%if 0%{?suse_version} > 1500 +# Prepare for migration to /usr/etc; save any old .rpmsave +for i in mail.rc; do + test -f %{_sysconfdir}/${i}.rpmsave && mv -v %{_sysconfdir}/${i}.rpmsave %{_sysconfdir}/${i}.rpmsave.old ||: +done +%endif + +%if 0%{?suse_version} > 1500 +%posttrans +# Migration to /usr/etc, restore just created .rpmsave +for i in mail.rc; do + test -f %{_sysconfdir}/${i}.rpmsave && mv -v %{_sysconfdir}/${i}.rpmsave %{_sysconfdir}/${i} ||: +done +%endif %files %defattr(-,root,root) %license COPYING %doc README manual.ps.gz nail.rc +%if 0%{?suse_version} > 1500 +%{_distconfdir}/mail.rc +%else %config /etc/mail.rc +%endif %if 0%{?suse_version} < 1550 /bin/mail %endif