%define _dirname__ files

Name:          words
Version:       3.0
Release:       33
Summary:       An English words dictionary
License:       Public Domain
URL:           http://en.wikipedia.org/wiki/Moby_Project
Source0:       https://www.gutenberg.org/files/3201/files.zip
Source1:       http://www.gutenberg.org/files/3201/3201.txt

BuildArch:     noarch
BuildRequires: dos2unix coreutils

%description
The words package contains a dictionary of English words. The
dictionary files are stored in /usr/share/dict/ directory. Some programs
will use this dictionary to check English spelling. Other users of this
dictionary will use it to check bad passwords

%prep
%setup -c -q -n %{name}-%{version}

%build
dos2unix -o %{_dirname__}/*;chmod a+r %{_dirname__}/*
cat %{_dirname__}/* | sort --ignore-case --dictionary-order | uniq > linux.words

%install
install -Dm644 linux.words %{buildroot}%{_datadir}/dict/linux.words
ln -sf linux.words %{buildroot}%{_datadir}/dict/words

cp -f %{SOURCE1} readme.txt

%files
%doc readme.txt
%{_datadir}/dict/*

%changelog
* Tue Apr 26 2022 renhongxun<renhongxun@h-partners.com> - 3.0-33
- rebuild words

* Thu Jan 09 2020 zhangguangzhi<zhangguangzhi3@huawei.com> - 3.0-32
- add 3201.txt path

* Tue Sep 10 2019 huzhiyu<huzhiyu1@huawei.com> - 3.0-31
- Package init
