File SLES_SAP-release.spec of Package 000release-packages
#
# spec file for package SLES_SAP-release
#
# Copyright (c) 2024 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 http://bugs.opensuse.org/
#
# old location  was /etc/YaST2/licenses/, see jsc#SLE-3067
%define product_license_dir /usr/share/licenses/product/
%if 0%{?beta_flag} == 1
%define betaversion %{current_milestone}
%endif
# hardcode productrelease to not change during a minor release (bsc#1252026)
%define         productversion %{version}
%define         productrelease 0
Name:           SLES_SAP-release
Summary:        SUSE Linux Enterprise Server for SAP applications 16.0
License:        MIT
Group:          System/Fhs
Version:        16.0
Release:        0
#BuildRequires:  skelcd-control-SLES_SAP
BuildRequires:  skelcd-SLES-SAP
BuildRequires:  skelcd-EULA-SLES-SAP
# in rare cases, 'ln' is not found...
Requires(post): (coreutils or busybox-coreutils)
Recommends:     issue-generator
# bsc#1078737#c7
# This is  coming from sles-release already.
Provides:       distribution-release
Provides:	branding
Conflicts:	otherproviders(branding)
Requires:   branding-SLE
Provides:       product(SUSE_SLE) = %{productversion}-%{productrelease}
# allow migration from 15, HA is bundled in SLES_SAP
Obsoletes:	sle-ha-release < 16.0
# old modules which are migratable to 16.0 should be obsoleted
Obsoletes:	sle-module-basesystem-release
Obsoletes:	sle-module-certifications-release
Obsoletes:	sle-module-containers-release
Obsoletes:	sle-module-desktop-applications-release
Obsoletes:	sle-module-development-tools-release
Obsoletes:	sle-module-legacy-release
Obsoletes:	sle-module-live-patching-release
Obsoletes:	sle-module-public-cloud-release
Obsoletes:	sle-module-python3-release
Obsoletes:	sle-module-sap-applications-release
Obsoletes:	sle-module-server-applications-release
Obsoletes:	sle-module-systems-management-release
Obsoletes:	sle-module-web-scripting-release
# bsc#1055299
Conflicts:      otherproviders(distribution-release)
Provides:       %name-%version
Provides:       product() = SLES_SAP
Provides:       product(SLES_SAP) = %{version}-%{release}
# If there is more than one product in the FTP tree, we need to give YaST/Agama a hint
Provides:       system-installation() = SLES_SAP
%ifarch x86_64
Provides:       product-register-target() = sle%%2D16%%2Dx86_64
%endif
%ifarch aarch64
Provides:       product-register-target() = sle%%2D16%%2Daarch64
%endif
%ifarch ppc64le
Provides:       product-register-target() = sle%%2D16%%2Dppc64le
%endif
Provides:       product-label() = SUSE%%20Linux%%20Enterprise%%20Server%%20for%%20SAP%%20Applications
Provides:       product-cpeid() = cpe%%3A%%2Fo%%3Asuse%%3Asles_sap%%3A16.0
Provides:       product-url(releasenotes) = https%%3A%%2F%%2Fwww.suse.com%%2Freleasenotes%%2F%{_target_cpu}%%2FSLE%%2DSAP%%2F16.0%%2Frelease%%2Dnotes%%2Dsles%%2Dsap.rpm
Provides:       product-endoflife() = 2030%%2D11%%2D30
# ./.
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
# this package should only be available for the "basearchs" of a product
ExclusiveArch:  x86_64 ppc64le aarch64
Source100:      weakremovers.inc
%include %{SOURCE100}
%description
SUSE Linux Enterprise Server for SAP Applications 16.0
%prep
%setup -qcT
mkdir license
if [ -f /CD1/license.tar.gz ]; then
  tar -C license -xzf /CD1/license.tar.gz
elif [ -f %{_prefix}/lib/skelcd/CD1/license.tar.gz ]; then
  tar -C license -xzf %{_prefix}/lib/skelcd/CD1/license.tar.gz
