apparmor.d/PKGBUILD

62 lines
1.6 KiB
Text
Raw Normal View History

2021-04-02 19:12:15 +02:00
# Maintainer: Alexandre Pujol <alexandre@pujol.io>
# shellcheck disable=SC2034,SC2154,SC2164
pkgname=apparmor.d
2021-05-09 01:39:00 +02:00
pkgver=0.001
2021-04-02 19:12:15 +02:00
pkgrel=1
pkgdesc="Full set of apparmor profiles"
2021-11-09 23:41:12 +01:00
arch=("x86_64")
2021-05-09 01:39:00 +02:00
url="https://github.com/roddhjav/$pkgname"
2021-04-02 19:12:15 +02:00
license=('GPL2')
depends=('apparmor')
2022-08-31 23:16:21 +02:00
makedepends=('go' 'git' 'rsync' 'lsb-release')
2021-04-02 19:12:15 +02:00
pkgver() {
2021-12-04 23:09:20 +01:00
cd "$srcdir/$pkgname"
echo "0.$(git rev-list --count HEAD)"
2021-04-02 19:12:15 +02:00
}
prepare() {
2021-04-04 00:51:57 +02:00
git clone "$startdir" "$srcdir/$pkgname"
2021-04-02 19:12:15 +02:00
cd "$srcdir/$pkgname"
2022-09-13 19:14:58 +02:00
./configure --complain
2021-04-02 19:12:15 +02:00
}
2021-11-09 23:41:12 +01:00
build() {
cd "$srcdir/$pkgname/"
2021-11-09 23:41:12 +01:00
export CGO_CPPFLAGS="${CPPFLAGS}"
export CGO_CFLAGS="${CFLAGS}"
export CGO_CXXFLAGS="${CXXFLAGS}"
export CGO_LDFLAGS="${LDFLAGS}"
export GOFLAGS="-buildmode=pie -trimpath -ldflags=-linkmode=external -mod=readonly -modcacherw"
go build -o .build/ ./cmd/aa-log
2021-11-09 23:41:12 +01:00
}
2021-04-02 19:12:15 +02:00
package() {
local _build='.build'
2021-04-02 19:12:15 +02:00
cd "$srcdir/$pkgname"
2022-05-21 19:07:03 +02:00
# Install all system files
mapfile -t root < <(find "$_build/root" -type f -printf "%P\n")
2021-05-01 15:27:14 +02:00
for file in "${root[@]}"; do
install -Dm0644 "$_build/root/$file" "$pkgdir/$file"
2021-05-01 15:27:14 +02:00
done
2021-04-02 19:12:15 +02:00
2022-05-21 19:07:03 +02:00
# Install all apparmor profiles
mapfile -t profiles < <(find "$_build/apparmor.d" -type f -printf "%P\n")
for file in "${profiles[@]}"; do
install -Dm0644 "$_build/apparmor.d/$file" "$pkgdir/etc/apparmor.d/$file"
2021-05-01 15:27:14 +02:00
done
2021-04-02 19:12:15 +02:00
# Ensure some systemd services do not start before apparmor rules are loaded
2022-05-21 19:07:03 +02:00
for file in systemd/*; do
service=$(basename "$file")
install -Dm0644 "$file" \
2021-04-02 19:12:15 +02:00
"$pkgdir/usr/lib/systemd/system/$service.d/apparmor.conf"
done
2021-05-01 15:27:14 +02:00
2021-11-09 23:41:12 +01:00
# Internal tool
install -Dm755 .build/aa-log "$pkgdir"/usr/bin/aa-log
2021-04-02 19:12:15 +02:00
}