File sapconf.spec of Package sapconf.5396

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


Name:           sapconf
Version:        4.1.10
Release:        0
Summary:        Kernel Parameter Initializiation for SAP Systems
License:        LGPL-2.1+
Group:          Productivity/Other
Url:            http://www.novell.com/partners/sap/
Source0:        %name-%version.tar.gz
BuildArch:      noarch
BuildRequires:  tuned
Requires:       bc
Requires:       sysstat
%if 0%{?sle_version} == 120100
Requires:       sapinit-systemd-compat
%else
Requires:       systemd >= 228-142.1
%endif
Requires:       tuned
Requires:       uuidd
Suggests:       cron logrotate
%{?systemd_requires}

%description 
The utility adjusts operating system parameters, such as kernel 
tuning settings and resource limits, to allow running various
SAP solutions at satisfactory performance.

Since SLES 12 SP2, The utility is deprecated on SLES4SAP in
favour of the newer utility "saptune".

Authors:
--------
    Angela Briel, Howard Guo

%prep
%setup -q

%build

%install
mkdir -p %{buildroot}%{_libexecdir}/tuned/
cp -R profile/* %{buildroot}%{_libexecdir}/tuned/
mkdir -p %{buildroot}%{_libexecdir}/%{name}/
install -m 0644 lib/common.sh %{buildroot}%{_libexecdir}/%{name}/
install -m 0644 lib/util.sh %{buildroot}%{_libexecdir}/%{name}/

mkdir -p %{buildroot}%{_unitdir}/systemd/system/ %{buildroot}%{_sbindir}/
install -m 0644 sapconf.service %{buildroot}%{_unitdir}/
install -m 0755 bin/* %{buildroot}%{_sbindir}/
ln -s /usr/sbin/service %{buildroot}%{_sbindir}/rcsapconf

mkdir -p %{buildroot}%{_mandir}/{man7,man8}/
install -m 0644 man/*.7 %{buildroot}%{_mandir}/man7/
install -m 0644 man/*.8 %{buildroot}%{_mandir}/man8/

mkdir -p %{buildroot}%{_var}/adm/fillup-templates/
pushd sysconfig
for file in *; do
    cp "$file" "%{buildroot}%{_var}/adm/fillup-templates/sysconfig.$file"
done
popd

%pre
%service_add_pre sapconf.service

%post
%fillup_only -n sapconf
%fillup_only -n sapnote-1557506
%fillup_only -n sapnote-1680803
%service_add_post sapconf.service

# Requested by https://bugzilla.suse.com/show_bug.cgi?id=983454 :
# UUID should work properly (enabled) as soon as this package is installed.
systemctl enable uuidd.socket || true
systemctl start uuidd.socket || true

systemctl -q is-active tuned && echo "Please, restart the tuned service to activate the new sapconf configurations" || true

%preun
%service_del_preun sapconf.service

%postun
%service_del_postun sapconf.service

%files 
%defattr(-,root,root)
%{_sbindir}/SAPconf
%{_sbindir}/sapconf
%{_sbindir}/rcsapconf
%{_libexecdir}/tuned/sap*
%dir %{_libexecdir}/%{name}
%{_libexecdir}/%{name}/*
%{_unitdir}/sapconf.service
%{_mandir}/man*/*
/var/adm/fillup-templates/*

%changelog
openSUSE Build Service is sponsored by