updated on Thu Jan 19 20:01:47 UTC 2012
[aur-mirror.git] / selinux-refpolicy-arch / PKGBUILD
blobff7d7e0c4e3637428f8e70fe92e418d61c6462aa
1 # Maintainer: Nicky726 (Nicky726 <at> gmail <dot> com)
2 # Contributor: Simon Peter Nicholls (simon <at> mintsource <dot> org)
4 pkgname=selinux-refpolicy-arch
5 _origname=refpolicy
6 _policyname=refpolicy-arch
7 _origver=20110726
8 _patchver=1
9 pkgver=${_origver}.${_patchver}
10 pkgrel=3
11 pkgdesc="Modular SELinux reference policy including headers and docs with Arch Linux patch"
12 arch=('any')
13 url="http://oss.tresys.com/projects/refpolicy"
14 license=('GPL')
15 groups=('selinux' 'selinux-policies')
16 depends=('linux-selinux')
17 makedepends=('selinux-usr-checkpolicy>=2.0.16' 'selinux-usr-policycoreutils>=2.0.0' 
18              'selinux-usr-libsepol>=2.0.29' 'selinux-usr-libsemanage>=2.0.29' 
19              'pyxml')
20 conflicts=('selinux-refpolicy')
21 backup=(etc/selinux/config)
22 options=(!makeflags)
23 install=${pkgname}.install
24 source=(http://oss.tresys.com/files/${_origname}/${_origname}-2.${_origver}.tar.bz2
25         config
26         ${pkgname}.patch)
27 sha256sums=('8159b7535aa0f805510e4e3504b1317d7083b227f0ef3df51c6f002ed70ecedb'
28             '4803739c58a47b0226899e41239df714ee72e86267c9929d4776b819de370cb4'
29             'b03d8afcc71f0d67ba3c8688003f353c27d00bf8a87ef925e23c54fafe2d4880')
31 build() {
32   cd "${srcdir}/${_origname}"
33   # Add Arch Linux patch
34   patch -Np1 -i "${srcdir}/${pkgname}.patch"
35   # Policy build settings
36   sed -i -e "s/MONOLITHIC = y/MONOLITHIC = n/" build.conf
37   sed -i -e "s/#UNK_PERMS = deny/UNK_PERMS = allow/" build.conf
38   sed -i -e "s/DIRECT_INITRC = n/DIRECT_INITRC = y/" build.conf
39   sed -i -e "s/UBAC = y/UBAC = n/" build.conf
40   sed -i -e "s/NAME = refpolicy/NAME = refpolicy-arch/" build.conf
41   sed -i -e "s/#DISTRO = redhat/DISTRO = arch/" build.conf
42   # Fix for python2
43   sed -i -e "s/python/python2/" Makefile
44   make bare
45   make conf
46   make
49 package(){
50   cd "${srcdir}/${_origname}"
51   make DESTDIR="${pkgdir}" install
52   make DESTDIR="${pkgdir}" install-headers
53   make DESTDIR="${pkgdir}" install-docs
55   # Create some files and directories necesary for loading policy,
56   # which is done via install script.
57   install -d -m0755 "${pkgdir}/etc/selinux/${_policyname}/modules"
58   install -d -m0700 "${pkgdir}/etc/selinux/${_policyname}/modules/active"
59   install -d -m0700 "${pkgdir}/etc/selinux/${_policyname}/modules/active/modules"
60   install -d -m0755 "${pkgdir}/etc/selinux/${_policyname}/policy"
61   touch "${pkgdir}/etc/selinux/${_policyname}/modules/"{semanage.read.LOCK,semanage.trans.LOCK}
62   touch "${pkgdir}/etc/selinux/${_policyname}/policy/policy.26" 
63   # Link the policy file for selinux-sysvinit to find it
64   cd "${pkgdir}/etc"
65   ln -s "selinux/${_policyname}/policy/policy.26" "policy.bin"
67   # Install main SELinux config file defaulting to refpolicy
68   install -m644 -D "${srcdir}/config" "${pkgdir}/etc/selinux/config"
70   # Some changes due to python2
71   sed -i -e "s/python/python2/" \
72         "${pkgdir}/usr/share/selinux/${_policyname}/include/support/segenxml.py"
73   sed -i -e "s/python/python2/" \
74         "${pkgdir}/usr/share/selinux/${_policyname}/include/Makefile"