summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 67562f8ec9b20f56d09311b40b05555f8bcc9be4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# Maintainer: Timothée Ravier <tim@siosm.fr>
# Contributor: Nicky726 (Nicky726 <at> gmail <dot> com)
# Contributor: Sergej Pupykin (pupykin <dot> s+arch <at> gmail <dot> com)
# Contributor: angelux/xangelux (xangelux <at> gmail <dot> com)

pkgname=policycoreutils
pkgver=2.2.1
pkgrel=1
pkgdesc="SELinux policy core utilities"
arch=('i686' 'x86_64')
url='http://userspace.selinuxproject.org'
license=('GPL')
groups=('selinux')
depends=('libsemanage>=2.2' 'libcgroup' 'dbus-glib' 'python2-ipy' 'setools'
         'sepolgen')
optdepends=('hicolor-icon-theme: needed for graphical tools')
options=(!emptydirs)
source=("http://userspace.selinuxproject.org/releases/20131030/${pkgname}-${pkgver}.tar.gz"
        'restorecond.service')
sha256sums=('102dbddcb1daaba7d55cbbb0843f7a9f1727d63a83e43e15edb77116115bf646'
            '20572c2cc09c8af5239f26cfea3eb2648d87d9927e55791f13572ea2184e857e')

prepare() {
  cd ${pkgname}-${pkgver}

#  sed -i -e "s/-Werror -Wall -W/-Werror -Wall -W ${CFLAGS}/" setfiles/Makefile
#  sed -i -e "s/-Werror -Wall -W/-Werror -Wall -W ${CFLAGS}/" sestatus/Makefile

  # python2 fix
  sed -i -e "s/shell python -c/shell python2 -c/" semanage/Makefile
  sed -i -e "s/\/usr\/bin\/python/\/usr\/bin\/python2/" sepolicy/Makefile

  # /usr merge fix
  sed -i -e "s/\$(PREFIX)\/sbin/\$(PREFIX)\/bin/g" */Makefile
  sed -i -e "s/\$(DESTDIR)\/sbin/\$(PREFIX)\/bin/g" */Makefile
  sed -i -e "s/\$(PREFIX)\/sbin/\$(PREFIX)\/bin/g" mcstrans/*/Makefile
  sed -i -e "s/\$(DESTDIR)\/sbin/\$(PREFIX)\/bin/g" mcstrans/*/Makefile
}

build() {
  cd ${pkgname}-${pkgver}

  make PYTHON=python2 LSPP_PRIV=y SEMODULE_PATH="/usr/sbin" all
}

package(){
  cd ${pkgname}-${pkgver}

  make PYTHON=python2 DESTDIR="${pkgdir}" LIBDIR="${pkgdir}"/usr/lib SHLIBDIR="${pkgdir}"/usr/lib SEMODULE_PATH="/usr/sbin" install

  install -Dm644 "${srcdir}"/restorecond.service "${pkgdir}/usr/lib/systemd/system/restorecond.service"

  # Fix python2 scripts
  sed -i -e "s/python -E/python2 -E/" "${pkgdir}/usr/bin/audit2allow"
  sed -i -e "s/python -E/python2 -E/" "${pkgdir}/usr/bin/audit2why"
  sed -i -e "s/python -E/python2 -E/" "${pkgdir}/usr/bin/chcat"
  sed -i -e "s/python -E/python2 -E/" "${pkgdir}/usr/bin/sepolgen"
  sed -i -e "s/python -E/python2 -E/" "${pkgdir}/usr/bin/sepolgen-ifgen"
  sed -i -e "s/python -E/python2 -E/" "${pkgdir}/usr/bin/semanage"
  sed -i -e "s/python -E/python2 -E/" "${pkgdir}/usr/lib/python2.7/site-packages/seobject.py"
}