47
PKG_CONFIG?=pkg-config
48
49
USER:=$(firstword $(subst :, ,$(shell getent passwd _mandos \
49
50
|| getent passwd nobody || echo 65534)))
50
51
GROUP:=$(firstword $(subst :, ,$(shell getent group _mandos \
51
52
|| getent group nogroup || echo 65534)))
54
LINUXVERSION:=$(shell uname --kernel-release)
53
56
## Use these settings for a traditional /usr/local install
54
57
# PREFIX:=$(DESTDIR)/usr/local
55
58
# CONFDIR:=$(DESTDIR)/etc/mandos
71
74
STATEDIR:=$(DESTDIR)/var/lib/mandos
74
"/usr/lib/`dpkg-architecture -qDEB_HOST_MULTIARCH 2>/dev/null`" \
77
"/usr/lib/`dpkg-architecture \
78
-qDEB_HOST_MULTIARCH 2>/dev/null`" \
75
79
"`rpm --eval='%{_libdir}' 2>/dev/null`" /usr/lib; do \
76
80
if [ -d "$$d" -a "$$d" = "$${d%/}" ]; then \
77
81
echo "$(DESTDIR)$$d"; \
83
SYSTEMD:=$(DESTDIR)$(shell pkg-config systemd --variable=systemdsystemunitdir)
84
TMPFILES:=$(DESTDIR)$(shell pkg-config systemd --variable=tmpfilesdir)
87
SYSTEMD:=$(DESTDIR)$(shell $(PKG_CONFIG) systemd \
88
--variable=systemdsystemunitdir)
89
TMPFILES:=$(DESTDIR)$(shell $(PKG_CONFIG) systemd \
90
--variable=tmpfilesdir)
86
GNUTLS_CFLAGS:=$(shell pkg-config --cflags-only-I gnutls)
87
GNUTLS_LIBS:=$(shell pkg-config --libs gnutls)
88
AVAHI_CFLAGS:=$(shell pkg-config --cflags-only-I avahi-core)
89
AVAHI_LIBS:=$(shell pkg-config --libs avahi-core)
92
GNUTLS_CFLAGS:=$(shell $(PKG_CONFIG) --cflags-only-I gnutls)
93
GNUTLS_LIBS:=$(shell $(PKG_CONFIG) --libs gnutls)
94
AVAHI_CFLAGS:=$(shell $(PKG_CONFIG) --cflags-only-I avahi-core)
95
AVAHI_LIBS:=$(shell $(PKG_CONFIG) --libs avahi-core)
90
96
GPGME_CFLAGS:=$(shell gpgme-config --cflags; getconf LFS_CFLAGS)
91
97
GPGME_LIBS:=$(shell gpgme-config --libs; getconf LFS_LIBS; \
92
98
getconf LFS_LDFLAGS)
93
LIBNL3_CFLAGS:=$(shell pkg-config --cflags-only-I libnl-route-3.0)
94
LIBNL3_LIBS:=$(shell pkg-config --libs libnl-route-3.0)
95
GLIB_CFLAGS:=$(shell pkg-config --cflags glib-2.0)
96
GLIB_LIBS:=$(shell pkg-config --libs glib-2.0)
99
LIBNL3_CFLAGS:=$(shell $(PKG_CONFIG) --cflags-only-I libnl-route-3.0)
100
LIBNL3_LIBS:=$(shell $(PKG_CONFIG) --libs libnl-route-3.0)
101
GLIB_CFLAGS:=$(shell $(PKG_CONFIG) --cflags glib-2.0)
102
GLIB_LIBS:=$(shell $(PKG_CONFIG) --libs glib-2.0)
98
104
# Do not change these two
99
105
CFLAGS+=$(WARN) $(DEBUG) $(FORTIFY) $(COVERAGE) \
312
318
./dracut-module/password-agent --test
314
320
# Run the client with a local config and key
315
run-client: all keydir/seckey.txt keydir/pubkey.txt keydir/tls-privkey.pem keydir/tls-pubkey.pem
316
@echo "###################################################################"
317
@echo "# The following error messages are harmless and can be safely #"
319
@echo "# From plugin-runner: setgid: Operation not permitted #"
320
@echo "# setuid: Operation not permitted #"
321
@echo "# From askpass-fifo: mkfifo: Permission denied #"
322
@echo "# From mandos-client: #"
323
@echo "# Failed to raise privileges: Operation not permitted #"
324
@echo "# Warning: network hook \"*\" exited with status * #"
326
@echo "# (The messages are caused by not running as root, but you should #"
327
@echo "# NOT run \"make run-client\" as root unless you also unpacked and #"
328
@echo "# compiled Mandos as root, which is also NOT recommended.) #"
329
@echo "###################################################################"
321
run-client: all keydir/seckey.txt keydir/pubkey.txt \
322
keydir/tls-privkey.pem keydir/tls-pubkey.pem
323
@echo '######################################################'
324
@echo '# The following error messages are harmless and can #'
325
@echo '# be safely ignored: #'
326
@echo '## From plugin-runner: #'
327
@echo '# setgid: Operation not permitted #'
328
@echo '# setuid: Operation not permitted #'
329
@echo '## From askpass-fifo: #'
330
@echo '# mkfifo: Permission denied #'
331
@echo '## From mandos-client: #'
332
@echo '# Failed to raise privileges: Operation not permi... #'
333
@echo '# Warning: network hook "*" exited with status * #'
334
@echo '# ioctl SIOCSIFFLAGS +IFF_UP: Operation not permi... #'
335
@echo '# Failed to bring up interface "*": Operation not... #'
337
@echo '# (The messages are caused by not running as root, #'
338
@echo '# but you should NOT run "make run-client" as root #'
339
@echo '# unless you also unpacked and compiled Mandos as #'
340
@echo '# root, which is also NOT recommended.) #'
341
@echo '######################################################'
330
342
# We set GNOME_KEYRING_CONTROL to block pam_gnome_keyring
331
343
./plugin-runner --plugin-dir=plugins.d \
332
344
--plugin-helper-dir=plugin-helpers \
372
384
elif install --directory --mode=u=rwx $(STATEDIR); then \
373
385
chown -- $(USER):$(GROUP) $(STATEDIR) || :; \
375
if [ "$(TMPFILES)" != "$(DESTDIR)" -a -d "$(TMPFILES)" ]; then \
387
if [ "$(TMPFILES)" != "$(DESTDIR)" \
388
-a -d "$(TMPFILES)" ]; then \
376
389
install --mode=u=rw,go=r tmpfiles.d-mandos.conf \
377
390
$(TMPFILES)/mandos.conf; \
425
438
install --mode=u=rwx,go=rx \
426
439
--target-directory=$(LIBDIR)/mandos plugin-runner
427
440
install --mode=u=rwx,go=rx \
428
--target-directory=$(LIBDIR)/mandos mandos-to-cryptroot-unlock
441
--target-directory=$(LIBDIR)/mandos \
442
mandos-to-cryptroot-unlock
429
443
install --mode=u=rwx,go=rx --target-directory=$(PREFIX)/sbin \
431
445
install --mode=u=rwx,go=rx \
494
508
if command -v update-initramfs >/dev/null; then \
495
509
update-initramfs -k all -u; \
496
510
elif command -v dracut >/dev/null; then \
497
for initrd in $(DESTDIR)/boot/initr*-$(shell uname --kernel-release); do \
511
for initrd in $(DESTDIR)/boot/initr*-$(LINUXVERSION); do \
498
512
if [ -w "$$initrd" ]; then \
499
513
chmod go-r "$$initrd"; \
500
514
dracut --force "$$initrd"; \
553
567
if command -v update-initramfs >/dev/null; then \
554
568
update-initramfs -k all -u; \
555
569
elif command -v dracut >/dev/null; then \
556
for initrd in $(DESTDIR)/boot/initr*-$(shell uname --kernel-release); do \
570
for initrd in $(DESTDIR)/boot/initr*-$(LINUXVERSION); do \
557
571
test -w "$$initrd" && dracut --force "$$initrd"; \