File openSUSE-Education-release.spec of Package opensuse-education-release

#
# spec file for package openSUSE-Education-release
#
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#

# norootforbuild

%define     opensuse_version unknown
%if 0%{?suse_version} == 01120
%define     opensuse_version 11.2
%endif
%if 0%{?suse_version} == 01130
%define     opensuse_version 11.3
%endif
%if 0%{?suse_version} == 01140
%define     opensuse_version 11.4
%endif
%if 0%{?suse_version} == 01210
%define     opensuse_version 12.1
%endif
%if 0%{?suse_version} == 01220
%define     opensuse_version 12.2
%endif
%if 0%{?suse_version} == 01230
%define     opensuse_version 12.3
%endif
%if 0%{?suse_version} == 01310
%define     opensuse_version 13.1
%endif
%if 0%{?suse_version} == 01315
%define     opensuse_version 42.1
%endif
%if 0%{?suse_version} == 01320
%define     opensuse_version 13.2
%endif
%if 0%{?suse_version} == 01500
%define     opensuse_version 15.0
%endif
%if 0%{?suse_version} == 01510
%define     opensuse_version 15.1
%endif
%if 0%{?suse_version} == 01520
%define     opensuse_version 15.2
%endif
%if 0%{?suse_version} > 01530
%define     opensuse_version Factory
%endif

Name:           openSUSE-Education-release
Summary:        Product version files for openSUSE-Education
Version:        1.0
Release:        2
License:        BSD-3-Clause
Group:          System/Fhs
Vendor:         openSUSE-Education
AutoReqProv:    on
%if 0%{?suse_version} > 1100
Provides:       %name-%version
Provides:       product()
Provides:       product(openSUSE-Education) = 1.0-0
Provides:       product(openSUSE-Education-0) = 1.0-0
Provides:       product(openSUSE-Education-SP0) = 1.0-0
Requires:       product_flavor(openSUSE-Education) = 1.0
%endif
Source0:        openSUSE-Education-release-rpmlintrc
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%define         is_beta 1
%define         betaversion RC1

%description
This package contains some files useful for later updates and upgrades 
of the openSUSE-Education add on.

Authors:
--------
    Lars Vogdt


%if 0%{?suse_version} > 1100
%package DVD
License:        BSD-3-Clause
Group:          System/Fhs
Provides:       product_flavor()
Provides:       product_flavor(openSUSE-Education) = 1.0-0
Provides:       flavor(DVD)
Requires:       product(openSUSE) = %opensuse_version
Summary:        openSUSE Education Add on

%description DVD
This package contains some files useful for later updates and upgrades
of the openSUSE-Education add on.

Authors:
--------
    Lars Vogdt
%endif


%prep

%build

%install
mkdir -p $RPM_BUILD_ROOT/%{_defaultdocdir}/openSUSE-Education-release-DVD
cat >$RPM_BUILD_ROOT/%{_defaultdocdir}/openSUSE-Education-release-DVD/README << EOF
This package just exist just for providing the product flavor 'DVD'.

EOF

mkdir -p $RPM_BUILD_ROOT/etc
#
# create a human readable release file in /etc
#
RELEASEFILE="$RPM_BUILD_ROOT/etc/openSUSE-Education-release"
%if 0%{?is_beta}
echo "openSUSE-Education" > $RELEASEFILE
%else
echo "openSUSE-Education %{betaversion}" > $RELEASEFILE
%endif
echo "VERSION = %{version}" >> $RELEASEFILE
echo "RELEASE = %{release}" >> $RELEASEFILE

