/mandos/release

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

« back to all changes in this revision

Viewing changes to Makefile

  • Committer: Teddy Hogeborn
  • Date: 2024-09-09 01:36:41 UTC
  • mto: This revision was merged to the branch mainline in revision 410.
  • Revision ID: teddy@recompile.se-20240909013641-6zu6kx2f7meu134k
Make all required directories when installing

When installing into a normal system, one can assume that target
directories, such as /usr/bin, already exists.  But when installing
into a subdirectory for the purpose of creating a package, one cannot
assume that all directories already exist.  Therefore, when
installing, we must not check if any directories exist, and must
instead always create any directories we want to install into.

* Makefile (confdir/mandos.conf, confdir/clients.conf, install-html):
  Use the "-D" option to "install" instead of creating the directory
  separately.
  (install-server): Move creation of $(CONFDIR) down to before it is
  needed.  Don't check if the $(TMPFILES) or $(SYSUSERS) directories
  exist; instead create them by using the "-D" option to "install".
  Create the $(PREFIX)/sbin directory.  Always use
  "--target-directory" if possible; i.e. if the file name is the same.
  Create the $(DBUSPOLICYDIR) and $(DESTDIR)/etc/init.d directories by
  using the "-D" option to "install".  Don't check if the $(SYSTEMD)
  directory exists; instead create it by using the "-D" option to
  "install".  Create the $(DESTDIR)/etc/default and $(MANDIR)/man8
  directories by using the "-D" option to "install".  Create the
  $(MANDIR)/man5 directories explicitly.
  (install-client-nokey): Remove unnecessary creation of the
  $(CONFDIR) directory.  Don't check if the $(SYSUSERS) directory
  exists; instead create it by using the "-D" option to "install".
  Move the "--directory" argument to be the first argument, for
  clarity.  Create the $(PREFIX)/sbin directory.  Use the "-D"
  argument to "install" when installing
  $(INITRAMFSTOOLS)/hooks/mandos,
  $(INITRAMFSTOOLS)/conf.d/mandos-conf,
  $(INITRAMFSTOOLS)/conf-hooks.d/zz-mandos,
  $(INITRAMFSTOOLS)/scripts/init-premount/mandos,
  $(INITRAMFSTOOLS)/scripts/local-premount/mandos,
  $(DRACUTMODULE)/ask-password-mandos.path, and
  $(DRACUTMODULE)/dracut-module/ask-password-mandos.service.  Create
  the $(MANDIR)/man8 directory.

Reported-By: Erich Eckner <erich@eckner.net>
Thanks: Erich Eckner <erich@eckner.net> for analysis

Show diffs side-by-side

added added

removed removed

Lines of Context:
375
375
 
376
376
# Used by run-server
377
377
confdir/mandos.conf: mandos.conf
378
 
        install --directory confdir
379
 
        install --mode=u=rw,go=r $^ $@
 
378
        install -D --mode=u=rw,go=r $^ $@
380
379
confdir/clients.conf: clients.conf keydir/seckey.txt keydir/tls-pubkey.pem
381
 
        install --directory confdir
382
 
        install --mode=u=rw $< $@
 
380
        install -D --mode=u=rw $< $@
383
381
# Add a client password
384
382
        ./mandos-keygen --dir keydir --password --no-ssh >> $@
385
383
statedir:
390
388
 
391
389
.PHONY: install-html
392
390
install-html: html
393
 
        install --directory $(htmldir)
394
 
        install --mode=u=rw,go=r --target-directory=$(htmldir) \
 
391
        install -D --mode=u=rw,go=r --target-directory=$(htmldir) \
395
392
                $(htmldocs)
396
393
 
397
394
.PHONY: install-server
398
395
install-server: doc
399
 
        install --directory $(CONFDIR)
400
396
        if install --directory --mode=u=rwx --owner=$(USER) \
401
397
                --group=$(GROUP) $(STATEDIR); then \
