/mandos/trunk

To get this branch, use:
bzr branch http://bzr.recompile.se/loggerhead/mandos/trunk

« back to all changes in this revision

Viewing changes to Makefile

  • Committer: Teddy Hogeborn
  • Date: 2019-08-18 00:23:21 UTC
  • Revision ID: teddy@recompile.se-20190818002321-qvjsogu0rhoyuwyc
Use the systemd sysusers.d mechanism, if present

* Makefile (SYSUSERS): New.
  (install-server): Also install sysusers.d file, if $(SYSUSERS)
                    exists.
* debian/mandos.dirs (usr/lib/sysusers.d): New.
* sysusers.d-mandos.conf: New.

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
LANGUAGE:=-std=gnu11
44
44
FEATURES:=-D_FILE_OFFSET_BITS=64
45
45
htmldir:=man
46
 
version:=1.8.9
 
46
version:=1.8.7
47
47
SED:=sed
48
48
PKG_CONFIG?=pkg-config
49
49
 
156
156
 
157
157
objects:=$(addsuffix .o,$(CPROGS))
158
158
 
159
 
.PHONY: all
160
159
all: $(PROGS) mandos.lsm
161
160
 
162
 
.PHONY: doc
163
161
doc: $(DOCS)
164
162
 
165
 
.PHONY: html
166
163
html: $(htmldocs)
167
164
 
168
165
%.5: %.xml common.ent legalnotice.xml
285
282
                $@)
286
283
 
287
284
# Need to add the GnuTLS, Avahi and GPGME libraries
288
 
plugins.d/mandos-client: CFLAGS += $(GNUTLS_CFLAGS) $(strip \
289
 
        ) $(AVAHI_CFLAGS) $(GPGME_CFLAGS)
290
 
plugins.d/mandos-client: LDLIBS += $(GNUTLS_LIBS) $(strip \
291
 
        ) $(AVAHI_LIBS) $(GPGME_LIBS)
 
285
plugins.d/mandos-client: plugins.d/mandos-client.c
 
286
        $(LINK.c) $^ $(GNUTLS_CFLAGS) $(AVAHI_CFLAGS) $(strip\
 
287
                ) $(GPGME_CFLAGS) $(GNUTLS_LIBS) $(strip\
 
288
                ) $(AVAHI_LIBS) $(GPGME_LIBS) $(LOADLIBES) $(strip\
 
289
                ) $(LDLIBS) -o $@
292
290
 
293
291
# Need to add the libnl-route library
294
 
plugin-helpers/mandos-client-iprouteadddel: CFLAGS += $(LIBNL3_CFLAGS)
295
 
plugin-helpers/mandos-client-iprouteadddel: LDLIBS += $(LIBNL3_LIBS)
 
292
plugin-helpers/mandos-client-iprouteadddel: plugin-helpers/mandos-client-iprouteadddel.c
 
293
        $(LINK.c) $(LIBNL3_CFLAGS) $^ $(LIBNL3_LIBS) $(strip\
 
294
                ) $(LOADLIBES) $(LDLIBS) -o $@
296
295
 
297
296
# Need to add the GLib and pthread libraries
298
 
dracut-module/password-agent: CFLAGS += $(GLIB_CFLAGS)
299
 
dracut-module/password-agent: LDLIBS += $(GLIB_LIBS) -lpthread
300
 
 
301
 
.PHONY: clean
 
297
dracut-module/password-agent: dracut-module/password-agent.c
 
298
        $(LINK.c) $(GLIB_CFLAGS) $^ $(GLIB_LIBS) -lpthread $(strip\
 
299
                ) $(LOADLIBES) $(LDLIBS) -o $@
 
300
 
 
301
.PHONY : all doc html clean distclean mostlyclean maintainer-clean \
 
302
        check run-client run-server install install-html \
 
303
        install-server install-client-nokey install-client uninstall \
 
304
        uninstall-server uninstall-client purge purge-server \
 
305
        purge-client
 
306
 
302
307
clean:
303
308
        -rm --force $(CPROGS) $(objects) $(htmldocs) $(DOCS) core
304
309
 
305
 
.PHONY: distclean
306
310
distclean: clean
307
 
.PHONY: mostlyclean
308
311
mostlyclean: clean
309
 
.PHONY: maintainer-clean
310
312
maintainer-clean: clean
311
313
        -rm --force --recursive keydir confdir statedir
312
314
 
313
 
