Make install locations more configurable and clean up
Makefile: Change Makefile to allow installation of keyring data, systemd units and scripts more configurable. This allows user provided overrides via KEYRING_TARGET_DIR, SCRIPT_TARGET_DIR, SYSTEMD_SYSTEM_UNIT_DIR. Instead of relying on wildcards, rely on specifically named files, as this can be reused also in the uninstall target without issue and provides a clearer overview of what will be installed/uninstalled. Specifically only make use of DESTDIR in the install and uninstall targets, which allows easier overrides. Extend uninstall target to also remove WKD sync related script and systemd units.
This commit is contained in:
parent
3e24dfe0a0
commit
1dfc921a87
36
Makefile
36
Makefile
@ -1,12 +1,14 @@
|
|||||||
PREFIX ?= /usr/local
|
PREFIX ?= /usr/local
|
||||||
KEYRING_TARGET_DIR=$(DESTDIR)$(PREFIX)/share/pacman/keyrings/
|
KEYRING_TARGET_DIR ?= $(PREFIX)/share/pacman/keyrings/
|
||||||
KEYRING_FILES=$(wildcard build/*.gpg) $(wildcard build/*-revoked) $(wildcard build/*-trusted)
|
SCRIPT_TARGET_DIR ?= $(PREFIX)/bin/
|
||||||
SCRIPT_TARGET_DIR=$(DESTDIR)$(PREFIX)/bin/
|
SYSTEMD_SYSTEM_UNIT_DIR ?= $(shell pkgconf --variable systemd_system_unit_dir systemd)
|
||||||
SCRIPT_FILES=wkd_sync/archlinux-keyring-wkd-sync
|
KEYRING_FILE=archlinux.gpg
|
||||||
SYSTEMD_SYSTEM_UNIT_DIR=$(DESTDIR)$(shell pkgconf --variable systemd_system_unit_dir systemd)
|
KEYRING_REVOKED_FILE=archlinux-revoked
|
||||||
SYSTEMD_FILES=$(wildcard wkd_sync/*.service) $(wildcard wkd_sync/*.timer)
|
KEYRING_TRUSTED_FILE=archlinux-trusted
|
||||||
|
WKD_SYNC_SCRIPT=archlinux-keyring-wkd-sync
|
||||||
|
WKD_SYNC_SERVICE=archlinux-keyring-wkd-sync.service
|
||||||
|
WKD_SYNC_TIMER=archlinux-keyring-wkd-sync.timer
|
||||||
SYSTEMD_TIMER_DIR=$(SYSTEMD_SYSTEM_UNIT_DIR)/timers.target.wants/
|
SYSTEMD_TIMER_DIR=$(SYSTEMD_SYSTEM_UNIT_DIR)/timers.target.wants/
|
||||||
SYSTEMD_TIMER_FILE=archlinux-keyring-wkd-sync.timer
|
|
||||||
SOURCES := $(shell find keyring) $(shell find libkeyringctl -name '*.py' -or -type d) keyringctl
|
SOURCES := $(shell find keyring) $(shell find libkeyringctl -name '*.py' -or -type d) keyringctl
|
||||||
|
|
||||||
all: build
|
all: build
|
||||||
@ -36,14 +38,20 @@ clean:
|
|||||||
rm -rf build
|
rm -rf build
|
||||||
|
|
||||||
install: build
|
install: build
|
||||||
install -vDm 644 $(KEYRING_FILES) -t $(KEYRING_TARGET_DIR)
|
install -vDm 644 build/{$(KEYRING_FILE),$(KEYRING_REVOKED_FILE),$(KEYRING_TRUSTED_FILE)} -t $(DESTDIR)$(KEYRING_TARGET_DIR)
|
||||||
install -vDm 755 $(SCRIPT_FILES) -t $(SCRIPT_TARGET_DIR)
|
install -vDm 755 wkd_sync/$(WKD_SYNC_SCRIPT) -t $(DESTDIR)$(SCRIPT_TARGET_DIR)
|
||||||
install -vDm 644 $(SYSTEMD_FILES) -t $(SYSTEMD_SYSTEM_UNIT_DIR)
|
install -vDm 644 wkd_sync/{$(WKD_SYNC_SERVICE),$(WKD_SYNC_TIMER)} -t $(DESTDIR)$(SYSTEMD_SYSTEM_UNIT_DIR)
|
||||||
install -vdm 755 $(SYSTEMD_TIMER_DIR)
|
install -vdm 755 $(DESTDIR)$(SYSTEMD_TIMER_DIR)
|
||||||
ln -sv ../$(SYSTEMD_TIMER_FILE) $(SYSTEMD_TIMER_DIR)/$(SYSTEMD_TIMER_FILE)
|
ln -sv ../$(WKD_SYNC_TIMER) $(DESTDIR)$(SYSTEMD_TIMER_DIR)/$(WKD_SYNC_TIMER)
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
rm -f $(KEYRING_TARGET_DIR)/archlinux{.gpg,-trusted,-revoked}
|
rm -fv $(DESTDIR)$(KEYRING_TARGET_DIR)/{$(KEYRING_FILE),$(KEYRING_REVOKED_FILE),$(KEYRING_TRUSTED_FILE)}
|
||||||
rmdir -p --ignore-fail-on-non-empty $(KEYRING_TARGET_DIR)
|
rmdir -pv --ignore-fail-on-non-empty $(DESTDIR)$(KEYRING_TARGET_DIR)
|
||||||
|
rm -v $(DESTDIR)$(SCRIPT_TARGET_DIR)/$(WKD_SYNC_SCRIPT)
|
||||||
|
rmdir -pv --ignore-fail-on-non-empty $(DESTDIR)$(SCRIPT_TARGET_DIR)
|
||||||
|
rm -v $(DESTDIR)$(SYSTEMD_SYSTEM_UNIT_DIR)/{$(WKD_SYNC_SERVICE),$(WKD_SYNC_TIMER)}
|
||||||
|
rmdir -pv --ignore-fail-on-non-empty $(DESTDIR)$(SYSTEMD_SYSTEM_UNIT_DIR)
|
||||||
|
rm -v $(DESTDIR)$(SYSTEMD_TIMER_DIR)/$(WKD_SYNC_TIMER)
|
||||||
|
rmdir -pv --ignore-fail-on-non-empty $(DESTDIR)$(SYSTEMD_TIMER_DIR)
|
||||||
|
|
||||||
.PHONY: all lint fmt check test clean install uninstall
|
.PHONY: all lint fmt check test clean install uninstall
|
||||||
|
Loading…
Reference in New Issue
Block a user