about summary refs log tree commit diff stats
path: root/Makefile
diff options
context:
space:
mode:
authorBen Morrison <ben@gbmor.dev>2020-06-23 03:00:29 -0400
committerBen Morrison <ben@gbmor.dev>2020-06-23 03:00:29 -0400
commit72d297aef47f42c0f7e2f25d86d5ec4de4390f95 (patch)
tree7fbfb12af9915ab5a3345568a66362f106fdcd01 /Makefile
parentc37aa835d01010af1c486dec6625717a50472fc8 (diff)
downloadgetwtxt-72d297aef47f42c0f7e2f25d86d5ec4de4390f95.tar.gz
makefile now safely installs over older versions
checks for existence of getwtxt.yml, style.css, and index.html.
these files won't be overwritten, but the user is notified to
merge them manually.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile10
1 files changed, 6 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index db5f2bf..9cf7895 100644
--- a/Makefile
+++ b/Makefile
@@ -34,9 +34,9 @@ install:
 
 	@printf "\n%s\n" "Copying files..."
 	install -m755 getwtxt $(BINDIR)
-	install -m644 getwtxt.yml $(BINDIR)
-	install -m644 assets/style.css $(BINDIR)/assets
-	install -m644 assets/tmpl/index.html $(BINDIR)/assets/tmpl
+	@if [ -f "$(BINDIR)/getwtxt.yml" ]; then printf "%s\n" "getwtxt.yml exists. Skipping ..."; else printf "%s\n" "getwtxt.yml ..." && install -m644 getwtxt.yml "$(BINDIR)"; fi
+	@if [ -f "$(BINDIR)/assets/style.css" ]; then printf "%s\n" "style.css exists. Skipping ..."; else printf "%s\n" "style.css ..." && install -m644 assets/style.css "$(BINDIR)/assets/style.css"; fi
+	@if [ -f "$(BINDIR)/assets/tmpl/index.html" ]; then printf "%s\n" "tmpl/index.html exists. Skipping ..."; else printf "%s\n" "tmpl/index.html ..." && install -m644 assets/tmpl/index.html "$(BINDIR)/assets/tmpl/index.html"; fi
 	install -m644 static/kognise.water.css.dark.min.css $(BINDIR)/static
 	install -m644 README.md $(BINDIR)/docs
 	install -m644 LICENSE $(BINDIR)/docs
@@ -45,7 +45,9 @@ install:
 	@printf "\n%s\n" "Setting ownership..."
 	chown -R getwtxt:getwtxt $(BINDIR)
 
-	@printf "\n%s\n\t%s\n" "...Done! Don't forget to run:" "systemctl enable getwtxt"
+	@printf "\n%s\n" "If any files were skipped and there were changes upstream, you may need to merge them manually."
+
+	@printf "\n%s\n\t%s\n\n" "...Done! Don't forget to run:" "systemctl enable getwtxt"
 
 .PHONY: uninstall
 uninstall: