File SLES_BCL-release.spec.in of Package 000package-groups

#
# spec file for package SLES_BCL
#
# 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:           SLES_BCL-release
Summary:        ___SUMMARY___ ___BETA_VERSION___
License:        MIT
Group:          System/Fhs
Version:        ___VERSION___
Release:        0
# We are a SLES bundle and do not use our own EULA (checked with Legal and PM - see 15SP1)
# 	skelcd-sles request 210291 added
#	- Generate SLES_BCL EULA package, using the same EULA as SLES.
#	This is the more elgant way to solve the issue of BCL license!
BuildRequires:  skelcd-EULA-SLES_BCL
Recommends:     branding
#!BuildIgnore:	SLES_BCL-installation-release

# Included on the Project Config until resolve the future of SLES_BCL-installation-release package.
# Prefer: sles-release

# in rare cases, 'ln' is not found...
Requires(post): coreutils
Recommends:     issue-generator
# bsc#1078737#c7
# Recommends:     release-notes-sles-bcl
# we go with SLES release notes - BCL is a BUNDLE, we do not change SLES besides Metadata
Recommends:     release-notes-sles

# This is coming from sles-release already.
Provides:       distribution-release

Provides:       product(SUSE_SLE) = %{version}-%{release}
Provides:       product(SUSE_SLE-SP___PATCH_LEVEL___) = %{version}-%{release}

# used by yast to show where the product will be shown during installation.
# lowest number will be top-most
# set displayorder 5 to show first if visible at all 
Provides:       displayorder(5)
# hide/enable base products on install on boot commandline (see FATE#327099#c5 )
# use "specialproduct=SLES_BCL" to show/enable BCL during install
# general use "specialproduct=<product_name>"
Provides:	specialproduct(SLES_BCL)
# bsc#1055299
Conflicts:      otherproviders(distribution-release)

# bsc#1049164
Obsoletes:      leanos-release

#bsc#1071720
Obsoletes:      SLES_BCL-release-DVD  < 15
Obsoletes:      SLES_BCL-release-MINI < 15
Obsoletes:      SLES_BCL-release-POOL < 15

#bsc#1076598
Obsoletes:      SUSE_SLES_BCL-release < 15
Obsoletes:      sles-release < %{version}
Obsoletes:      sles-release-DVD  < 15
Obsoletes:      sles-release-MINI < 15
Obsoletes:      sles-release-POOL < 15

___PRODUCT_PROVIDES___

___PRODUCT_DEPENDENCIES___

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

# 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:  i586 x86_64

Source100:      weakremovers.inc
%include %{SOURCE100}

%description
___DESCRIPTION___


___FLAVOR_PACKAGES___

%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 ___SUMMARY___ ___BETA_VERSION___ (%{_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}SLES_BCL
cd $RPM_BUILD_ROOT/%{product_license_dir}SLES_BCL
# We are a SLES bundle and do not use our own license (checked with Legal and PM - see 15SP1)
# skelcd-sles generates SLES_BCL EULA package, using the same EULA as SLES.
tar -xf /usr/lib/skelcd/CD1/license-SLES_BCL.tar.gz  # --overwrite
echo "directory.yast" > directory.yast
ls lic* > directory.yast

# Removed since SLES BCL must have the same os-release as SLES to not break certifications.
# We will copy it manually until we have a final agreement about the certification process
# CREATE_OS_RELEASE_FILE

mkdir -p $RPM_BUILD_ROOT/etc
cat >$RPM_BUILD_ROOT/etc/os-release << EOF
NAME="SLES"
VERSION="15-SP2%{?betaversion: }%{?betaversion}"
VERSION_ID="%{version}%{?betaversion?: }%{?betaversion}"
PRETTY_NAME="SUSE Linux Enterprise Server 15 SP2"
ID="sles"
ID_LIKE="suse"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:suse:sles:15:sp2"
EOF

___CREATE_PRODUCT_FILES___

%post
# Change the symlink to SLES BCL prod file.
if [ -L /etc/products.d/baseproduct ] ; then
  rm -f /etc/products.d/baseproduct
  ln -sf SLES_BCL.prod /etc/products.d/baseproduct
  # bsc#1065272
elif [ ! -e /etc/products.d/baseproduct ]; then
  ln -sf SLES_BCL.prod /etc/products.d/baseproduct
fi

# Put EULA into correct place
if [ ! -e %{product_license_dir}base ] ; then
          ln -sf SLES_BCL %{product_license_dir}base
fi

%files
%defattr(644,root,root,755)
%config /etc/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}SLES_BCL/
%dir /usr/lib/issue.d/
/usr/lib/issue.d/*-SUSE
%license %{product_license_dir}SLES_BCL/license*txt
%{product_license_dir}SLES_BCL/directory.yast

%changelog
openSUSE Build Service is sponsored by