Skip to content

Commit 9975fac

Browse files
committed
build: add bash completion and uninstall target
Install a bash completion script that delegates to the pw binary itself. Also add an uninstall target and derive unitdir/datadir from the prefix variable so they stay consistent when prefix is overridden. Drop the nginx config from the install target since it requires manual editing before use. Signed-off-by: Robin Jarry <robin@jarry.cc>
1 parent d0508e3 commit 9975fac

2 files changed

Lines changed: 18 additions & 2 deletions

File tree

‎Makefile‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,25 @@ pw: $(src)
2424

2525
prefix ?= /usr
2626
sysconfdir ?= /etc
27-
unitdir ?= /usr/lib/systemd/system
27+
unitdir ?= $(prefix)/lib/systemd/system
28+
datadir ?= $(prefix)/share
2829

2930
.PHONY: install
3031
install: pw
3132
install -Dm755 pw $(DESTDIR)$(prefix)/bin/pw
3233
install -Dm644 etc/pw-http.service $(DESTDIR)$(unitdir)/pw-http.service
3334
install -Dm644 etc/pw-ingress.service $(DESTDIR)$(unitdir)/pw-ingress.service
34-
install -Dm644 etc/nginx.conf $(DESTDIR)$(sysconfdir)/nginx/conf.d/patchwork.conf
35+
install -Dm644 etc/pw.bash-completion $(DESTDIR)$(datadir)/bash-completion/completions/pw
3536
$(DESTDIR)$(prefix)/bin/pw config > $(DESTDIR)$(sysconfdir)/patchwork.toml
3637

38+
.PHONY: uninstall
39+
uninstall:
40+
rm -f $(DESTDIR)$(prefix)/bin/pw
41+
rm -f $(DESTDIR)$(unitdir)/pw-http.service
42+
rm -f $(DESTDIR)$(unitdir)/pw-ingress.service
43+
rm -f $(DESTDIR)$(datadir)/bash-completion/completions/pw
44+
rm -f $(DESTDIR)$(sysconfdir)/patchwork.toml
45+
3746
PYTHON ?= python3
3847

3948
.PHONY: docs

‎etc/pw.bash-completion‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
# Patchwork - automated patch tracking system
3+
# Copyright (C) The Patchwork Contributors (see CONTRIBUTORS)
4+
#
5+
# SPDX-License-Identifier: GPL-2.0-or-later
6+
7+
complete -C pw pw

0 commit comments

Comments
 (0)