File EOS-Embedded-release.spec of Package release-packages

#
# spec file for package EOS-Embedded-release
#
# Copyright (c) 2023 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 EOS-Embedded
Name:           %{product}-release
Summary:        SUSE EOS Embedded 0.1
License:        MIT
Group:          System/Fhs
Version:        0.1
Release:        0
Recommends:     branding
# in rare cases, 'ln' is not found...
Requires(post): coreutils
Recommends:     issue-generator
# bsc#1078737#c7
Recommends:     release-notes-eos-Embedded
Provides:       distribution-release
Provides:       product(%{product}) = %{version}-%{release}
Provides:       system-installation() = %{product}

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

Provides:       %name-%version
Provides:       product() = EOS-Embedded
Provides:       product(EOS-Embedded) = 0.1
Provides:       product-label() = SUSE%20EOS%20Embedded
Provides:       product-cpeid() = cpe%3A%2Fo%3Asuse%3Aeos%2DEmbedded%3A0.1
Provides:       product-url(releasenotes) = https%3A%2F%2Fwww.suse.com%2Freleasenotes%2F%{_target_cpu}%2FEOS%2DEmbedded%2F0.1%2Frelease%2Dnotes%2Deos%2DEmbedded.rpm
%ifarch x86_64
Provides:       product-updates-repoid() = obsrepository%3A%2F%2Fbuild.suse.de%2FSUSE%3AUpdates%3AEOS%2DEmbedded%3A0.1%3Ax86_64%2Fupdate
%endif
%ifarch s390x
Provides:       product-updates-repoid() = obsrepository%3A%2F%2Fbuild.suse.de%2FSUSE%3AUpdates%3AEOS%2DEmbedded%3A0.1%3As390x%2Fupdate
%endif
%ifarch aarch64
Provides:       product-updates-repoid() = obsrepository%3A%2F%2Fbuild.suse.de%2FSUSE%3AUpdates%3AEOS%2DEmbedded%3A0.1%3Aaarch64%2Fupdate
%endif
%ifarch ppc64le
Provides:       product-updates-repoid() = obsrepository%3A%2F%2Fbuild.suse.de%2FSUSE%3AUpdates%3AEOS%2DEmbedded%3A0.1%3Appc64le%2Fupdate
%endif
%ifarch x86_64
Provides:       product-updates-repoid() = obsrepository%3A%2F%2Fbuild.suse.de%2FSUSE%3AUpdates%3AEOS%2DEmbedded%3A0.1%3Ax86_64%2Fupdate_debug
%endif
%ifarch s390x
Provides:       product-updates-repoid() = obsrepository%3A%2F%2Fbuild.suse.de%2FSUSE%3AUpdates%3AEOS%2DEmbedded%3A0.1%3As390x%2Fupdate_debug
%endif
%ifarch aarch64
Provides:       product-updates-repoid() = obsrepository%3A%2F%2Fbuild.suse.de%2FSUSE%3AUpdates%3AEOS%2DEmbedded%3A0.1%3Aaarch64%2Fupdate_debug
%endif
%ifarch ppc64le
Provides:       product-updates-repoid() = obsrepository%3A%2F%2Fbuild.suse.de%2FSUSE%3AUpdates%3AEOS%2DEmbedded%3A0.1%3Appc64le%2Fupdate_debug
%endif
Provides:       product-endoflife() = 2026%2D10%2D31

# 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
ExclusiveArch:  x86_64 ppc64le s390x aarch64

Source100:      weakremovers.inc
%include %{SOURCE100}

%description
SUSE EOS Embedded 0.1

%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 EOS Embedded 0.1 (%{_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

mkdir -p %{buildroot}%{_sysconfdir}
cat >%{buildroot}%{_sysconfdir}/os-release << EOF
NAME="EOS-Embedded"
VERSION="%{version}%{?betaversion: %{betaversion}}"
VERSION_ID="%{version}"
PRETTY_NAME="SUSE EOS Embedded 0.1%{?betaversion: (%{betaversion})}"
ID="eos-Embedded"
ID_LIKE="suse"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:suse:eos-Embedded:0.1"
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://susealp.io/"
DOCUMENTATION_URL="https://documentation.suse.com/#alp"
LOGO="distributor-logo"
EOF

mkdir -p %{buildroot}%{_prefix}/lib/motd.d/
echo "Have a lot of fun..." > %{buildroot}%{_prefix}/lib/motd.d/welcome
## Bug 404141 - /etc/YaST/control.xml should be owned by some package
mkdir -p %{buildroot}%{_sysconfdir}/YaST2/
echo %{buildroot}
if [ -f /CD1/control.xml ]; then
  install -m 644 /CD1/control.xml %{buildroot}%{_sysconfdir}/YaST2/
elif [ -f %{_prefix}/lib/skelcd/CD1/control.xml ]; then
  install -m 644 %{_prefix}/lib/skelcd/CD1/control.xml %{buildroot}%{_sysconfdir}/YaST2/
fi

# 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-openSUSE.conf


# No license for EOS yet
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/EOS-Embedded.prod << EOF
<?xml version="0.1" encoding="UTF-8"?>
<product schemeversion="0">
  <vendor>SUSE</vendor>
  <name>EOS-Embedded</name>
  <version>0.1</version>
  <release>1</release>
  <endoflife>2026-10-31</endoflife>
  <arch>%{_target_cpu}</arch>
  <cpeid>cpe:/o:suse:eos-Embedded:0.1</cpeid>
  <productline>EOS-Embedded</productline>
  <codestream>
    <name>EOS Embedded 0.1</name>
    <endoflife>2026-10-31</endoflife>
  </codestream>
  <summary>SUSE EOS Embedded 0.1</summary>
  <shortsummary>SUSE EOS Embedded</shortsummary>
  <description>SUSE EOS Embedded 0.1</description>
  <linguas>
    <language>en</language>
  </linguas>
  <urls>
    <url name="releasenotes">https://www.suse.com/releasenotes/%{_target_cpu}/EOS-Embedded/0.1/release-notes-eos-Embedded.rpm</url>
  </urls>
  <buildconfig>
    <producttheme>EOS-Embedded</producttheme>
    <betaversion>Milestone2</betaversion>
  </buildconfig>
  <installconfig>
    <defaultlang>en_US</defaultlang>
    <releasepackage name="%{name}" flag="EQ" version="%{version}" release="%{release}"/>
    <distribution>SUSE</distribution>
  </installconfig>
  <runtimeconfig/>
</product>
EOF

# this is a base product, create symlink
ln -s %{product}.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
%{_prefix}/lib/os-release
# Bug 404141 - /etc/YaST/control.xml should be owned by some package
# No control file for the time being
# %dir %{_sysconfdir}/YaST2/
# %config %{_sysconfdir}/YaST2/control.xml
%dir %{_sysconfdir}/zypp
%dir %{_sysconfdir}/zypp/vendors.d
%config %{_sysconfdir}/zypp/vendors.d/00-openSUSE.conf
%{_prefix}/lib/motd.d/welcome
%{_prefix}/lib/issue.d
%{_sysconfdir}/products.d

%changelog
openSUSE Build Service is sponsored by