File apparmor-parser.spec of Package apparmor-parser

#
# spec file for package apparmor-parser (Version 2.3.1)
#
# Copyright (c) 2011 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/
#

# norootforbuild


Name:           apparmor-parser
%if ! %{?distro:1}0
%if %{?suse_version:1}0
  %define distro suse
%endif
%if %{?fedora_version:1}0
  %define distro redhat
%endif
%endif
%if ! %{?distro:1}0
  %define distro suse
%endif
Summary:        AppArmor userlevel parser utility
Version:        2.3.1
Release:        5.<RELEASE1>
Group:          Productivity/Networking/Security
Source0:        %{name}-%{version}-1349.tar.gz
Patch:          apparmor-init.patch
Patch1:         apparmor-parser_phonet.patch
Patch2:         apparmor-parser-rc-exit-code-fix
Patch3:         apparmor-startproc.patch
Patch4:         apparmor-parser-removal-whitespace-fix
Patch5:         apparmor-parser-fix-recognition-of-non-inet-net-domains
Patch6:         apparmor-parser-line-numbers
Patch7:         apparmor-parser-fix-two-x-transition-conflict-bugs
License:        GPLv2+
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Url:            http://forge.novell.com/modules/xfmod/project/?apparmor
PreReq:         sed
%if %{distro} == "suse"
PreReq:         %{insserv_prereq} aaa_base
%endif
BuildRequires:  gcc-c++ perl-gettext
Obsoletes:      subdomain_parser subdomain-parser
Obsoletes:      subdomain-parser-demo subdomain-parser-common subdomain-leaf-cert
Obsoletes:      libimnxcert
Provides:       subdomain_parser subdomain-parser
Provides:       subdomain-parser-demo subdomain-parser-common subdomain-leaf-cert
Provides:       libimnxcert
%define apparmor_bin_prefix /lib/apparmor
BuildRequires:  bison flex latex2html w3m
%if 0%{?suse_version} > 1020
BuildRequires:  texlive-latex
%else
BuildRequires:  te_latex
%endif

%description
The AppArmor Parser is a userlevel program that is used to load in
program profiles to the AppArmor Security kernel module.

This package is part of a suite of tools that used to be named
SubDomain.



Authors:
--------
    jjohansen@suse.de
    sbeattie@suse.de
    tonyj@suse.de

%prep
%setup -q
%patch  -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1

%build
make clean all CFLAGS="${RPM_OPT_FLAGS}"
make techdoc.txt

%install
make install DESTDIR=${RPM_BUILD_ROOT} \
	     MANDIR=%{_mandir} \
	     DISTRO=%{distro} \
	     APPARMOR_BIN_PREFIX=${RPM_BUILD_ROOT}%{apparmor_bin_prefix}
%find_lang %{name}

%clean
rm -rf $RPM_BUILD_ROOT

%files -f %{name}.lang
%defattr(-,root,root)
%doc README COPYING.GPL
/sbin/apparmor_parser
%dir %attr(-, root, root) /etc/apparmor
%if %{distro} == "suse"
  /sbin/rcsubdomain
  /sbin/rcapparmor
  /etc/init.d/boot.apparmor
  /sbin/rcaaeventd
  /etc/init.d/aaeventd
%else
  /etc/init.d/apparmor
  /etc/init.d/aaeventd
%endif
%config(noreplace) /etc/apparmor/subdomain.conf
/var/lib/apparmor
%dir %attr(-, root, root) %{apparmor_bin_prefix}
%{apparmor_bin_prefix}/rc.apparmor.functions
%if 0%{?suse_version} <= 1010
# needed on sles
%dir %{_prefix}/share/locale/si
%dir %{_prefix}/share/locale/si/LC_MESSAGES
%endif
%doc %{_mandir}/man*/*
%if %{distro} == "redhat" || %{distro} == "rhel4"

%pre
if [ -f /etc/init.d/subdomain ] ; then
  chkconfig --del subdomain
fi
%endif

%post
%if %{distro} == "suse"
  # SUSE uses insserv
  # For package renaming from subdomain -> apparmor
  # we check the existence of the AppArmor 1.1 and 
  # AppArmor 1.2 based init script to help determine 
  # whether  we are upgrading
  SUBDOMAIN_PARSER_INSTALLED="no"
  if test -e /etc/init.d/boot.subdomain -o -e /etc/init.d/subdomain; then
    SUBDOMAIN_PARSER_INSTALLED="yes"
  fi
  if  test "$1" == 1  -a $SUBDOMAIN_PARSER_INSTALLED = "no"; then
    %{insserv_force_if_yast boot.apparmor}
  elif test -e /etc/rc.d/boot.d/S??boot.subdomain  -o \
            -e /etc/rc.d/boot.d/S??boot.apparmor  -o \
            -e /etc/rc.d/rc3.d/S??subdomain ; then
    %{insserv_force_if_yast boot.apparmor}
  else
    %{fillup_and_insserv -f boot.apparmor}
  fi
%endif
%if %{distro} == "redhat" || %{distro} == "rhel4"
  chkconfig --add apparmor
%endif
%if %{distro} == "slackware"
  if grep -qs "# BEGIN rc.subdomain INSERTION" /etc/rc.d/rc.M ; then true ; else
    %{apparmor_bin_prefix}/install/frob_slack_rc --init
  fi
  if grep -qs "# BEGIN rc.subdomain INSERTION" /etc/rc.d/rc.K ; then true ; else
    %{apparmor_bin_prefix}/install/frob_slack_rc --shutdown
  fi
%endif

%preun
if [ "$1" = 0 ] ; then
%if %{distro} == "suse"
  %{stop_on_removal aaeventd}
  %{stop_on_removal boot.apparmor}
%endif
%if %{distro} == "redhat" || %{distro} == "rhel4"
  chkconfig --del aaeventd
  chkconfig --del apparmor
%endif
fi

%postun
%if %{distro} == "suse"
  %restart_on_update aaeventd boot.apparmor
  %{insserv_cleanup}
%endif

%changelog
openSUSE Build Service is sponsored by