forked from containers/qm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
79 lines (68 loc) · 2.36 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
TARGETS ?= qm
MODULES ?= ${TARGETS:=.pp.bz2}
DESTDIR ?=
PREFIX ?= /usr
DATADIR ?= $(PREFIX)/share
LIBDIR ?= $(PREFIX)/lib
SYSCONFDIR?=/etc
QMDIR=/usr/lib/qm
SPECFILE=rpm/qm.spec
RPM_TOPDIR ?= $(PWD)/rpmbuild
VERSION ?= $(shell cat VERSION)
.PHONY: file_contexts
file_contexts: qm.fc
sed \
-e "s|${QMDIR}/rootfs||" \
-e "s/gen_context(//g" \
-e "s/,s0)/:s0/g" \
-e "s|${QMDIR}||g" qm.fc > qm_file_contexts
all: selinux file_contexts man
.PHONY: selinux
selinux: qm.pp
@echo Compressing $^ -\> $@
bzip2 -f -9 $^
%.pp: %.te
mkdir -p tmp; cp qm.* tmp/
@if ./build-aux/validations ; then \
sed -i /user_namespace/d tmp/qm.if; \
fi
make -C tmp -f ${DATADIR}/selinux/devel/Makefile $@
cp tmp/qm.pp .; rm -rf tmp
.PHONY: codespell
codespell:
@codespell -S tmp,.git -L te -w
clean:
rm -f *~ *.tc *.pp *.pp.bz2
rm -rf tmp *.tar.gz ${RPM_TOPDIR}
man: qm.8.md
go-md2man --in qm.8.md --out qm.8
.PHONY: dist
dist:
tar cvz --transform s/qm/qm-${VERSION}/ -f /tmp/v${VERSION}.tar.gz ../qm
mv /tmp/v${VERSION}.tar.gz ./rpm
.PHONY: rpm
rpm: clean dist
mkdir -p ${RPM_TOPDIR}/{RPMS,SRPMS,BUILD,SOURCES}
cp ./rpm/v${VERSION}.tar.gz ${RPM_TOPDIR}/SOURCES
rpmbuild -ba \
--define="_topdir ${RPM_TOPDIR}" \
--define="version ${VERSION}" \
${SPECFILE}
install-policy: all
semodule -i ${TARGETS}.pp.bz2
sepolicy manpage --path . --domain ${TARGETS}_t
install: man all
install -D -pm 644 ${TARGETS}.pp.bz2 ${DESTDIR}${DATADIR}/selinux/packages/qm.pp.bz2
install -D -pm 644 qm.if ${DESTDIR}${DATADIR}/selinux/devel/include/services/qm.if
install -D -pm 644 qm_selinux.8 ${DESTDIR}${DATADIR}/man/man8/qm_selinux.8
install -D -pm 644 qm.8 ${DESTDIR}${DATADIR}/man/man8/qm.8
install -d -m 755 ${DESTDIR}${DATADIR}/qm
install -D -m 644 qm_contexts ${DESTDIR}${DATADIR}/qm/contexts
install -D -m 755 setup ${DESTDIR}${DATADIR}/qm/setup
install -D -m 755 tools/comment-tz-local ${DESTDIR}${DATADIR}/qm/comment-tz-local
install -D -m 755 tools/qm-rootfs ${DESTDIR}${DATADIR}/qm/qm-rootfs
install -D -m 755 tools/qm-storage-settings ${DESTDIR}${DATADIR}/qm/qm-storage-settings
install -D -m 755 create-seccomp-rules ${DESTDIR}${DATADIR}/qm/create-seccomp-rules
install -D -m 644 qm_file_contexts ${DESTDIR}${DATADIR}/qm/file_contexts
install -D -m 644 containers.conf ${DESTDIR}${DATADIR}/qm/containers.conf
install -D -m 644 qm.container ${DESTDIR}${DATADIR}/containers/systemd/qm.container