apparmor.d/PKGBUILD

62 lines
1.6 KiB
Bash
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')
2021-11-09 23:41:12 +01:00
makedepends=('go' 'git')
2021-04-02 19:12:15 +02:00
pkgver() {
2021-05-09 01:39:00 +02: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"
2021-04-04 22:38:07 +02:00
./configure --distribution=archlinux
2021-04-02 19:12:15 +02:00
}
2021-11-09 23:41:12 +01:00
build() {
cd "$srcdir/$pkgname/src"
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-04-02 19:12:15 +02:00
package() {
2021-05-01 15:27:14 +02:00
local _build='.build/apparmor.d'
2021-04-02 19:12:15 +02:00
cd "$srcdir/$pkgname"
# Install all files from root/
2021-05-01 15:27:14 +02:00
mapfile -t root < <(find root -type f -printf "%P\n")
for file in "${root[@]}"; do
install -Dm0644 "root/$file" "$pkgdir/$file"
done
2021-04-02 19:12:15 +02:00
2021-05-01 15:27:14 +02:00
# Install all files from $_build
mapfile -t build < <(find "$_build/" -type f -printf "%P\n")
for file in "${build[@]}"; do
install -Dm0644 "$_build/$file" "$pkgdir/etc/apparmor.d/$file"
done
2021-04-02 19:12:15 +02:00
# Ensure some systemd services do not start before apparmor rules are loaded
for path in systemd/*; do
service=$(basename "$path")
install -Dm0644 "$path" \
"$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
}