402
398
                :; \
403
399
        elif install --directory --mode=u=rwx $(STATEDIR); then \
404
400
                chown -- $(USER):$(GROUP) $(STATEDIR) || :; \
405
401
        fi
406
 
        if [ "$(TMPFILES)" != "$(DESTDIR)" \
407
 
                        -a -d "$(TMPFILES)" ]; then \
408
 
                install --mode=u=rw,go=r tmpfiles.d-mandos.conf \
 
402
        if [ "$(TMPFILES)" != "$(DESTDIR)" ]; then \
 
403
                install -D --mode=u=rw,go=r tmpfiles.d-mandos.conf \
409
404
                        $(TMPFILES)/mandos.conf; \
410
405
        fi
411
 
        if [ "$(SYSUSERS)" != "$(DESTDIR)" \
412
 
                        -a -d "$(SYSUSERS)" ]; then \
413
 
                install --mode=u=rw,go=r sysusers.d-mandos.conf \
 
406
        if [ "$(SYSUSERS)" != "$(DESTDIR)" ]; then \
 
407
                install -D --mode=u=rw,go=r sysusers.d-mandos.conf \
414
408
                        $(SYSUSERS)/mandos.conf; \
415
409
        fi
416
 
        install --mode=u=rwx,go=rx mandos $(PREFIX)/sbin/mandos
 
410
        install --directory $(PREFIX)/sbin
 
411
        install --mode=u=rwx,go=rx --target-directory=$(PREFIX)/sbin \
 
412
                mandos
417
413
        install --mode=u=rwx,go=rx --target-directory=$(PREFIX)/sbin \
418
414
                mandos-ctl
419
415
        install --mode=u=rwx,go=rx --target-directory=$(PREFIX)/sbin \
420
416
                mandos-monitor
 
417
        install --directory $(CONFDIR)
421
418
        install --mode=u=rw,go=r --target-directory=$(CONFDIR) \
422
419
                mandos.conf
423
420
        install --mode=u=rw --target-directory=$(CONFDIR) \
424
421
                clients.conf
425
 
        install --mode=u=rw,go=r dbus-mandos.conf \
 
422
        install -D --mode=u=rw,go=r dbus-mandos.conf \
426
423
                $(DBUSPOLICYDIR)/mandos.conf
427
 
        install --mode=u=rwx,go=rx init.d-mandos \
 
424
        install -D --mode=u=rwx,go=rx init.d-mandos \
428
425
                $(DESTDIR)/etc/init.d/mandos
429
 
        if [ "$(SYSTEMD)" != "$(DESTDIR)" -a -d "$(SYSTEMD)" ]; then \
430
 
                install --mode=u=rw,go=r mandos.service $(SYSTEMD); \
 
426
        if [ "$(SYSTEMD)" != "$(DESTDIR)" ]; then \
 
427
                install -D --mode=u=rw,go=r mandos.service \
 
428
                        $(SYSTEMD); \
431
429
        fi
432
 
        install --mode=u=rw,go=r default-mandos \
 
430
        install -D --mode=u=rw,go=r default-mandos \
433
431
                $(DESTDIR)/etc/default/mandos
434
432
        if [ -z $(DESTDIR) ]; then \
435
433
                update-rc.d mandos defaults 25 15;\
436
434
        fi
 
435
        install --directory $(MANDIR)/man8 $(MANDIR)/man5
437
436
        gzip --best --to-stdout mandos.8 \
438
437
                > $(MANDIR)/man8/mandos.8.gz
439
438
        gzip --best --to-stdout mandos-monitor.8 \
449
448
 
450
449
.PHONY: install-client-nokey
451
450
install-client-nokey: all doc
452
 
        install --directory $(LIBDIR)/mandos $(CONFDIR)
453
451
        install --directory --mode=u=rwx $(KEYDIR) \
454
452
                $(LIBDIR)/mandos/plugins.d \
