File SUSE-MicroOS-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:           SUSE-MicroOS-release
Summary:        SUSE Linux Enterprise Micro 5.1 
License:        MIT
Group:          System/Fhs
Version:        5.1
Release:        0
BuildRequires:  skelcd-EULA-SMO
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(SUSE-MicroOS) = %{version}-%{release}
#Provides:       product(SUSE_SLE-SP) = %{version}-%{release}
Provides:	system-installation() = SUSE-MicroOS

# bsc#1055299
Conflicts:      otherproviders(distribution-release)
Provides:	SUSE_MicroOS-release
Obsoletes:	SUSE_MicroOS-release

# version here matching SLE code stream due to extensions
Provides:       product(SUSE_SLE) = 15.3-%{release}
Provides:       product(SUSE_SLE-SP3) = 15.3-%{release}

Provides:       %name-%version
Provides:       product() = SUSE-MicroOS
Provides:       product(SUSE-MicroOS) = 5.1-1
%ifarch x86_64
Provides:       product-register-target() = sle%2D15%2Dx86_64
%endif
%ifarch s390x
Provides:       product-register-target() = sle%2D15%2Ds390x
%endif
%ifarch aarch64
Provides:       product-register-target() = sle%2D15%2Daarch64
%endif
Provides:       product-label() = SUSE%20Linux%20Enterprise%20Micro
Provides:       product-cpeid() = cpe%3A%2Fo%3Asuse%3Asuse%2Dmicroos%3A5.1
Provides:       product-url(releasenotes) = https%3A%2F%2Fwww.suse.com%2Freleasenotes%2F%{_target_cpu}%2FSLE%2DMicro%2F5.1%2Frelease%2Dnotes%2Dsle%2Dmicro.rpm
%ifarch x86_64
Provides:       product-updates-repoid() = obsrepository%3A%2F%2Fbuild.suse.de%2FSUSE%3AUpdates%3ASUSE%2DMicroOS%3A5.1%3Ax86_64%2Fupdate
%endif
%ifarch s390x
Provides:       product-updates-repoid() = obsrepository%3A%2F%2Fbuild.suse.de%2FSUSE%3AUpdates%3ASUSE%2DMicroOS%3A5.1%3As390x%2Fupdate
%endif
%ifarch aarch64
Provides:       product-updates-repoid() = obsrepository%3A%2F%2Fbuild.suse.de%2FSUSE%3AUpdates%3ASUSE%2DMicroOS%3A5.1%3Aaarch64%2Fupdate
%endif
%ifarch x86_64
Provides:       product-updates-repoid() = obsrepository%3A%2F%2Fbuild.suse.de%2FSUSE%3AUpdates%3ASUSE%2DMicroOS%3A5.1%3Ax86_64%2Fupdate_debug
%endif
%ifarch s390x
Provides:       product-updates-repoid() = obsrepository%3A%2F%2Fbuild.suse.de%2FSUSE%3AUpdates%3ASUSE%2DMicroOS%3A5.1%3As390x%2Fupdate_debug
%endif
%ifarch aarch64
Provides:       product-updates-repoid() = obsrepository%3A%2F%2Fbuild.suse.de%2FSUSE%3AUpdates%3ASUSE%2DMicroOS%3A5.1%3Aaarch64%2Fupdate_debug
%endif
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
SUSE Linux Enterprise Micro 5.1





%prep

