File winniepooh.spec of Package winniepooh

#
# spec file for package winniepooh
#
# Copyright (c) 2022 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/
#
%global           MinSLEVersion 12.4
%global           MinLeapVersion 15.2

Name:             winniepooh
Version:          0.9.1
Release:          0
Url:              https://github.com/SUSE/winniepooh
Summary:          Rescue system via grub menu
License:          GPL-3.0+
Group:            System/Management
Source:           winniepooh-0.9.1.tar.gz 
BuildRoot:        %{_tmppath}/%{name}-%{version}-build
BuildArch:        noarch
BuildRequires:    grub2

Requires:         grub2,curl
Requires:         (product(SLES) >= %{MinSLEVersion} or product(Leap) >= %{MinLeapVersion}) 

%description -n winniepooh
Script code to add rescue menu to grub using iso either on the root or on first partition on second hard disk.

%prep
%setup -q -n winniepooh-%{version}

%install

install -D -m 755 grub.d/99_rescue \
    %{buildroot}/etc/grub.d/99_rescue

%post
/usr/sbin/grub2-mkconfig -o /boot/grub2/grub.cfg
echo ""
echo "Please do not forget to download an installation/rescue image:"
echo "/usr/bin/curl -L https://download.opensuse.org/distribution/leap/15.5/iso/openSUSE-Leap-15.5-NET-x86_64-Current.iso --output /rescue.iso "
echo "WARNING: If the isntaller prompts you for resuce image it's because it is not included, select the download link and try eth0 and wlan0 to fetch it"
echo "Note: you might use a sles 15sp4 online image as it has rescue directly on it"

%postun
/usr/sbin/grub2-mkconfig -o /boot/grub2/grub.cfg

%files
%defattr(-,root,root,-)
%dir /etc/grub.d
/etc/grub.d/*

%changelog
openSUSE Build Service is sponsored by