/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.12
 
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 '######################################################'
354
354
keydir/seckey.txt keydir/pubkey.txt keydir/tls-privkey.pem keydir/tls-pubkey.pem: mandos-keygen
355
355
        install --directory keydir
356
356
        ./mandos-keygen --dir keydir --force
357
 
        if ! [ -e keydir/tls-privkey.pem ]; then \
358
 
                install --mode=u=rw /dev/null keydir/tls-privkey.pem; \
359
 
        fi
360
 
        if ! [ -e keydir/tls-pubkey.pem ]; then \
361
 
                install --mode=u=rw /dev/null keydir/tls-pubkey.pem; \
362
 
        fi
363
357
 
364
358
# Run the server with a local config
365
 
.PHONY: run-server
366
359
run-server: confdir/mandos.conf confdir/clients.conf statedir
367
360
        ./mandos --debug --no-dbus --configdir=confdir \
368
361
                --statedir=statedir $(SERVERARGS)
379
372
statedir:
380
373
        install --directory statedir
381
374
 
382
 
.PHONY: install
383
375
install: install-server install-client-nokey
384
376
 
385
 
.PHONY: install-html
386
377
install-html: html
387
378
        install --directory $(htmldir)
388
379
        install --mode=u=rw,go=r --target-directory=$(htmldir) \
389
380
                $(htmldocs)
390
381
 
391
 
.PHONY: install-server
392
382
install-server: doc
393
383
        install --directory $(CONFDIR)
394
384
        if install --directory --mode=u=rwx --owner=$(USER) \
441
431
        gzip --best --to-stdout intro.8mandos \
442
432
                > $(MANDIR)/man8/intro.8mandos.gz
443
433
 
444
 
.PHONY: install-client-nokey
445
434
install-client-nokey: all doc
446
435
        install --directory $(LIBDIR)/mandos $(CONFDIR)
447
436
        install --directory --mode=u=rwx $(KEYDIR) \
448
437
                $(LIBDIR)/mandos/plugins.d \
449
438
                $(LIBDIR)/mandos/plugin-helpers
450
 
        if [ "$(SYSUSERS)" != "$(DESTDIR)" \
451
 
                        -a -d "$(SYSUSERS)" ]; then \
452
 
                install --mode=u=rw,go=r sysusers.d-mandos.conf \
453
 
                        $(SYSUSERS)/mandos-client.conf; \
454
 
        fi
455
439
        if [ "$(CONFDIR)" != "$(LIBDIR)/mandos" ]; then \
456
440
                install --mode=u=rwx \
457
441
                        --directory "$(CONFDIR)/plugins.d" \
526
510
        gzip --best --to-stdout dracut-module/password-agent.8mandos \
527
511
                > $(MANDIR)/man8/password-agent.8mandos.gz
528
512
 
529
 
.PHONY: install-client
530
513
install-client: install-client-nokey
531
514
# Post-installation stuff
532
515
        -$(PREFIX)/sbin/mandos-keygen --dir "$(KEYDIR)"
542
525
        fi
543
526
        echo "Now run mandos-keygen --password --dir $(KEYDIR)"
544
527
 
545
 
.PHONY: uninstall
546
528
uninstall: uninstall-server uninstall-client
547
529
 
548
 
.PHONY: uninstall-server
549
530
uninstall-server:
550
531
        -rm --force $(PREFIX)/sbin/mandos \
551
532
                $(PREFIX)/sbin/mandos-ctl \
558
539
        update-rc.d -f mandos remove
559
540
        -rmdir $(CONFDIR)
560
541
 
561
 
.PHONY: uninstall-client
562
542
uninstall-client:
563
543
# Refuse to uninstall client if /etc/crypttab is explicitly configured
564
544
# to use it.
600
580
            done; \
601
581
        fi
602
582
 
603
 
.PHONY: purge
604
583
purge: purge-server purge-client
605
584
 
606
 
.PHONY: purge-server
607
585
purge-server: uninstall-server
608
586
        -rm --force $(CONFDIR)/mandos.conf $(CONFDIR)/clients.conf \
609
587
                $(DESTDIR)/etc/dbus-1/system.d/mandos.conf
614
592
                $(DESTDIR)/var/run/mandos.pid
615
593
        -rmdir $(CONFDIR)
616
594
 
617
 
.PHONY: purge-client
618
595
purge-client: uninstall-client
619
596
        -shred --remove $(KEYDIR)/seckey.txt $(KEYDIR)/tls-privkey.pem
620
597
        -rm --force $(CONFDIR)/plugin-runner.conf \