2022-03-20 13:34:07 +01:00
|
|
|
# Maintainer: David Runge <dvzrv@archlinux.org>
|
|
|
|
|
|
|
|
pkgname=apparmor
|
2022-11-15 16:45:12 +01:00
|
|
|
pkgver=3.1.2
|
2022-08-07 13:14:55 +02:00
|
|
|
pkgrel=1
|
2022-03-20 13:34:07 +01:00
|
|
|
pkgdesc="Mandatory Access Control (MAC) using Linux Security Module (LSM)"
|
|
|
|
arch=(x86_64)
|
|
|
|
url="https://gitlab.com/apparmor/apparmor"
|
|
|
|
license=(GPL2 LGPL2.1)
|
|
|
|
depends=(audit glibc pam python)
|
|
|
|
makedepends=(apache libxcrypt python-setuptools ruby swig)
|
|
|
|
checkdepends=(dejagnu perl-locale-gettext python-notify2 python-psutil)
|
2022-08-07 13:14:55 +02:00
|
|
|
optdepends=(
|
|
|
|
'perl: for perl bindings'
|
|
|
|
'python-notify2: for aa-notify'
|
|
|
|
'python-psutil: for aa-notify'
|
|
|
|
'ruby: for ruby bindings'
|
|
|
|
)
|
2022-03-20 13:34:07 +01:00
|
|
|
provides=(libapparmor.so)
|
2022-08-07 13:14:55 +02:00
|
|
|
backup=(
|
|
|
|
etc/apparmor/easyprof.conf
|
|
|
|
etc/apparmor/logprof.conf
|
|
|
|
etc/apparmor/notify.conf
|
|
|
|
etc/apparmor/parser.conf
|
|
|
|
etc/apparmor/severity.db
|
|
|
|
)
|
|
|
|
options=(debug)
|
2022-08-11 05:51:42 +02:00
|
|
|
source=(https://launchpad.net/$pkgname/${pkgver%.[0-9]}/$pkgver/+download/$pkgname-$pkgver.tar.gz{,.asc})
|
2022-11-15 16:45:12 +01:00
|
|
|
sha512sums=('e4fa8e0985472c00d3b68044f4150659787cf15b384b901af32b5aba3f0b2839f33bfe0b0675bf8ea7a1f5727152756a276c75b1dec383a33b92b0a1b8615a11'
|
2022-08-11 05:51:42 +02:00
|
|
|
'SKIP')
|
2022-11-15 16:45:12 +01:00
|
|
|
b2sums=('595bef3e1f62bcd4f0ffb4bf1a662ac77c78bfc3f2b4743c5606849e71cba0d844b0c45a9f3107e0f1eee34f2f5a757553c70a8ceeadea70235256332f7364a7'
|
2022-08-11 05:51:42 +02:00
|
|
|
'SKIP')
|
2022-03-20 13:34:07 +01:00
|
|
|
validpgpkeys=('3ECDCBA5FB34D254961CC53F6689E64E3D3664BB') # AppArmor Development Team (AppArmor signing key) <apparmor@lists.ubuntu.com>
|
|
|
|
_core_perl="/usr/bin/core_perl"
|
|
|
|
|
|
|
|
prepare() {
|
2022-08-07 13:14:55 +02:00
|
|
|
cd $pkgname-$pkgver/libraries/libapparmor/
|
|
|
|
autoreconf -fiv
|
2022-03-20 13:34:07 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
build() {
|
2022-08-07 13:14:55 +02:00
|
|
|
cd $pkgname-$pkgver
|
2022-03-20 13:34:07 +01:00
|
|
|
|
|
|
|
# export required perl executable locations
|
2022-08-07 13:14:55 +02:00
|
|
|
export MAKEFLAGS+=" POD2MAN=$_core_perl/pod2man"
|
|
|
|
export MAKEFLAGS+=" POD2HTML=$_core_perl/pod2html"
|
|
|
|
export MAKEFLAGS+=" PODCHECKER=$_core_perl/podchecker"
|
|
|
|
export MAKEFLAGS+=" PROVE=$_core_perl/prove"
|
2022-03-20 13:34:07 +01:00
|
|
|
(
|
2022-08-07 13:14:55 +02:00
|
|
|
cd libraries/libapparmor/
|
|
|
|
./configure \
|
|
|
|
--prefix=/usr \
|
|
|
|
--sbindir=/usr/bin \
|
|
|
|
--with-perl \
|
|
|
|
--with-python \
|
|
|
|
--with-ruby
|
2022-03-20 13:34:07 +01:00
|
|
|
make
|
|
|
|
)
|
|
|
|
make -C binutils
|
|
|
|
make -C parser
|
|
|
|
make -C profiles
|
|
|
|
make -C utils
|
|
|
|
make -C changehat/pam_apparmor
|
|
|
|
make -C changehat/mod_apparmor
|
|
|
|
make -C utils/vim
|
|
|
|
|
|
|
|
# copy to test location as some tests render the resulting python bytecode
|
|
|
|
# unreproducible: https://gitlab.com/apparmor/apparmor/-/issues/184
|
|
|
|
cd ..
|
2022-08-07 13:14:55 +02:00
|
|
|
cp -av $pkgname-$pkgver $pkgname-$pkgver-test
|
2022-03-20 13:34:07 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
check() {
|
2022-08-07 13:14:55 +02:00
|
|
|
cd $pkgname-$pkgver-test
|
2022-03-20 13:34:07 +01:00
|
|
|
echo "INFO: Running check: libraries/libapparmor"
|
|
|
|
make -C libraries/libapparmor check
|
|
|
|
echo "INFO: Running check binutils"
|
|
|
|
make -C binutils check
|
|
|
|
echo "INFO: Running check parser"
|
|
|
|
make -C parser check
|
|
|
|
# NOTE: the profiles checks are notoriously broken, so run each separately
|
|
|
|
echo "INFO: Running check-abstractions.d profiles"
|
|
|
|
make -C profiles check-abstractions.d
|
|
|
|
# # many hardcoded paths are not accounted for:
|
|
|
|
# # https://gitlab.com/apparmor/apparmor/-/issues/137
|
|
|
|
# echo "INFO: Running check-logprof profiles"
|
|
|
|
# make -C profiles check-logprof
|
|
|
|
echo "INFO: Running check-parser profiles"
|
|
|
|
make -C profiles check-parser
|
|
|
|
echo "INFO: Running check utils"
|
|
|
|
# we do not care about linting when running tests
|
|
|
|
# https://gitlab.com/apparmor/apparmor/-/issues/121
|
|
|
|
make PYFLAKES='/usr/bin/true' -C utils check
|
|
|
|
}
|
|
|
|
|
|
|
|
package() {
|
2022-08-07 13:14:55 +02:00
|
|
|
depends+=(libcrypt.so)
|
|
|
|
|
|
|
|
cd $pkgname-$pkgver
|
|
|
|
make -C libraries/libapparmor DESTDIR="$pkgdir" install
|
|
|
|
make -C changehat/pam_apparmor DESTDIR="$pkgdir/usr" install
|
|
|
|
make -C changehat/mod_apparmor DESTDIR="$pkgdir" install
|
|
|
|
make -C binutils DESTDIR="$pkgdir" SBINDIR="$pkgdir/usr/bin" USR_SBINDIR="$pkgdir/usr/bin" install
|
|
|
|
make -C parser -j1 DESTDIR="$pkgdir" SBINDIR="$pkgdir/usr/bin" USR_SBINDIR="$pkgdir/usr/bin" APPARMOR_BIN_PREFIX="$pkgdir/usr/lib/apparmor" install install-systemd
|
|
|
|
make -C profiles DESTDIR="$pkgdir" install
|
|
|
|
make -C utils DESTDIR="$pkgdir" SBINDIR="$pkgdir/usr/bin" USR_SBINDIR="$pkgdir/usr/bin" BINDIR="$pkgdir/usr/bin" VIM_INSTALL_PATH="$pkgdir/usr/share/vim/vimfiles/syntax" install
|
2022-03-20 13:34:07 +01:00
|
|
|
|
|
|
|
# set file mode to allow the perl library to be stripped:
|
|
|
|
# https://gitlab.com/apparmor/apparmor/issues/34
|
2022-08-07 13:14:55 +02:00
|
|
|
find "$pkgdir/usr/lib/perl5/" -type f -iname "*.so" -exec chmod 755 {} \;
|
2022-03-20 13:34:07 +01:00
|
|
|
|
|
|
|
# remove empty core_perl directory:
|
|
|
|
# https://gitlab.com/apparmor/apparmor/issues/40
|
|
|
|
rm -rv "${pkgdir}"/usr/lib/perl5/*/core_perl
|
|
|
|
# move ruby bindings to vendor_ruby:
|
|
|
|
# https://gitlab.com/apparmor/apparmor/issues/35
|
2022-08-07 13:14:55 +02:00
|
|
|
mv -v "$pkgdir/usr/lib/ruby/"{site,vendor}_ruby
|
2022-03-20 13:34:07 +01:00
|
|
|
# adding files below /etc/apparmor.d to backup array
|
2022-08-07 13:14:55 +02:00
|
|
|
cd "$pkgdir"
|
2022-03-20 13:34:07 +01:00
|
|
|
# trick extract_function_variable() in makepkg into not detecting the
|
|
|
|
# backup array modification and adding remaining configuration files
|
2022-08-07 13:14:55 +02:00
|
|
|
[[ /usr/bin/true ]] && backup=( ${backup[@]} $(find "etc/$pkgname.d/" -type f | LC_ALL=C sort) )
|
2022-03-20 13:34:07 +01:00
|
|
|
}
|