File Leap-Micro-release.spec.in of Package 000package-groups

#
# 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:           Leap-Micro-release
Summary:        ___SUMMARY___ ___BETA_VERSION___
License:        MIT
Group:          System/Fhs
Version:        ___VERSION___
Release:        0
#BuildRequires:  skelcd-EULA-SMO
BuildRequires:  skelcd-openSUSE
BuildRequires:  skelcd-control-SMO
Recommends:     branding
# in rare cases, 'ln' is not found...
Requires(post): coreutils
Recommends:     issue-generator
# bsc#1078737#c7
Recommends:     release-notes-leap-micro
Provides:       distribution-release
Provides:       product(Leap-Micro) = %{version}-%{release}
#Provides:       product(SUSE_SLE-SP___PATCH_LEVEL___) = %{version}-%{release}
Provides:	system-installation() = Leap-Micro
# relaxes openSUSE/SUSE vendor change in zypper dup bsc#1182629
Provides:       dup-vendor-relax(suse)

# bsc#1055299
Conflicts:      otherproviders(distribution-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

# 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
___DESCRIPTION___

___FLAVOR_PACKAGES___



%prep
%setup -qcT
mkdir license
tar -C license -xzf %{_libexecdir}/skelcd/CD1/license.tar.gz

%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
# XXX this wrong. Needs to be in rpm-config-SUSE
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

mkdir -p %{buildroot}%{_prefix}/lib
cat > %{buildroot}%{_prefix}/lib/os-release <<EOF
NAME="openSUSE Leap Micro"
VERSION="%{version}%{?betaversion:%{betaversion}}"
ID="opensuse-leap-micro"
ID_LIKE="suse opensuse opensuse-leap suse-microos"
VERSION_ID="%{version}"
PRETTY_NAME="openSUSE Leap Micro %{version}%{?betaversion:%{betaversion}}"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:opensuse:leap-micro:%{version}"
BUG_REPORT_URL="https://bugs.opensuse.org"
HOME_URL="https://www.opensuse.org/"
DOCUMENTATION_URL="https://en.opensuse.org/Portal:LeapMicro"
LOGO="distributor-logo-LeapMicro"
EOF

ln -s ..%{_prefix}/lib/os-release %{buildroot}%{_sysconfdir}/os-release
#mv $RPM_BUILD_ROOT/etc/os-release $RPM_BUILD_ROOT/usr/lib/os-release 

install -D -d -m 755 "%{buildroot}%{_datadir}/licenses/product/base"
install -D -d -m 755 "%{buildroot}%{_defaultlicensedir}"
cp -a license "%{buildroot}%{_defaultlicensedir}/%{name}"
pushd license
# SLE compat
for i in *; do
	ln -s "%{_defaultlicensedir}/%{name}/$i" %{buildroot}%{_datadir}/licenses/product/base/$i
done



___CREATE_PRODUCT_FILES___

# enable vendor change openSUSE,SUSE
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-openSUSE.conf
%post
# this is a base product, create symlink  bsc#1091952
if [ ! -L %{_sysconfdir}/products.d/baseproduct ]; then
	ln -sf Leap-Micro.prod %{_sysconfdir}/products.d/baseproduct
fi

%files
%defattr(644,root,root,755)
%{_sysconfdir}/os-release
%{_prefix}/lib/os-release
%config(noreplace) %{_sysconfdir}/zypp/vendors.d/00-openSUSE.conf
%dir /etc/products.d
%ghost /etc/products.d/baseproduct
/etc/products.d/*
%config /etc/rpm/macros.sle
%config(noreplace) /etc/motd
%dir /usr/lib/issue.d/
/usr/lib/issue.d/*-SUSE
%dir %{product_license_dir}
%{product_license_dir}/base
%license license/*

%changelog
openSUSE Build Service is sponsored by