fi
%build
%install
mkdir -p %{buildroot}%{_sysconfdir} %{buildroot}%{_prefix}/lib/issue.d %{buildroot}/run
echo -e "\nWelcome to SUSE Linux Enterprise Server for SAP applications %{version}%{?betaversion: %{betaversion}}  (%{_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
#%if 0%{?betaversion}
#echo -e "This is an early sneak preview release  not intended for production environment.\n" > %{buildroot}%{_prefix}/lib/issue.d/90-ALP.conf
#%endif
# Removed since SLES4SAP must have the same os-release as SLES to not break SAP certifications.
# We will copy it manually until we have a final agreement about the certification process
# CREATE_OS_RELEASE_FILE
mkdir -p %{buildroot}%{_sysconfdir}
cat >%{buildroot}%{_sysconfdir}/os-release << EOF
# The NAME and PRETTY_NAME fields have been chosen to state compatibility between our products.
# The use of "SLES" and "SUSE Linux Enterprise" rather than a more generic name is due to backward compatibility with existing OS detection code in applications of third party vendors.
NAME="SLES"
PRETTY_NAME="SUSE Linux Enterprise Server %{version}"
VARIANT="Enterprise Server for SAP applications"
VARIANT_ID="server-sap"
VERSION="%{version}%{?betaversion: %{betaversion}}"
VERSION_ID="%{version}"
ANSI_COLOR="0;32"
ID="sles"
ID_LIKE="suse opensuse"
CPE_NAME="cpe:/o:suse:sles:16:%{version}"
SUSE_SUPPORT_PRODUCT="SUSE Linux Enterprise Server for SAP applications"
SUSE_SUPPORT_PRODUCT_VERSION="%{version}"
EOF
mv  %{buildroot}%{_sysconfdir}/os-release %{buildroot}%{_prefix}/lib/os-release
ln -s ..%{_prefix}/lib/os-release %{buildroot}%{_sysconfdir}/os-release
cat << EOF >> $RPM_BUILD_ROOT/%{_prefix}/lib/os-release
HOME_URL="https://www.suse.com/products/server/"
DOCUMENTATION_URL="https://documentation.suse.com/sles-sap/16.0/"
LOGO="distributor-logo"
EOF
cat << EOF > $RPM_BUILD_ROOT/%{_sysconfdir}/SUSE-brand
VERSION=%{version}
GRUB_OS_ID="SLES for SAP %{version}"
EOF
mkdir -p %{buildroot}%{_prefix}/lib/motd.d/
echo "Have a lot of fun..." > %{buildroot}%{_prefix}/lib/motd.d/welcome
# enable vendor change openSUSE,SUSE for DUP from 15.3 to TW (boo#1198332)
mkdir -p %{buildroot}%{_sysconfdir}/zypp/vendors.d
echo -e "[main]\nvendors=openSUSE,SUSE,SUSE LLC <https://www.suse.com/>\n" > %{buildroot}%{_sysconfdir}/zypp/vendors.d/00-SUSE.conf
# fate#319341, make openSUSE-release own YaST license files. TODO:
# get rid of /etc/YaST2/licenses
install -D -d -m 755 "%{buildroot}%_defaultlicensedir/product/base"
install -D -d -m 755 "%{buildroot}%_defaultlicensedir"
cp -a license "%{buildroot}%_defaultlicensedir/%name"
pushd license
for i in *; do
	ln -s "%_defaultlicensedir/%name/$i" %{buildroot}%_defaultlicensedir/product/base/$i
done
mkdir -p %{buildroot}%{_sysconfdir}/products.d
cat >%{buildroot}%{_sysconfdir}/products.d/SLES_SAP.prod << EOF
<?xml version="1.0" encoding="UTF-8"?>
<product schemeversion="0">
  <vendor>SUSE</vendor>
  <name>SLES_SAP</name>
  <version>%{productversion}</version>
  <release>%{productrelease}</release>
  <endoflife>2030-11-30</endoflife>
  <arch>%{_target_cpu}</arch>
  <cpeid>cpe:/o:suse:sles:16:16.0:server-sap</cpeid>
  <productline>SLES_SAP</productline>
  <codestream>
    <name>SUSE Linux Enterprise Server for SAP Applications 16</name>
    <endoflife>2035-11-30</endoflife>
  </codestream>
  <register>
    <pool>
      <repository project="SUSE:Products:SLES_SAP:16.0:x86_64" name="images" medium="product" arch="x86_64">
        <zypp name="SLES-SAP-16.0-Pool" alias="SLES-SAP-16.0-Pool"/>
      </repository>
      <repository project="SUSE:Products:SLES_SAP:16.0:aarch64" name="images" medium="product" arch="aarch64">
        <zypp name="SLES-SAP-16.0-Pool" alias="SLES-SAP-16.0-Pool"/>
      </repository>
      <repository project="SUSE:Products:SLES_SAP:16.0:ppc64le" name="images" medium="product" arch="ppc64le">
        <zypp name="SLES-SAP-16.0-Pool" alias="SLES-SAP-16.0-Pool"/>
      </repository>
      <repository project="SUSE:Products:SLES_SAP:16.0:x86_64" name="images" medium="product_debug" arch="x86_64">
        <zypp name="SLES-SAP-16.0-Debuginfo-Pool" alias="SLES-SAP-16.0-Debuginfo-Pool"/>
      </repository>
      <repository project="SUSE:Products:SLES_SAP:16.0:aarch64" name="images" medium="product_debug" arch="aarch64">
        <zypp name="SLES-SAP-16.0-Debuginfo-Pool" alias="SLES-SAP-16.0-Debuginfo-Pool"/>
      </repository>
      <repository project="SUSE:Products:SLES_SAP:16.0:ppc64le" name="images" medium="product_debug" arch="ppc64le">
        <zypp name="SLES-SAP-16.0-Debuginfo-Pool" alias="SLES-SAP-16.0-Debuginfo-Pool"/>
      </repository>
      <repository project="SUSE:Products:SLES_SAP:16.0:x86_64" name="images" medium="product_source" arch="x86_64">
        <zypp name="SLES-SAP-16.0-Source-Pool" alias="SLES-SAP-16.0-Source-Pool"/>
      </repository>
      <repository project="SUSE:Products:SLES_SAP:16.0:aarch64" name="images" medium="product_source" arch="aarch64">
        <zypp name="SLES-SAP-16.0-Source-Pool" alias="SLES-SAP-16.0-Source-Pool"/>
      </repository>
      <repository project="SUSE:Products:SLES_SAP:16.0:ppc64le" name="images" medium="product_source" arch="ppc64le">
        <zypp name="SLES-SAP-16.0-Source-Pool" alias="SLES-SAP-16.0-Source-Pool"/>
      </repository>
    </pool>
    <updates>
      <distrotarget arch="x86_64">sle-16-x86_64</distrotarget>
      <distrotarget arch="aarch64">sle-16-aarch64</distrotarget>
      <distrotarget arch="ppc64le">sle-16-ppc64le</distrotarget>
    </updates>
  </register>
  <repositories>