%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 SUSE Linux Enterprise Micro 5.1  (%{_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
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

# Put EULA into correct place
mkdir -p $RPM_BUILD_ROOT/%{product_license_dir}SUSE-MicroOS
cd $RPM_BUILD_ROOT/%{product_license_dir}SUSE-MicroOS
tar -xf /usr/lib/skelcd/CD1/license-SMO.tar.gz  # --overwrite
echo "directory.yast" > directory.yast
ls lic* > directory.yast

mkdir -p %{buildroot}%{_sysconfdir}
cat >%{buildroot}%{_sysconfdir}/os-release << EOF
NAME="SUSE-MicroOS"
VERSION="%{version}%{?betaversion: %{betaversion}}"
VERSION_ID="%{version}"
PRETTY_NAME="SUSE Linux Enterprise Micro 5.1%{?betaversion: (%{betaversion})}"
ID="suse-microos"
ID_LIKE="suse"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:suse:suse-microos:5.1"
EOF


# store os-release in /usr/lib, /etc/os-release is its symlink
# /etc directory is used above and below, keeping it does not hurt
mkdir -p $RPM_BUILD_ROOT/usr/lib
sed 's/^NAME=.*$/NAME=\"SLE Micro\"/' <$RPM_BUILD_ROOT/etc/os-release >%{buildroot}%{_prefix}/lib/os-release
rm $RPM_BUILD_ROOT/etc/os-release 
ln -s ..%{_prefix}/lib/os-release %{buildroot}%{_sysconfdir}/os-release
#mv $RPM_BUILD_ROOT/etc/os-release $RPM_BUILD_ROOT/usr/lib/os-release 

mkdir -p %{buildroot}%{_sysconfdir}/products.d
cat >%{buildroot}%{_sysconfdir}/products.d/SUSE-MicroOS.prod << EOF
<?xml version="1.0" encoding="UTF-8"?>
<product schemeversion="0">
  <vendor>SUSE</vendor>
  <name>SUSE-MicroOS</name>
  <version>5.1</version>
  <release>1</release>
  <endoflife>2025-10-31</endoflife>
  <arch>%{_target_cpu}</arch>
  <cpeid>cpe:/o:suse:suse-microos:5.1</cpeid>
  <productline>SUSE-MicroOS</productline>
  <codestream>
    <name>SUSE Linux Enterprise Micro 5.1</name>
    <endoflife>2025-10-31</endoflife>
  </codestream>
  <register>
%ifarch x86_64
      <target>sle-15-x86_64</target>
%endif
%ifarch s390x
      <target>sle-15-s390x</target>
%endif
%ifarch aarch64
      <target>sle-15-aarch64</target>
%endif
  </register>
  <repositories>
%ifarch x86_64
      <repository type="update" repoid="obsrepository://build.suse.de/SUSE:Updates:SUSE-MicroOS:5.1:x86_64/update" />
%endif
%ifarch s390x
      <repository type="update" repoid="obsrepository://build.suse.de/SUSE:Updates:SUSE-MicroOS:5.1:s390x/update" />
%endif
%ifarch aarch64
      <repository type="update" repoid="obsrepository://build.suse.de/SUSE:Updates:SUSE-MicroOS:5.1:aarch64/update" />
%endif
%ifarch x86_64
      <repository type="update" repoid="obsrepository://build.suse.de/SUSE:Updates:SUSE-MicroOS:5.1:x86_64/update_debug" />
%endif
%ifarch s390x
      <repository type="update" repoid="obsrepository://build.suse.de/SUSE:Updates:SUSE-MicroOS:5.1:s390x/update_debug" />
%endif
%ifarch aarch64
      <repository type="update" repoid="obsrepository://build.suse.de/SUSE:Updates:SUSE-MicroOS:5.1:aarch64/update_debug" />
%endif
%ifarch x86_64
      <repository type="pool" repoid="obsproduct://build.suse.de/SUSE:Products:SUSE-MicroOS:5.1:x86_64/SUSE-MicroOS/5.1/%{_target_cpu}" />
%endif
%ifarch s390x
      <repository type="pool" repoid="obsproduct://build.suse.de/SUSE:Products:SUSE-MicroOS:5.1:s390x/SUSE-MicroOS/5.1/%{_target_cpu}" />
%endif
%ifarch aarch64
      <repository type="pool" repoid="obsproduct://build.suse.de/SUSE:Products:SUSE-MicroOS:5.1:aarch64/SUSE-MicroOS/5.1/%{_target_cpu}" />
%endif
  </repositories>
  <summary>SUSE Linux Enterprise Micro 5.1</summary>
  <shortsummary>SUSE Linux Enterprise Micro</shortsummary>
  <description>SUSE Linux Enterprise Micro 5.1</description>
  <linguas>
    <language>en</language>
  </linguas>
  <urls>
    <url name="releasenotes">https://www.suse.com/releasenotes/%{_target_cpu}/SLE-Micro/5.1/release-notes-sle-micro.rpm</url>
  </urls>
  <buildconfig>
    <producttheme>SUSE-MicroOS</producttheme>
  </buildconfig>
  <installconfig>
    <defaultlang>en_US</defaultlang>
    <releasepackage name="%{name}" flag="EQ" version="%{version}" release="%{release}"/>
    <distribution>SUSE</distribution>
  </installconfig>
  <runtimeconfig/>
</product>

EOF



%post
if [ -L /etc/products.d/baseproduct ] ; then
    PRODLINK=`readlink -f /etc/products.d/baseproduct`
    PRODLINK=`basename $PRODLINK`
    # bsc#1091952
    if [ $PRODLINK  == "SUSE-MicroOS.prod" -o $PRODLINK == "openSUSE.prod" ]; then
      ln -sf SUSE-MicroOS.prod /etc/products.d/baseproduct
    fi
    # bsc#1057321
elif [ ! -e /etc/products.d/baseproduct ]; then
    ln -sf SUSE-MicroOS.prod /etc/products.d/baseproduct
fi

# TBD: Verify that this is still needed for SLE 15..
# bsc#942519: remove hardcoded default valuex
if [ -f /etc/default/grub ] ; then
    sed -i -e 's|GRUB_DISTRIBUTOR=SLES12|GRUB_DISTRIBUTOR=|g' /etc/default/grub ||:
fi
# Put EULA into correct place
if [ ! -e %{product_license_dir}base ] ; then
          ln -sf SUSE-MicroOS %{product_license_dir}base
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 %{product_license_dir}
%dir %{product_license_dir}SUSE-MicroOS/
%dir /usr/lib/issue.d/
/usr/lib/issue.d/*-SUSE
%license %{product_license_dir}SUSE-MicroOS/license*txt
%{product_license_dir}SUSE-MicroOS/directory.yast

%changelog
openSUSE Build Service is sponsored by