File Leap-Micro-release.spec of Package 000release-packages

#
# spec file for package SUSE-MicroOS-release
#
# Copyright (c) 2018 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/
#

# old location  was /etc/YaST2/licenses/, see jsc#SLE-3067
%define product_license_dir /usr/share/licenses/product/


Name:           Leap-Micro-release
Summary:        openSUSE Leap Micro 5.1 Beta
License:        MIT
Group:          System/Fhs
Version:        5.1
Release:        0
#BuildRequires:  skelcd-EULA-SMO
BuildRequires:  skelcd-openSUSE
Recommends:     branding
# in rare cases, 'ln' is not found...
Requires(post): coreutils
Recommends:     issue-generator
# bsc#1078737#c7
Recommends:     release-notes-suse-microos
Provides:       distribution-release
Provides:       product(Leap-Micro) = %{version}-%{release}
#Provides:       product(SUSE_SLE-SP) = %{version}-%{release}
Provides:	system-installation() = Leap-Micro

# bsc#1055299
Conflicts:      otherproviders(distribution-release)

Provides:       %name-%version
Provides:       product() = Leap-Micro
Provides:       product(Leap-Micro) = 5.1-1
%ifarch x86_64
Provides:       product-register-target() = openSUSE%2DLeap%2D15.2%2Dx86_64
%endif
%ifarch aarch64
Provides:       product-register-target() = openSUSE%2DLeap%2D15.2%2Daarch64
%endif
Provides:       product-label() = openSUSE%20Leap%20Micro
Provides:       product-cpeid() = cpe%3A%2Fo%3Aopensuse%3Aleap%2Dmicro%3A5.1
Provides:       product-url(releasenotes) = http%3A%2F%2Fdoc.opensuse.org%2Frelease%2Dnotes%2F%{_target_cpu}%2FopenSUSE%2FLeap%2DMicro%2F15.2%2Frelease%2Dnotes%2DopenSUSE.rpm
Provides:       product-url(repository) = http%3A%2F%2Fdownload.opensuse.org%2Fdistribution%2Fleap%2Dmicro%2F15.2%2Frepo%2Foss%2F
Provides:       product-url(repository) = http%3A%2F%2Fdownload.opensuse.org%2Fports%2F%{_target_cpu}%2Fdistribution%2Fleap%2Dmicro%2F15.2%2Frepo%2Foss%2F
Provides:       product-endoflife() = 2025%2D10%2D31




# Make sure we are at SLES15 level
# TBD
PreReq:         glibc >= 2.22
Conflicts:      kernel < 4.4
Conflicts:      perl-Bootloader < 0.904

# help packagelist generator to pick -default flavor instead of vanilla, when in doubt
Suggests:	kernel-default

# old package obsoletes removed. If we support 11 SP4 migration to 15, we may
# need to re-add some.

# ./.

BuildRoot:      %{_tmppath}/%{name}-%{version}-build
# this package should only be available for the "basearchs" of a product
# i586 added as installation-images-SLES reequires it.
ExclusiveArch:  x86_64 ppc64le s390x aarch64

Source100:      weakremovers.inc
%include %{SOURCE100}

%description
openSUSE Leap Micro 5.1





%prep
%setup -qcT
mkdir license
tar -C license -xzf %{_libexecdir}/skelcd/CD1/license.tar.gz

%build

%install
mkdir -p $RPM_BUILD_ROOT/etc
mkdir -p $RPM_BUILD_ROOT/usr/lib/issue.d

# Create set-up for issue-generator
echo -e "\nWelcome to openSUSE Leap Micro 5.1 Beta (%{_target_cpu}) - Kernel \\\r (\\\l).\n" > $RPM_BUILD_ROOT/usr/lib/issue.d/10-SUSE
echo -e "\n" >  $RPM_BUILD_ROOT/usr/lib/issue.d/90-SUSE

# create /etc/SuSE-release - deprecated, FATE#316268
# no longer build, in case you wonder

touch $RPM_BUILD_ROOT/etc/motd

# Setup rpm macros
# XXX this wrong. Needs to be in rpm-config-SUSE
mkdir -p $RPM_BUILD_ROOT/etc/rpm/
echo "#" > $RPM_BUILD_ROOT/etc/rpm/macros.sle
echo "# RPM macros to identify SLE distribution" >> $RPM_BUILD_ROOT/etc/rpm/macros.sle
echo "#" >> $RPM_BUILD_ROOT/etc/rpm/macros.sle
echo "#==================================================" >> $RPM_BUILD_ROOT/etc/rpm/macros.sle
echo "" >> $RPM_BUILD_ROOT/etc/rpm/macros.sle
echo "%%sle_version %sle_version" >> $RPM_BUILD_ROOT/etc/rpm/macros.sle