%ifarch x86_64
      <repository type="pool" repoid="obsproduct://build.suse.de/SUSE:Products:SLES_SAP:16.0:x86_64/SLES_SAP/16.0/%{_target_cpu}" />
%endif
%ifarch aarch64
      <repository type="pool" repoid="obsproduct://build.suse.de/SUSE:Products:SLES_SAP:16.0:aarch64/SLES_SAP/16.0/%{_target_cpu}" />
%endif
%ifarch ppc64le
      <repository type="pool" repoid="obsproduct://build.suse.de/SUSE:Products:SLES_SAP:16.0:ppc64le/SLES_SAP/16.0/%{_target_cpu}" />
%endif
  </repositories>
  <summary>SUSE Linux Enterprise Server for SAP Applications 16.0</summary>
  <shortsummary>SUSE Linux Enterprise Server for SAP Applications</shortsummary>
  <description>SUSE Linux Enterprise Server for SAP Applications 16.0</description>
  <linguas>
    <language>en</language>
  </linguas>
  <urls>
    <url name="releasenotes">https://www.suse.com/releasenotes/%{_target_cpu}/SLE-SAP/16.0/release-notes-sles-sap.rpm</url>
  </urls>
  <buildconfig>
    <producttheme>SLES_SAP</producttheme>
    <betaversion>RC</betaversion>
  </buildconfig>
  <installconfig>
    <defaultlang>en_US</defaultlang>
    <releasepackage name="%{name}" flag="EQ" version="%{version}" release="%{release}"/>
    <distribution>SUSE_SLE</distribution>
  </installconfig>
  <runtimeconfig/>
  <productdependency relationship="requires" name="SLES_SAP" baseversion="16.0" flag="EQ"/>
</product>
EOF
# this is a base product, create symlink
ln -sf SLES_SAP.prod %{buildroot}%{_sysconfdir}/products.d/baseproduct
%posttrans
# Launch the issue-generator: we have a new config file in /usr/lib/issue.d that needs to be represented
if [ -x %{_sbindir}/issue-generator ]; then
    if [ -x %{_bindir}/systemd-tmpfiles ]; then
      %{_bindir}/systemd-tmpfiles --create issue-generator.conf || :
    fi
    %{_sbindir}/issue-generator || :
fi
%files
%defattr(644,root,root,755)
%dir %_defaultlicensedir/product
%_defaultlicensedir/product/base
%license license/*
%{_sysconfdir}/os-release
%{_sysconfdir}/SUSE-brand
%{_prefix}/lib/os-release
%dir %{_sysconfdir}/zypp
%dir %{_sysconfdir}/zypp/vendors.d
%config %{_sysconfdir}/zypp/vendors.d/00-SUSE.conf
%{_prefix}/lib/motd.d/welcome
%{_prefix}/lib/issue.d
%{_sysconfdir}/products.d
%changelog