File grubby.spec of Package grubby

#
# spec file for package grubby
#
# Copyright (c) 2023 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:           grubby
Version:        20230221.8656bfd
Release:        0
Summary:        Command line tool for updating bootloader configs
License:        GPL-2.0-or-later
Group:          System/Base
URL:            https://src.fedoraproject.org/rpms/grubby
Source0:        %{name}-%{version}.tar.xz
BuildRequires:  grub2
BuildRequires:  pkgconfig
BuildRequires:  util-linux
BuildRequires:  pkgconfig(blkid)
BuildRequires:  pkgconfig(popt)
%ifarch s390 s390x
Requires:       s390-tools
%endif
%ifarch %{arm}
Requires:       u-boot-tools
%endif

%description
This package provides a grubby compatibility script that manages
BootLoaderSpec files and is meant to be backward compatible with
the previous grubby tool.

%prep
%autosetup -p1

%build
%set_build_flags

%install
mkdir -p %{buildroot}%{_sbindir}/
install -T -m 0755 grubby-bls %{buildroot}%{_sbindir}/grubby
install -T -m 0755 installkernel-bls %{buildroot}%{_sbindir}/installkernel

install -D -m 0755 -t %{buildroot}%{_prefix}/lib/kernel/install.d/ 95-kernel-hooks.install
install -D -m 0755 -t %{buildroot}%{_prefix}/lib/kernel/install.d/ 10-devicetree.install

mkdir -p %{buildroot}%{_mandir}/man8
install -m 0644 grubby.8 %{buildroot}%{_mandir}/man8/

%post
if [ "$1" = 2 ]; then
    arch=$(uname -m)
    [[ $arch == "s390x" ]] && \
	zipl-switch-to-blscfg --backup-suffix=.rpmsave &>/dev/null || :
fi

%files
%license COPYING
%{_sbindir}/grubby
%{_sbindir}/installkernel
%dir %{_prefix}/lib/kernel/
%dir %{_prefix}/lib/kernel/install.d/
%{_prefix}/lib/kernel/install.d/10-devicetree.install
%{_prefix}/lib/kernel/install.d/95-kernel-hooks.install
%{_mandir}/man8/*.8%{?ext_man}

%changelog
openSUSE Build Service is sponsored by