File mcstrans.spec of Package mcstrans

#
# spec file for package mcstrans
#
# Copyright (c) 2015 SUSE LINUX Products 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:           mcstrans
Version:        0.3.3
Release:        0
Url:            http://fedora.redhat.com/
Summary:        SELinux Translation Daemon
License:        GPL-2.0+
Group:          System/Management
Source:         %{name}-%{version}.tgz
Source1:        mcstransd.service
Patch0:         %{name}-%{version}-writepid.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Requires:       aaa_base
BuildRequires:  aaa_base
BuildRequires:  libcap-devel
BuildRequires:  libselinux-devel >= 1.30.3
BuildRequires:  libsepol-devel-static
BuildRequires:  pcre-devel
BuildRequires:  systemd
%{?systemd_requires}
Provides:       setransd

%description
Security-enhanced Linux is a feature of the Linux® kernel and a number
of utilities with enhanced security functionality designed to add
mandatory access controls to Linux.  The Security-enhanced Linux
kernel contains new architectural components originally developed to
improve the security of the Flask operating system. These
architectural components provide general support for the enforcement
of many kinds of mandatory access control policies, including those
based on the concepts of Type Enforcement®, Role-based Access
Control, and Multi-level Security.

mcstrans provides an translation daemon to translate SELinux categories 
from internal representations to user defined representation.

%prep
%setup -q
%patch0 -p1

%build
export CFLAGS="$RPM_OPT_FLAGS"
make LIBDIR="%{_libdir}" %{?jobs:-j%jobs}

%install
mkdir -p $RPM_BUILD_ROOT/%{_lib}
mkdir -p $RPM_BUILD_ROOT/%{_libdir}
mkdir -p $RPM_BUILD_ROOT/%{_unitdir}
make DESTDIR="$RPM_BUILD_ROOT" LIBDIR="$RPM_BUILD_ROOT%{_libdir}" SHLIBDIR="$RPM_BUILD_ROOT/%{_lib}" install
rm -f $RPM_BUILD_ROOT%{_sbindir}/*
rm -f $RPM_BUILD_ROOT%{_libdir}/*.a
rm $RPM_BUILD_ROOT/etc/rc.d/init.d/mcstrans 
install -D -m 0644 %{SOURCE1} $RPM_BUILD_ROOT%{_unitdir}/
rm -rf $RPM_BUILD_ROOT/etc/rc.d
mkdir -p $RPM_BUILD_ROOT%{_sbindir}
ln -sf %{_sbindir}/service $RPM_BUILD_ROOT%{_sbindir}/rcmcstransd

%post
%service_add_post mcstransd.service

%preun
%service_del_preun mcstransd.service

%postun
%service_del_postun mcstransd.service

%pre
%service_add_pre mcstransd.service

%files
%defattr(-,root,root)
%{_unitdir}/mcstransd.service
/sbin/mcstransd
/usr/sbin/rcmcstransd
%{_mandir}/man8/mcs.8*
%{_mandir}/man8/mcstransd.8*
%{_mandir}/man8/setrans.conf.8*

%changelog
openSUSE Build Service is sponsored by