File SLES-release.spec of Package 000product

#
# spec file for package sles-release (Version 15-SP0)
#
# Copyright (c) 2016 SUSE LINUX Products 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/
#

# norootforbuild


Name:           sles-release
Summary:        ___SUMMARY___ ___BETA_VERSION___
Version:        ___VERSION___
Release:        0
License:        GPL-2.0+
Group:          System/Fhs
BuildRequires:  skelcd-control-SLES
BuildRequires:  skelcd-EULA-sles
Recommends:     branding
# in rare cases, 'ln' is not found...
Requires(post): coreutils
Requires:	issue-generator
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
Provides: displayorder(200)

# only one base product
Conflicts:	sled-release
Conflicts:	leanos-release

# bsc#1049164
Obsoletes:	leanos-release
Conflicts:	leanos-release


___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.

# ./.


AutoReqProv:    on
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 ppc64le s390x aarch64

%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\n" > $RPM_BUILD_ROOT/usr/lib/issue.d/00-OS
echo "\n" >  $RPM_BUILD_ROOT/usr/lib/issue.d/90-OS


# 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

# Bug 409980 - /etc/YaST/control.xml should be owned by some package
mkdir -p $RPM_BUILD_ROOT/etc/YaST2/
cp -av /usr/lib/skelcd/CD1/control.xml $RPM_BUILD_ROOT/etc/YaST2/

# Put EULA into correct place
mkdir -p $RPM_BUILD_ROOT//etc/YaST2/licenses/SLES
cd $RPM_BUILD_ROOT//etc/YaST2/licenses/SLES
tar -xf /usr/lib/skelcd/CD1/license.tar.gz  # --overwrite
echo "directory.yast" > directory.yast
ls lic* > directory.yast



___CREATE_OS_RELEASE_FILE___

___CREATE_PRODUCT_FILES___

%post
if [ -L /etc/products.d/baseproduct ] ; then
    PRODLINK=`readlink -f /etc/products.d/baseproduct`
    PRODLINK=`basename $PRODLINK`
        if [ $PRODLINK  == "SUSE_SLES.prod" ]; then 
          ln -sf SLES.prod /etc/products.d/baseproduct
    fi
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 /etc/YaST2/licenses/base ] ; then
          ln -sf SLES /etc/YaST2/licenses/base
fi

%clean
rm -rf %buildroot

%files
%defattr(644,root,root,755)
%config /etc/os-release
%dir /etc/products.d
/etc/products.d/*
%dir /etc/YaST2/
%config /etc/YaST2/control.xml
%config /etc/rpm/macros.sle
%config(noreplace) /etc/motd
%dir /etc/YaST2/licenses/
%dir /etc/YaST2/licenses/SLES/
%dir /usr/lib/issue.d/
/usr/lib/issue.d/*-OS
# not sure about the %doc here.
%doc /etc/YaST2/licenses/SLES/license*txt
%doc /etc/YaST2/licenses/SLES/directory.yast

%changelog
openSUSE Build Service is sponsored by