add checks to post and pretrans

This commit is contained in:
Jens Petersen 2022-01-26 23:11:13 +08:00
parent 4f0c047284
commit f02139cd19

View File

@ -3,7 +3,7 @@
Name: hunspell
Summary: A spell checker and morphological analyzer library
Version: 1.7.0
Release: 14%{?dist}
Release: 15%{?dist}
Source: https://github.com/hunspell/hunspell/archive/v%{version}.tar.gz
URL: https://github.com/hunspell/hunspell
License: LGPLv2+ or GPLv2+ or MPLv1.1
@ -106,15 +106,18 @@ mkdir $RPM_BUILD_ROOT/%{_datadir}/myspell
%pretrans -p <lua>
-- Rename dir from myspell to hunspell
-- DO NOT add a trailing slash at the end.
old_path = "/usr/share/myspell"
new_path = "/usr/share/hunspell"
st = posix.stat(old_path)
if st and st.type == "directory" then
status = os.rename(old_path, new_path)
old_path = "%{_datadir}/myspell"
new_path = "%{_datadir}/hunspell"
old_st = posix.stat(old_path)
new_st = posix.stat(new_path)
if old_st and old_st.type == "directory" and not new_st then
os.rename(old_path, new_path)
end
%post
%__ln_s %{_datadir}/hunspell %{_datadir}/myspell
%post -p <lua>
if not posix.stat("%{_datadir}/myspell") then
posix.symlink("%{_datadir}/hunspell", "%{_datadir}/myspell")
end
%endif
%files -f %{name}.lang
@ -153,6 +156,11 @@ end
%endif
%changelog
* Wed Jan 26 2022 Jens Petersen <petersen@redhat.com> - 1.7.0-15
- improve the filesystem pretrans and post scripts:
- pretrans now checks if /usr/share/hunspell exists first
- post checks that /usr/share/myspell does not exist
* Wed Jan 26 2022 Jens Petersen <petersen@redhat.com> - 1.7.0-14
- requires coreutils for post script (#2045568)