mirror of
https://github.com/roddhjav/apparmor.d.git
synced 2024-12-26 15:06:45 +01:00
build: makefile: add support for sub packages.
This commit is contained in:
parent
a1c8260305
commit
3020de1ba2
1 changed files with 35 additions and 13 deletions
48
Makefile
48
Makefile
|
@ -7,7 +7,8 @@ DESTDIR ?= /
|
||||||
BUILD ?= .build
|
BUILD ?= .build
|
||||||
PKGDEST ?= ${PWD}/.pkg
|
PKGDEST ?= ${PWD}/.pkg
|
||||||
PKGNAME := apparmor.d
|
PKGNAME := apparmor.d
|
||||||
PROFILES = $(filter-out dpkg,$(notdir $(wildcard ${BUILD}/apparmor.d/*)))
|
PROFILE = $(filter-out dpkg,$(notdir $(wildcard ${BUILD}/apparmor.d/*)))
|
||||||
|
PROFILES = profiles-apparmor.d profiles-other $(patsubst dists/packages/%,profiles-%,$(basename $(wildcard dists/packages/*.conf)))
|
||||||
|
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
all: build
|
all: build
|
||||||
|
@ -26,32 +27,53 @@ enforce: build
|
||||||
full: build
|
full: build
|
||||||
@./${BUILD}/prebuild --complain --full
|
@./${BUILD}/prebuild --complain --full
|
||||||
|
|
||||||
|
.PHONY: packages
|
||||||
|
packages: clean build
|
||||||
|
@./${BUILD}/prebuild --complain --packages
|
||||||
|
|
||||||
|
# Install apparmor.d
|
||||||
.PHONY: install
|
.PHONY: install
|
||||||
install:
|
install: install-bin install-share install-systemd profiles-apparmor.d
|
||||||
|
|
||||||
|
# Install apparmor.d.base
|
||||||
|
.PHONY: install-base
|
||||||
|
install-base: install-bin install-share install-systemd profiles-base
|
||||||
|
|
||||||
|
.PHONY: install-bin
|
||||||
|
install-bin:
|
||||||
@install -Dm0755 ${BUILD}/aa-log ${DESTDIR}/usr/bin/aa-log
|
@install -Dm0755 ${BUILD}/aa-log ${DESTDIR}/usr/bin/aa-log
|
||||||
|
|
||||||
|
.PHONY: install-share
|
||||||
|
install-share:
|
||||||
@for file in $(shell find "${BUILD}/share" -type f -not -name "*.md" -printf "%P\n"); do \
|
@for file in $(shell find "${BUILD}/share" -type f -not -name "*.md" -printf "%P\n"); do \
|
||||||
install -Dm0644 "${BUILD}/share/$${file}" "${DESTDIR}/usr/share/$${file}"; \
|
install -Dm0644 "${BUILD}/share/$${file}" "${DESTDIR}/usr/share/$${file}"; \
|
||||||
done;
|
done;
|
||||||
@for file in $(shell find "${BUILD}/apparmor.d" -type f -printf "%P\n"); do \
|
|
||||||
install -Dm0644 "${BUILD}/apparmor.d/$${file}" "${DESTDIR}/etc/apparmor.d/$${file}"; \
|
.PHONY: install-systemd
|
||||||
done;
|
install-systemd:
|
||||||
@for file in $(shell find "${BUILD}/apparmor.d" -type l -printf "%P\n"); do \
|
|
||||||
mkdir -p "${DESTDIR}/etc/apparmor.d/disable"; \
|
|
||||||
cp -d "${BUILD}/apparmor.d/$${file}" "${DESTDIR}/etc/apparmor.d/$${file}"; \
|
|
||||||
done;
|
|
||||||
@for file in ${BUILD}/systemd/system/*; do \
|
@for file in ${BUILD}/systemd/system/*; do \
|
||||||
service="$$(basename "$$file")"; \
|
service="$$(basename "$${file}")"; \
|
||||||
install -Dm0644 "$${file}" "${DESTDIR}/usr/lib/systemd/system/$${service}.d/apparmor.conf"; \
|
install -Dm0644 "$${file}" "${DESTDIR}/usr/lib/systemd/system/$${service}.d/apparmor.conf"; \
|
||||||
done;
|
done;
|
||||||
@for file in ${BUILD}/systemd/user/*; do \
|
@for file in ${BUILD}/systemd/user/*; do \
|
||||||
service="$$(basename "$$file")"; \
|
service="$$(basename "$${file}")"; \
|
||||||
install -Dm0644 "$${file}" "${DESTDIR}/usr/lib/systemd/user/$${service}.d/apparmor.conf"; \
|
install -Dm0644 "$${file}" "${DESTDIR}/usr/lib/systemd/user/$${service}.d/apparmor.conf"; \
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Install all profiles for a given (sub)package
|
||||||
.PHONY: $(PROFILES)
|
.PHONY: $(PROFILES)
|
||||||
$(PROFILES):
|
$(PROFILES):
|
||||||
@install -Dm0755 ${BUILD}/aa-log ${DESTDIR}/usr/bin/aa-log
|
@for file in $(shell find "${BUILD}/$(patsubst profiles-%,%,$@)" -type f -printf "%P\n"); do \
|
||||||
|
install -Dm0644 "${BUILD}/$(patsubst profiles-%,%,$@)/$${file}" "${DESTDIR}/etc/apparmor.d/$${file}"; \
|
||||||
|
done;
|
||||||
|
@for file in $(shell find "${BUILD}/$(patsubst profiles-%,%,$@)" -type l -printf "%P\n"); do \
|
||||||
|
mkdir -p "${DESTDIR}/etc/apparmor.d/disable"; \
|
||||||
|
cp -d "${BUILD}/$(patsubst profiles-%,%,$@)/$${file}" "${DESTDIR}/etc/apparmor.d/$${file}"; \
|
||||||
|
done;
|
||||||
|
|
||||||
|
# Partial install (not recommended)
|
||||||
|
.PHONY: $(PROFILE)
|
||||||
|
$(PROFILE): install-bin
|
||||||
@for file in $(shell find ${BUILD}/apparmor.d/abstractions/ -type f -printf "%P\n"); do \
|
@for file in $(shell find ${BUILD}/apparmor.d/abstractions/ -type f -printf "%P\n"); do \
|
||||||
install -Dm0644 "${BUILD}/apparmor.d/abstractions/$${file}" "${DESTDIR}/etc/apparmor.d/abstractions/$${file}"; \
|
install -Dm0644 "${BUILD}/apparmor.d/abstractions/$${file}" "${DESTDIR}/etc/apparmor.d/abstractions/$${file}"; \
|
||||||
done;
|
done;
|
||||||
|
|
Loading…
Reference in a new issue