File bootmac.spec of Package bootmac

#
# spec file for package phosh
#
# Copyright (c) 2022 SUSE LLC
#
# 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 https://bugs.opensuse.org/
#


Name:           bootmac
Version:        0.6.0
Release:        0
Summary:        Bootmac configures the MAC addresses of WLAN and Bluetooth interfaces at boot

License:        GPL-3.0-or-later
URL:            https://gitlab.com/postmarketOS/bootmac
Source0:        %{name}-%{version}.tar.xz
BuildRequires:  systemd-rpm-macros
Requires:       bluez-test
%{?systemd_ordering}

%description
Bootmac configures the MAC addresses of WLAN and Bluetooth interfaces at boot.
Bootmac can be invoked in various ways at boot, but currently only udev rules are tested.
Bootmac generates MAC addresses from the serialno provided by Android bootloaders
through /proc/cmdline or from /etc/machine-id with prefix 02:00.

%prep
%autosetup -p1

%build

%install
%{__install} -Dpm 0755 bootmac %{buildroot}%{_bindir}/bootmac
%{__install} -Dpm 0755 bootmac-bluetooth.rules %{buildroot}%{_udevrulesdir}/90-bootmac-bluetooth.rules
%{__install} -Dpm 0755 bootmac-wifi.rules %{buildroot}%{_udevrulesdir}/90-bootmac-wifi.rules
%{__install} -Dpm 0755 bootmac-bluetooth.service %{buildroot}%{_unitdir}/bootmac-bluetooth.service

%pre
%service_add_pre bootmac-bluetooth.service

%post
%service_add_post bootmac-bluetooth.service

%preun
%service_del_preun bootmac-bluetooth.service

%postun
%service_del_postun bootmac-bluetooth.service

%files
%{_bindir}/bootmac
%{_udevrulesdir}/90-bootmac-bluetooth.rules
%{_udevrulesdir}/90-bootmac-wifi.rules
%{_unitdir}/bootmac-bluetooth.service

%changelog
openSUSE Build Service is sponsored by