File saptune.spec of Package saptune.9232

#
# spec file for package saptune
#
# Copyright (c) 2017-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/
#

%if ! %{defined _fillupdir}
  %define _fillupdir /var/adm/fillup-templates
%endif

Name:           saptune
Version:        1.1.7
Release:        0
License:        GPL-3.0
Summary:        Comprehensive system tuning management for SAP solutions
Url:            https://www.suse.com/products/sles-for-sap
Group:          System/Management
Source0:        %{name}-%{version}.tgz
Source1:        rpmlintrc
BuildRequires:  go tuned
Requires:       tuned vim
Requires:       systemd >= 228-142.1
ExclusiveArch:  x86_64 ppc64le

%define GONS github.com/SUSE
%define SRCDIR  src/%{GONS}/%{name}

%description
The utility adjusts system parameters such as kernel parameters and resource limits
to allow running various SAP solutions at satisfactory performance.
The utility can be used in place of sapconf.

%prep
mkdir -p %{SRCDIR}
cd %{SRCDIR}
tar xf %{S:0}

%check
export GOPATH=$(pwd)
cd %{SRCDIR}
go test -v ./...

%build
export GOPATH=$(pwd)
cd %{SRCDIR}
gzip ospackage/man/saptune.8
go build

%install
cd %{SRCDIR}
mkdir -p %{buildroot}/%{_sbindir}
install -m 0755 %{name} %{buildroot}/%{_sbindir}/

# Sysconfig files
mkdir -p %{buildroot}/%{_fillupdir}
pushd ospackage/etc/sysconfig
%if 0%{?sle_version} >= 150000
    rm -f saptune-note-1557506
%endif
for conf in *; do
    install -m 0644 "$conf" "%{buildroot}/%{_fillupdir}/sysconfig.$conf"
done
popd

# vendor file location
mkdir -p %{buildroot}/%{_sysconfdir}/%{name}/extra
pushd ospackage/etc/extra
for tunefiles in *; do
    install -m 0644 $tunefiles %{buildroot}/%{_sysconfdir}/%{name}/extra/
done
popd

# One manual page
mkdir -p %{buildroot}/%{_mandir}/man8
install -m 0644 ospackage/man/saptune.8.gz %{buildroot}/%{_mandir}/man8/

# One tuned profile
mkdir -p %{buildroot}/%{_libexecdir}/tuned/saptune
cp ospackage/profile/* %{buildroot}/%{_libexecdir}/tuned/saptune/
ls -lR %{buildroot}/%{_libexecdir}/tuned/saptune/

%post
%fillup_only -n saptune-note-1275776
%fillup_only -n saptune-note-1557506
%fillup_only -n saptune-note-SUSE-GUIDE-01
%fillup_only -n saptune-note-SUSE-GUIDE-02
%fillup_only -n saptune

%files
%defattr(-,root,root)
%{_fillupdir}/*
%{_sbindir}/%{name}
%{_mandir}/man8/*
%{_libexecdir}/tuned/saptune
%dir %{_sysconfdir}/%{name}
%dir %{_sysconfdir}/%{name}/extra
%config %{_sysconfdir}/%{name}/extra/*
# Created at run-time by saptune executable
%ghost %dir %{_localstatedir}/lib/%{name}/
openSUSE Build Service is sponsored by