Blob Blame History Raw
#
# spec file for package openSUSE-ALP-release.spec
#
# Copyright (c) 2020 SUSE LLC
#
# 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 https://bugs.opensuse.org/
#


%define product ___PRODUCT_NAME___
%define betaversion ___BETA_VERSION___%{nil}
%define codename %{nil}
Name:           ___PACKAGE_NAME___
Version:        ___VERSION___
Release:        0
# ___RELEASE___ is the product release, not the build release of this package
Summary:        ___SUMMARY___ ___BETA_VERSION___
License:        GPL-2.0-or-later
Group:          System/Fhs
Source100:      weakremovers.inc
BuildRequires:  skelcd-control-ALP
BuildRequires:  skelcd-ALP
Suggests:       branding-openSUSE
Suggests:       distribution-logos-openSUSE-ALP
Suggests:       java-11-openjdk
Suggests:       mariadb
Suggests:       mariadb-client
Suggests:       openSUSE-build-key
Suggests:       openssl-1_1
Conflicts:      core-release <= 10
Conflicts:      distribution-release
Provides:       distribution-release
# ALP is a SUSE Linux type distribution
Provides:       suse-release = %{version}-%{release}
Provides:       suse-release-oss = %{version}-%{release}
# Build using microos patterns
Provides:	MicroOS-release
Obsoletes:	MicroOS-release
# Give zypp a hint that this product must be kept up-to-date using zypper dup, not up (boo#1061384)
Provides:       product-update() = dup
# With more than one product in the FTP tree, yast needs to know which products are installable
# The name is referenced by the control file as well
Provides:       system-installation() = ALP

# this package should only be available for the "basearchs" of a product
ExclusiveArch:  %ix86 x86_64 ppc64le s390x aarch64 %arm
%include %{SOURCE100}
___PRODUCT_PROVIDES___

%description
___DESCRIPTION___

___FLAVOR_PACKAGES___

%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 'Welcome to %{product} %{codename} %{version}%{?betaversion: %{betaversion}} - Kernel \\r (\\l).\n' > %{buildroot}%{_prefix}/lib/issue.d/10-ALP.conf
echo -e "This is an early sneak preview release  not intended for production environment.\n" > %{buildroot}%{_prefix}/lib/issue.d/90-ALP.conf
echo    'Welcome to %{product} %{codename} %{version}%{?betaversion: %{betaversion}} - Kernel %%r (%%t).' > %{buildroot}%{_sysconfdir}/issue.net

VERSION_ID=`echo %{version}|tr '[:upper:]' '[:lower:]'|sed -e 's/ //g;'`
# note: VERSION is an optional field and has no meaning other than informative on a rolling distro
# We do thus not add it to the os-release file
cat > %{buildroot}%{_prefix}/lib/os-release <<EOF
NAME="ALP"
# VERSION="%{version}%{?betaversion: %{betaversion}}"
ID="alp"
ID_LIKE="suse opensuse opensuse-tumbleweed"
VERSION_ID="$VERSION_ID"
PRETTY_NAME="ALP"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:suse:alp:%{version}"
BUG_REPORT_URL="https://bugs.opensuse.org"
HOME_URL="https://www.opensuse.org/"
# DOCUMENTATION_URL="https://en.opensuse.org/Portal:ALP"
LOGO="distributor-logo"
EOF
ln -s ..%{_prefix}/lib/os-release %{buildroot}%{_sysconfdir}/os-release

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


# fate#319341, make openSUSE-release own YaST license files. TODO:
# get rid of /etc/YaST2/licenses
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

___CREATE_PRODUCT_FILES___
# this is a base product, create symlink
ln -s ALP.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
%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
%dir %{_prefix}/lib/issue.d/
%{_prefix}/lib/issue.d/10-ALP.conf
%{_prefix}/lib/issue.d/90-ALP.conf
%config(noreplace) %{_sysconfdir}/issue.net
%{_sysconfdir}/products.d

%changelog