From 707786ea9082a9ab43f7b16c99bb40554be7259d Mon Sep 17 00:00:00 2001 From: EnumDev Date: Tue, 7 Apr 2026 16:21:37 +0300 Subject: [PATCH] Initial commit --- .gitignore | 3 +++ check-version.sh | 15 +++++++++++++++ pkg.info | 31 ++++++++++++++++++++++++++++++ source.sh | 49 ++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 98 insertions(+) create mode 100644 .gitignore create mode 100644 check-version.sh create mode 100644 pkg.info create mode 100644 source.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9d96df7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +# Ignore BPM archives and signatures +*.bpm +*.bpm.sig diff --git a/check-version.sh b/check-version.sh new file mode 100644 index 0000000..ee1b945 --- /dev/null +++ b/check-version.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +# Gitlab repository +REPO="apparmor/apparmor" + +# Replace slash with URL encoded representation +REPO=$(echo "$REPO" | sed 's|/|%2F|g') + +# Get tag name using Gitlab Rest API +TAG_NAME=$(curl -s -L https://gitlab.com/api/v4/projects/"$REPO"/releases | jq -r '.[].tag_name' | grep -v 'rc' | head -n1) + +# Trim 'v' character in TAG_NAME variable +VERSION=$(echo "$TAG_NAME" | tr -d 'v') + +echo "$VERSION" diff --git a/pkg.info b/pkg.info new file mode 100644 index 0000000..45325ae --- /dev/null +++ b/pkg.info @@ -0,0 +1,31 @@ +name: apparmor +description: |- + Mandatory Access Control (MAC) mechanism which uses the + Linux Security Module (LSM) framework +version: 4.1.7 +revision: 1 +url: https://gitlab.com/apparmor/apparmor +license: GPL2-only +maintainers: + - enumdev@enumerated.dev +architecture: any +type: source +depends: + - bash + - glibc + - pam + - python3 +optional_depends: + - perl:For perl bindings + - ruby:For ruby bindings +make_depends: + - autoconf-archive + - libxcrypt + - python-setuptools + - ruby + - swig +downloads: + - url: https://gitlab.com/apparmor/apparmor/-/archive/v${BPM_PKG_VERSION}/apparmor-v${BPM_PKG_VERSION}.tar.gz + extract_to: ${BPM_SOURCE} + extract_strip_components: 1 + checksum: ded4cd419b8a05002a108a0912208e2098695752664c6a59464d2dda418e0452 diff --git a/source.sh b/source.sh new file mode 100644 index 0000000..9f6937a --- /dev/null +++ b/source.sh @@ -0,0 +1,49 @@ +# This is the source.sh script. It is executed by BPM in a temporary directory when compiling a source package +# BPM Expects the source code to be extracted into the automatically created 'source' directory which can be accessed using $BPM_SOURCE +# BPM Expects the output files to be present in the automatically created 'output' directory which can be accessed using $BPM_OUTPUT + +# The prepare function is executed in the root of the temp directory +# This function is used for putting downloaded files to the correct location or applying patches +prepare() { + cd "$BPM_SOURCE"/libraries/libapparmor + autoreconf -fi +} + +# The build function is executed in the source directory +# This function is used to compile the source code +build() { + cd "$BPM_SOURCE"/libraries/libapparmor + ./configure --prefix=/usr --with-perl --with-python --with-ruby + make + + cd "$BPM_SOURCE" + make -C binutils + make -C parser + make -C profiles + make -C utils +} + +# The package function is executed in the source directory +# This function is used to move the compiled files into the output directory +package() { + make -C libraries/libapparmor DESTDIR="$BPM_OUTPUT" install + make -C binutils DESTDIR="$BPM_OUTPUT" install + make -C parser DESTDIR="$BPM_OUTPUT" SBINDIR="$BPM_OUTPUT"/usr/sbin APPARMOR_BIN_PREFIX="$BPM_OUTPUT"/usr/lib/apparmor install + make -C profiles DESTDIR="$BPM_OUTPUT" install + make -C utils DESTDIR="$BPM_OUTPUT" install + + # Set file mode to allow the perl library to be stripped: + # https://gitlab.com/apparmor/apparmor/issues/34 + find "$BPM_OUTPUT"/usr/lib/perl/ -type f -iname "*.so" -exec chmod 755 {} \; + + # Remove empty core_perl directory: + # https://gitlab.com/apparmor/apparmor/issues/40 + rm -r "$BPM_OUTPUT"/usr/lib/perl/*/core_perl + + # Move ruby bindings to vendor_ruby: + # https://gitlab.com/apparmor/apparmor/issues/35 + mv "$BPM_OUTPUT"/usr/lib/ruby/{site,vendor}_ruby + + # Install package license + install -Dm644 "$BPM_SOURCE"/LICENSE "$BPM_OUTPUT"/usr/share/licenses/apparmor/LICENSE +}