Skip to content
This repository was archived by the owner on Sep 30, 2021. It is now read-only.

Commit d57d76b

Browse files
committed
Add reinstall option, which doesn't clobber config file
1 parent 482776d commit d57d76b

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

Makefile

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,26 @@ BINDIR=$(PREFIX)/bin
55
all:
66
@echo "Run 'make install' for installation."
77
@echo "Run 'make uninstall' for uninstallation."
8+
@echo "Run 'make reinstall' for installation without clobbering existing config file."
89

9-
install:
10+
install-noconf:
1011
install -Dm755 create_ap $(DESTDIR)$(BINDIR)/create_ap
11-
install -Dm644 --backup=existing --suffix=.orig create_ap.conf $(DESTDIR)/etc/create_ap.conf
1212
[ ! -d /lib/systemd/system ] || install -Dm644 create_ap.service $(DESTDIR)$(PREFIX)/lib/systemd/system/create_ap.service
1313
[ ! -e /sbin/openrc-run ] || install -Dm755 create_ap.openrc $(DESTDIR)/etc/init.d/create_ap
1414
install -Dm644 bash_completion $(DESTDIR)$(PREFIX)/share/bash-completion/completions/create_ap
1515
install -Dm644 README.md $(DESTDIR)$(PREFIX)/share/doc/create_ap/README.md
1616

17+
install: install-noconf
18+
[ -e $(DESTDIR)/etc/create_ap.conf ] && echo "Existing $(DESTDIR)/etc/create_ap.conf will be renamed with .orig suffix" >&2
19+
install -Dm644 --backup=existing --suffix=.orig create_ap.conf $(DESTDIR)/etc/create_ap.conf
20+
21+
reinstall: install-noconf
22+
if [ -e $(DESTDIR)/etc/create_ap.conf ]; then \
23+
echo "Leaving existing $(DESTDIR)/etc/create_ap.conf unchanged" >&2; \
24+
else \
25+
install -Dm644 --backup=existing --suffix=.orig create_ap.conf $(DESTDIR)/etc/create_ap.conf; \
26+
fi
27+
1728
uninstall:
1829
rm -f $(DESTDIR)$(BINDIR)/create_ap
1930
rm -f $(DESTDIR)/etc/create_ap.conf

0 commit comments

Comments
 (0)