File pciutils-ids.spec of Package pciutils-ids

#
# spec file for package pciutils-ids
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


Name:           pciutils-ids
Version:        20171206
Release:        0
Summary:        PCI utilities's pci.ids database
License:        GPL-2.0+
Group:          Hardware/Other
Url:            http://pci-ids.ucw.cz
Source:         %{name}-%{version}.tar.xz
Source4:        merge-pciids.pl
BuildRequires:  perl-macros
Requires(post): %{_bindir}/perl
Requires(post): coreutils
BuildArch:      noarch
%{perl_requires}

%description
The database of PCI IDs for pciutils.

merge-pciids: This program merges several pci.ids files.

%prep
%setup -q

%build

%install
install -D -p -m 0644 pci.ids \
  %{buildroot}%{_datadir}/pci.ids.d/pci.ids.dist
install -d -m755 %{buildroot}%{_bindir}
install -p -m755 %{SOURCE4} %{buildroot}%{_bindir}/merge-pciids
install -m644 /dev/null %{buildroot}%{_datadir}/pci.ids

%files
%dir %{_datadir}/pci.ids.d
%{_datadir}/pci.ids.d/pci.ids.dist
%{_bindir}/merge-pciids
%ghost %{_datadir}/pci.ids

%post
if [ -x %{_bindir}/merge-pciids -a -x %{_bindir}/perl ]; then
  %{_bindir}/merge-pciids
else
  # This should only happen in autobuild
  echo "WARNING: merge-pciids or perl not found"
  cp -p %{_datadir}/pci.ids.d/pci.ids.dist %{_datadir}/pci.ids
fi

%changelog