mkdir -p %{buildroot}%{_prefix}/lib
cat > %{buildroot}%{_prefix}/lib/os-release <<EOF
NAME="openSUSE Leap Micro"
VERSION="%{version}%{?betaversion: %{betaversion}}"
ID="opensuse-leap-micro"
ID_LIKE="suse opensuse opensuse-leap suse-microos"
VERSION_ID="%{version}"
PRETTY_NAME="openSUSE Leap Micro %{version}%{?betaversion: %{betaversion}}"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:opensuse:leap-micro:%{version}"
BUG_REPORT_URL="https://bugs.opensuse.org"
HOME_URL="https://www.opensuse.org/"
EOF

ln -s ..%{_prefix}/lib/os-release %{buildroot}%{_sysconfdir}/os-release
#mv $RPM_BUILD_ROOT/etc/os-release $RPM_BUILD_ROOT/usr/lib/os-release 

install -D -d -m 755 "%{buildroot}%{_datadir}/licenses/product/base"
install -D -d -m 755 "%{buildroot}%{_defaultlicensedir}"
cp -a license "%{buildroot}%{_defaultlicensedir}/%{name}"
pushd license
# SLE compat
for i in *; do
	ln -s "%{_defaultlicensedir}/%{name}/$i" %{buildroot}%{_datadir}/licenses/product/base/$i
done


mkdir -p %{buildroot}%{_sysconfdir}/products.d
cat >%{buildroot}%{_sysconfdir}/products.d/Leap-Micro.prod << EOF
<?xml version="1.0" encoding="UTF-8"?>
<product schemeversion="0">
  <vendor>openSUSE</vendor>
  <name>Leap-Micro</name>
  <version>5.1</version>
  <release>1</release>
  <endoflife>2025-10-31</endoflife>
  <arch>%{_target_cpu}</arch>
  <cpeid>cpe:/o:opensuse:leap-micro:5.1</cpeid>
  <productline>Leap</productline>
  <codestream>
    <name>openSUSE Leap Micro 5.1</name>
    <endoflife>2025-10-31</endoflife>
  </codestream>
  <register>
    <pool>
    </pool>
    <updates>
      <distrotarget arch="x86_64">openSUSE-Leap-15.2-x86_64</distrotarget>
      <distrotarget arch="aarch64">openSUSE-Leap-15.2-aarch64</distrotarget>
    </updates>
  </register>
  <repositories>
  </repositories>
  <summary>openSUSE Leap Micro 5.1</summary>
  <shortsummary>openSUSE Leap Micro</shortsummary>
  <description>openSUSE Leap Micro 5.1</description>
  <linguas>
    <language>en</language>
  </linguas>
  <urls>
    <url name="releasenotes">http://doc.opensuse.org/release-notes/%{_target_cpu}/openSUSE/Leap-Micro/15.2/release-notes-openSUSE.rpm</url>
    <url name="repository" arch="x86_64">http://download.opensuse.org/distribution/leap-micro/15.2/repo/oss/</url>
    <url name="repository" arch="aarch64">http://download.opensuse.org/ports/%{_target_cpu}/distribution/leap-micro/15.2/repo/oss/</url>
  </urls>
  <buildconfig>
    <producttheme>Leap-Micro</producttheme>
    <betaversion>Beta</betaversion>
  </buildconfig>
  <installconfig>
    <defaultlang>en_US</defaultlang>
    <releasepackage name="%{name}" flag="EQ" version="%{version}" release="%{release}"/>
    <distribution>openSUSE</distribution>
  </installconfig>
  <runtimeconfig/>
</product>

EOF



%post
# this is a base product, create symlink  bsc#1091952
if [ ! -L %{_sysconfdir}/products.d/baseproduct ]; then
	ln -sf Leap-Micro.prod %{_sysconfdir}/products.d/baseproduct
fi

%files
%defattr(644,root,root,755)
%{_sysconfdir}/os-release
%{_prefix}/lib/os-release
%dir /etc/products.d
%ghost /etc/products.d/baseproduct
/etc/products.d/*
%config /etc/rpm/macros.sle
%config(noreplace) /etc/motd
%dir /usr/lib/issue.d/
/usr/lib/issue.d/*-SUSE
%dir %{product_license_dir}
%{product_license_dir}/base
%license license/*


%changelog
openSUSE Build Service is sponsored by