From 97ec7e1a9b8a4bfb8022ed788cf52e7ce1961544 Mon Sep 17 00:00:00 2001 From: "Dr. Werner Fink" Date: Tue, 28 Jan 2020 14:24:38 +0000 Subject: [PATCH] Only notify if older version is used OBS-URL: https://build.opensuse.org/package/show/server:mail/mutt?expand=0&rev=205 --- mutt.changes | 6 ++++++ mutt.spec | 27 ++++++++++++++++++++------- 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/mutt.changes b/mutt.changes index 2f62083..42452e4 100644 --- a/mutt.changes +++ b/mutt.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Tue Jan 28 13:42:02 UTC 2020 - Dr. Werner Fink + +- Add version check, that is if installed mutt version does not + fir the installing version then do notify message + ------------------------------------------------------------------- Tue Jan 28 10:13:24 UTC 2020 - Dr. Werner Fink diff --git a/mutt.spec b/mutt.spec index 530e48d..464b9ff 100644 --- a/mutt.spec +++ b/mutt.spec @@ -61,8 +61,11 @@ BuildRequires: update-desktop-files %endif BuildRequires: w3m URL: http://www.mutt.org -Requires(post): %install_info_prereq -Requires(preun): %install_info_prereq +Requires(postun): /usr/bin/rm +Requires(post): /usr/bin/mkdir +Requires(post): /usr/bin/cat +Requires(pre): /usr/bin/zcat +Requires(pre): /usr/bin/grep Recommends: hunspell Provides: muttssl Obsoletes: muttssl @@ -124,6 +127,8 @@ enhancements. Summary: Additional Documentation about Mutt Group: Documentation/Other Requires: %{name} = %{version} +Requires(post): %install_info_prereq +Requires(preun): %install_info_prereq Recommends: perl(Expect) Provides: %{name}:%{_docdir}/%name/COPYRIGHT BuildArch: noarch @@ -272,29 +277,38 @@ install -D -m 644 %{SOURCE5} %{buildroot}%{_sysconfdir}/skel/.muttrc install -D -m 644 %{SOURCE9} %{buildroot}%{_datadir}/%name/mailcap rm -vf %{buildroot}%{_docdir}/%name/manual.txt install -D -m 644 doc/manual.txt.gz %{buildroot}%{_docdir}/%name/ + %if 0%{?suse_version} %suse_update_desktop_file mutt %endif -%if 0%{?suse_version} > 1130 +%pre +if test $1 -gt 1 -a -e %{_docdir}/%name/manual.txt.gz +then + zcat %{_docdir}/%name/manual.txt.gz | grep -F 'version %{version}' > /run/mutt-version +fi + %post %mime_database_post -mkdir -p %{_localstatedir}/adm/update-messages -cat > %{_localstatedir}/adm/update-messages/%{name}-%{version}-%{release}-notify <<-'EOF' +if test -f /run/mutt-version -a ! -s /run/mutt-version +then + mkdir -p %{_localstatedir}/adm/update-messages + cat > %{_localstatedir}/adm/update-messages/%{name}-%{version}-%{release}-notify <<-'EOF' With %{name}-%{version} some variables and the behaviour changes: $send_multipart_alternative changes to run in batch mode on ask-yes. $write_bcc changes to default off EOF +fi %postun %mime_database_postun +rm -f %{_localstatedir}/adm/update-messages/%{name}-%{version}-%{release}-notify %post doc %install_info --info-dir=%{_infodir} "%{_infodir}/mutt.info.gz" %preun doc %install_info_delete --info-dir=%{_infodir} "%{_infodir}/mutt.info.gz" -%endif %files %defattr(-,root,root) @@ -317,7 +331,6 @@ cat > %{_localstatedir}/adm/update-messages/%{name}-%{version}-%{release}-notify %{_datadir}/mutt/mailcap %dir %doc %{_docdir}/%name/ %doc %{_docdir}/%name/manual.txt.gz -%ghost %{_localstatedir}/adm/update-messages/%{name}-%{version}-%{release}-notify %files doc %defattr(-,root,root)