.PHONY: check
314
315
check: all
315
316
        ./mandos --check
316
317
        ./mandos-ctl --check
320
321
        ./dracut-module/password-agent --test
321
322
 
322
323
# Run the client with a local config and key
323
 
.PHONY: run-client
324
324
run-client: all keydir/seckey.txt keydir/pubkey.txt \
325
325
                        keydir/tls-privkey.pem keydir/tls-pubkey.pem
326
326
        @echo '######################################################'
356
356
        ./mandos-keygen --dir keydir --force
357
357
 
358
358
# Run the server with a local config
359
 
.PHONY: run-server
360
359
run-server: confdir/mandos.conf confdir/clients.conf statedir
361
360
        ./mandos --debug --no-dbus --configdir=confdir \
362
361
                --statedir=statedir $(SERVERARGS)
373
372
statedir:
374
373
        install --directory statedir
375
374
 
376
 
.PHONY: install
377
375
install: install-server install-client-nokey
378
376
 
379
 
.PHONY: install-html
380
377
install-html: html
381
378
        install --directory $(htmldir)
382
379
        install --mode=u=rw,go=r --target-directory=$(htmldir) \
383
380
                $(htmldocs)
384
381
 
385
 
.PHONY: install-server
386
382
install-server: doc
387
383
        install --directory $(CONFDIR)
388
384
        if install --directory --mode=u=rwx --owner=$(USER) \
435
431
        gzip --best --to-stdout intro.8mandos \
436
432
                > $(MANDIR)/man8/intro.8mandos.gz
437
433
 
438
 
.PHONY: install-client-nokey
439
434
install-client-nokey: all doc
440
435
        install --directory $(LIBDIR)/mandos $(CONFDIR)
441
436
        install --directory --mode=u=rwx $(KEYDIR) \
442
437
                $(LIBDIR)/mandos/plugins.d \
443
438
                $(LIBDIR)/mandos/plugin-helpers
444
 
        if [ "$(SYSUSERS)" != "$(DESTDIR)" \
445
 
                        -a -d "$(SYSUSERS)" ]; then \
446
 
                install --mode=u=rw,go=r sysusers.d-mandos.conf \
447
 
                        $(SYSUSERS)/mandos-client.conf; \
448
 
        fi
449
439
        if [ "$(CONFDIR)" != "$(LIBDIR)/mandos" ]; then \
450
440
                install --mode=u=rwx \
451
441
                        --directory "$(CONFDIR)/plugins.d" \
520
510
        gzip --best --to-stdout dracut-module/password-agent.8mandos \
521
511
                > $(MANDIR)/man8/password-agent.8mandos.gz
522
512
 
523
 
.PHONY: install-client
524
513
install-client: install-client-nokey
525
514
# Post-installation stuff
526
515
        -$(PREFIX)/sbin/mandos-keygen --dir "$(KEYDIR)"
536
525
        fi
537
526
        echo "Now run mandos-keygen --password --dir $(KEYDIR)"
538
527
 
539
 
.PHONY: uninstall
540
528
uninstall: uninstall-server uninstall-client
541
529
 
542
 
.PHONY: uninstall-server
543
530
uninstall-server:
544
531
        -rm --force $(PREFIX)/sbin/mandos \
545
532
                $(PREFIX)/sbin/mandos-ctl \
552
539
        update-rc.d -f mandos remove
553
540
        -rmdir $(CONFDIR)
554
541
 
555
 
.PHONY: uninstall-client
556
542
uninstall-client:
557
543
# Refuse to uninstall client if /etc/crypttab is explicitly configured
558
544
# to use it.
594
580
            done; \
595
581
        fi
596
582
 
597
 
.PHONY: purge
598
583
purge: purge-server purge-client
599
584
 
600
 
.PHONY: purge-server
601
585
purge-server: uninstall-server
602
586
        -rm --force $(CONFDIR)/mandos.conf $(CONFDIR)/clients.conf \
603
587
                $(DESTDIR)/etc/dbus-1/system.d/mandos.conf
608
592
                $(DESTDIR)/var/run/mandos.pid
609
593
        -rmdir $(CONFDIR)
610
594
 
611
 
.PHONY: purge-client
612
595
purge-client: uninstall-client
613
596
        -shred --remove $(KEYDIR)/seckey.txt $(KEYDIR)/tls-privkey.pem
614
597
        -rm --force $(CONFDIR)/plugin-runner.conf \