%if 0%{?suse_version} > 1030 && 0%{?suse_version} < 1110
#
# create a product file for zypper/YaST
#
mkdir -p $RPM_BUILD_ROOT/etc/zypp/products.d/
PRODUCTSFILE="$RPM_BUILD_ROOT/etc/zypp/products.d/openSUSE-Education-release.prod"
echo "[openSUSE-Education %{version} %arch]" >> $PRODUCTSFILE
echo "name=openSUSE-Education" >> $PRODUCTSFILE
echo "version=%{version} %{betaversion}" >> $PRODUCTSFILE
echo "release=%{release}" >> $PRODUCTSFILE
echo "flavor=online" >> $PRODUCTSFILE
echo >> $PRODUCTSFILE
echo "[update]" >> $PRODUCTSFILE
# echo "url=http://download.opensuse-education.org/updates/1.0/%opensuse_version" >> $PRODUCTSFILE
echo "url=http://download.opensuse.org/update/leap/%opensuse_version/oss/" >> $PRODUCTSFILE
echo >> $PRODUCTSFILE
%endif
%if 0%{?suse_version} > 1100
mkdir -p $RPM_BUILD_ROOT/etc/products.d/
REPOFILE=$RPM_BUILD_ROOT/etc/products.d/%name.prod
cat > $REPOFILE << EOF
<?xml version="1.0" encoding="UTF-8"?>
<product id="openSUSE-Education" schemeversion="0">
    <vendor>openSUSE-Education</vendor>
    <name>openSUSE-Education</name>
    <version>%{version}</version>
    <patchlevel>0</patchlevel>
    <release>0</release>
    <arch>%{_target_cpu}</arch>
    <productline>SUSE</productline>
    <updaterepokey>osedu%{opensuse_version}</updaterepokey>
    <summary>The openSUSE-Education Add-on</summary>
    <description>The openSUSE-Education Add-on provides a huge amount of packages
    for use in educational environments.</description>
    <urls>
      <url name="bugtracker">http://bugzilla.opensuse.org/</url>
      <!-- 
      <url name="releasenotes">http://download.opensuse-education.org/relnotes/%{version}/%{opensuse_version}/release-notes-edu.rpm</url>
      <url name="updates">http://download.opensuse-education.org/updates/%{version}/%{opensuse_version}/</url>
      <url name="repository">http://download.opensuse-education.org/repo/%{version}/%{opensuse_version}/</url>
      -->
    </urls>
%if 0%{?is_beta}
    <buildconfig producttheme="SUSE" />
%else
    <buildconfig producttheme="SUSE" betaversion="%{betaversion}" />
%endif
    <installconfig defaultlang="en_US" datadir="suse" descriptiondir="suse/setup/descr">
        <releasepackage name="%name" version="%version" flag="EQ"/>
        <distribution>openSUSE</distribution>
    </installconfig>
    <runtimeconfig allowresolving="true" packagemanager="zypper" />
</product>
EOF
%endif
%if 0%{?suse_version} > 1030
#
# create a vendor file to handle different vendor packages 
#
mkdir -p $RPM_BUILD_ROOT/etc/zypp/vendors.d/
VENDORFILE="$RPM_BUILD_ROOT/etc/zypp/vendors.d/openSUSE-Education"
echo "[main]" >> $VENDORFILE
echo "vendors=%{vendor},SUSE LINUX GmbH,openSUSE" >> $VENDORFILE
#
# create the update repo file for zypper
#
#mkdir -p $RPM_BUILD_ROOT/etc/zypp/repos.d 
#REPOFILE="$RPM_BUILD_ROOT/etc/zypp/repos.d/openSUSE-Education-Updates.repo"
#echo "[openSUSE-Education Updates]" >> $REPOFILE
#echo "name=openSUSE-Education Updates" >> $REPOFILE
#echo "baseurl=http://download.opensuse-education.org/updates/%{version}/%{opensuse_version}" >> $REPOFILE
#echo "type=rpm-md" >> $REPOFILE
#echo "enabled=0" >> $REPOFILE
#echo "autorefresh=1" >> $REPOFILE
#echo "gpgcheck=1" >> $REPOFILE
#echo "keeppackages=0" >> $REPOFILE
%endif

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root)
%config /etc/openSUSE-Education-release
%if 0%{?suse_version} > 1030
%dir /etc/zypp
# %%dir /etc/zypp/repos.d
%dir /etc/zypp/vendors.d
%if 0%{?suse_version} > 1100
%dir /etc/products.d/
%config(noreplace) /etc/products.d/%name.prod
%else
%dir /etc/zypp/products.d
%config(noreplace) /etc/zypp/products.d/openSUSE-Education-release.prod
%endif
%config(noreplace) /etc/zypp/vendors.d/openSUSE-Education
# %%config(noreplace) /etc/zypp/repos.d/openSUSE-Education-Updates.repo
%endif

%if 0%{?suse_version} > 1100
%files DVD
%defattr(-,root,root)
%doc %{_defaultdocdir}/openSUSE-Education-release-DVD
%endif

%changelog
openSUSE Build Service is sponsored by