Splux Linux

source-based Linux using SPS

SPS · log · files · refs · tags · releases · people · languages · GitHub · commit

bc3cdad


install: abort if a program destination is an existing directory

Date
Commitbc3cdad080444c5908be7a567f47515c5829511a
GitHubmirror

Parents

Stat

 Makefile | 5 +++++
 1 file changed, 5 insertions(+)

Diff

diff --git a/Makefile b/Makefile
index 64182f9..a08bda7 100644
--- a/Makefile
+++ b/Makefile
@@ -36,6 +36,11 @@ install:
 	install -d "$(DESTDIR)$(BINDIR)" "$(DESTDIR)$(LIBDIR)" \
 		"$(DESTDIR)$(MANDIR)/man1" "$(DESTDIR)$(MANDIR)/man5"
 	@set -e; for program in $(PROGRAMS); do \
+		if [ -d "$(DESTDIR)$(BINDIR)/$$program" ]; then \
+			printf '%s: error: %s is a directory; %s command would be shadowed\n' \
+				"$0" "$(DESTDIR)$(BINDIR)/$$program" "$$program" >&2; \
+			exit 1; \
+		fi; \
 		install -m 0755 bin/$$program "$(DESTDIR)$(BINDIR)/$$program"; \
 	done
 	@set -e; for library in lib/*.awk lib/*.sh; do \