455
453
                $(LIBDIR)/mandos/plugin-helpers
456
 
        if [ "$(SYSUSERS)" != "$(DESTDIR)" \
457
 
                        -a -d "$(SYSUSERS)" ]; then \
458
 
                install --mode=u=rw,go=r sysusers.d-mandos.conf \
 
454
        if [ "$(SYSUSERS)" != "$(DESTDIR)" ]; then \
 
455
                install -D --mode=u=rw,go=r sysusers.d-mandos.conf \
459
456
                        $(SYSUSERS)/mandos-client.conf; \
460
457
        fi
461
458
        if [ "$(CONFDIR)" != "$(LIBDIR)/mandos" ]; then \
462
 
                install --mode=u=rwx \
463
 
                        --directory "$(CONFDIR)/plugins.d" \
 
459
                install --directory \
 
460
                        --mode=u=rwx "$(CONFDIR)/plugins.d" \
464
461
                        "$(CONFDIR)/plugin-helpers"; \
465
462
        fi
466
 
        install --mode=u=rwx,go=rx --directory \
 
463
        install --directory --mode=u=rwx,go=rx \
467
464
                "$(CONFDIR)/network-hooks.d"
468
465
        install --mode=u=rwx,go=rx \
469
466
                --target-directory=$(LIBDIR)/mandos plugin-runner
470
467
        install --mode=u=rwx,go=rx \
471
468
                --target-directory=$(LIBDIR)/mandos \
472
469
                mandos-to-cryptroot-unlock
 
470
        install --directory $(PREFIX)/sbin
473
471
        install --mode=u=rwx,go=rx --target-directory=$(PREFIX)/sbin \
474
472
                mandos-keygen
475
473
        install --mode=u=rwx,go=rx \
493
491
        install --mode=u=rwx,go=rx \
494
492
                --target-directory=$(LIBDIR)/mandos/plugin-helpers \
495
493
                plugin-helpers/mandos-client-iprouteadddel
496
 
        install initramfs-tools-hook \
 
494
        install -D initramfs-tools-hook \
497
495
                $(INITRAMFSTOOLS)/hooks/mandos
498
 
        install --mode=u=rw,go=r initramfs-tools-conf \
 
496
        install -D --mode=u=rw,go=r initramfs-tools-conf \
499
497
                $(INITRAMFSTOOLS)/conf.d/mandos-conf
500
 
        install --mode=u=rw,go=r initramfs-tools-conf-hook \
 
498
        install -D --mode=u=rw,go=r initramfs-tools-conf-hook \
501
499
                $(INITRAMFSTOOLS)/conf-hooks.d/zz-mandos
502
 
        install initramfs-tools-script \
 
500
        install -D initramfs-tools-script \
503
501
                $(INITRAMFSTOOLS)/scripts/init-premount/mandos
504
 
        install initramfs-tools-script-stop \
 
502
        install -D initramfs-tools-script-stop \
505
503
                $(INITRAMFSTOOLS)/scripts/local-premount/mandos
506
 
        install --directory $(DRACUTMODULE)
507
 
        install --mode=u=rw,go=r --target-directory=$(DRACUTMODULE) \
 
504
        install -D --mode=u=rw,go=r \
 
505
                --target-directory=$(DRACUTMODULE) \
508
506
                dracut-module/ask-password-mandos.path \
509
507
                dracut-module/ask-password-mandos.service
510
508
        install --mode=u=rwxs,go=rx \
513
511
                dracut-module/cmdline-mandos.sh \
514
512
                dracut-module/password-agent
515
513
        install --mode=u=rw,go=r plugin-runner.conf $(CONFDIR)
 
514
        install --directory $(MANDIR)/man8
516
515
        gzip --best --to-stdout mandos-keygen.8 \
517
516
                > $(MANDIR)/man8/mandos-keygen.8.gz
518
517
        gzip --best --to-stdout plugin-runner.8mandos \