File SUSE-Manager-Server-release.spec.in of Package 000package-groups

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


%define PRODUCT SUSE-Manager-Server
%define CONTROL SUMA
%define product suse-manager-server

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


Name:           %{PRODUCT}-release
Summary:        ___SUMMARY___ ___BETA_VERSION___
License:        MIT
Group:          System/Fhs
Version:        ___VERSION___
Release:        0
# BuildRequires:  skelcd-control-%{CONTROL}
BuildRequires:  skelcd-EULA-%{product}
Recommends:     branding
# in rare cases, 'ln' is not found...
Requires(post): coreutils
Recommends:     issue-generator
Provides:       distribution-release
Provides:       product(SUSE_SLE) = %{version}-%{release}
Provides:       product(SUSE_SLE-SP___PATCH_LEVEL___) = %{version}-%{release}

# Make sure the correct release notes are installed (bsc#1099771, bsc#1096244):
Recommends:     release-notes-susemanager
# used by yast to show where the product will be shown during installation.
# lowest number will be top-most
Provides:       displayorder(550)

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

# bsc#1049164
Obsoletes:      leanos-release

#bsc#1071720
Obsoletes:      %{product}-release-DVD  < 15
Obsoletes:      %{product}-release-MINI < 15
Obsoletes:      %{product}-release-POOL < 15
Obsoletes:      sles-release-DVD  < 15
Obsoletes:      sles-release-MINI < 15
Obsoletes:      sles-release-POOL < 15
# bsc#1086734
Obsoletes:      SUSE-Manager-Server-release-POOL < 4.0
# bsc#1086734 comment #53
Provides:       product:SUSE-Manager-Server = %{version}
Obsoletes:      product:SUSE-Manager-Server < %{version}
# bsc#1089736 comment #13 and bsc#1130979
Obsoletes:      product:SLES < 15.1
Obsoletes:      sles-release < 15.1

___PRODUCT_PROVIDES___

___PRODUCT_DEPENDENCIES___

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

BuildRoot:      %{_tmppath}/%{name}-%{version}-build
# this package should only be available for the "basearchs" of a product
ExclusiveArch:  x86_64 s390x ppc64le

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}%{PRODUCT}
cd $RPM_BUILD_ROOT/%{product_license_dir}%{PRODUCT}
tar -xf /usr/lib/skelcd/CD1/license-%{PRODUCT}.tar.gz  # --overwrite
echo "directory.yast" > directory.yast
ls lic* > directory.yast

# Removed because we do not want to loose any certifications.
# CREATE_OS_RELEASE_FILE

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

___CREATE_PRODUCT_FILES___

%post
if [ -L /etc/products.d/baseproduct ] ; then
    PRODLINK=`readlink -f /etc/products.d/baseproduct`
    PRODLINK=`basename $PRODLINK`
    if [ $PRODLINK  == "SLES.prod" ]; then
      ln -sf %{PRODUCT}.prod /etc/products.d/baseproduct
    fi
    # bsc#1057321
elif [ ! -e /etc/products.d/baseproduct ]; then
    ln -sf %{PRODUCT}.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 %{PRODUCT} %{product_license_dir}base
fi

%posttrans
# need a posttrans due to bsc#1089736
if [ ! -e /etc/products.d/baseproduct ]; then
    ln -sf %{PRODUCT}.prod /etc/products.d/baseproduct
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}%{PRODUCT}/
%dir /usr/lib/issue.d/
/usr/lib/issue.d/*-SUSE
%license %{product_license_dir}%{PRODUCT}/license*txt
%{product_license_dir}%{PRODUCT}/directory.yast

%changelog
openSUSE Build Service is sponsored by