File beep.spec of Package beep

#
# spec file for package beep
#
# Copyright (c) 2020 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2020 LISA GmbH, Bingen, 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:           beep
Version:        1.4.9
Release:        0
Summary:	Beep the PC speaker 
License:        GPL-2.0
Url:            https://github.com/spkr-beep/beep
Source:         https://github.com/spkr-beep/beep/archive/v%{version}/%{name}-%{version}.tar.gz
Source1:        EXAMPLES
BuildRequires:  gcc
BuildRequires:  make
BuildRequires:  udev
Requires:       acl
Requires:       shadow
Requires:       udev
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
beep allows you to have the PC speaker issue beeps and beep patterns with given
frequencies, durations, and spacing.

Desktop users are allowed to use this out of the box.
Remote users need to be member of the beep group.

%prep
%setup -q
# we deal with documentation ourself, and don't like executables in the docs
sed -i '/pkgdoc_DATA += .*$/d' GNUmakefile
sed -i '/contrib_SCRIPTS += .*$/d' GNUmakefile
cp -p %{S:1} .

%build
%make_build

%install
%make_install
install -d -m 755 %{buildroot}/%{_udevrulesdir}
cat > %{buildroot}/%{_udevrulesdir}/70-pcspkr-beep.rules << EOF
# Give write access to the PC speaker to the user logged in on the current virtual console
ACTION=="add", SUBSYSTEM=="input", ATTRS{name}=="PC Speaker", ENV{DEVNAME}!="", TAG+="uaccess"
# Add write access to the PC speaker for the "beep" group
ACTION=="add", SUBSYSTEM=="input", ATTRS{name}=="PC Speaker", ENV{DEVNAME}!="", RUN+="/usr/bin/setfacl -m g:beep:w '$env{DEVNAME}'"
EOF

%post
getent group beep >/dev/null || groupadd --system beep
%udev_rules_update

%preun
%udev_rules_update
getent group beep >/dev/null || groupdel beep

%files
%license COPYING
%doc CHANGELOG CREDITS EXAMPLES *.md
%{_bindir}/beep
%{_mandir}/man1/beep.1.gz
%{_udevrulesdir}/70-pcspkr-beep.rules

%changelog
openSUSE Build Service is sponsored by