Make sure we don't overwrite an existing configuration on make install.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sun, 13 Apr 2014 20:34:51 +0000 (22:34 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sun, 13 Apr 2014 20:34:51 +0000 (22:34 +0200)
Makefile

index 1234f79..becf0da 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -39,6 +39,13 @@ install:
                $(DESTDIR)$(PREFIX)/lib/systemd/system
        $(INSTALL) -m 755 -o root -g root cubemap $(DESTDIR)$(PREFIX)/bin/cubemap
        $(INSTALL) -m 755 -o root -g root munin/cubemap munin/cubemap_input $(DESTDIR)$(PREFIX)/share/munin/plugins/
+       gzip -c cubemap.1 > $(DESTDIR)$(PREFIX)/share/man/man1/cubemap.1.gz
+       sed \
+               -e "s,@prefix@,$(PREFIX),g" \
+               -e "s,@sysconfdir@,$(SYSCONFDIR),g" \
+               cubemap.service.in > $(DESTDIR)$(PREFIX)/lib/systemd/system/cubemap.service
+       # Make sure we don't overwrite an existing configuration.
+       test ! -f $(DESTDIR)$(SYSCONFDIR)/cubemap.config
        sed \
                -e "s,cubemap\.stats,$(LOCALSTATEDIR)/lib/cubemap/\0,g" \
                -e "s,cubemap-input\.stats,$(LOCALSTATEDIR)/lib/cubemap/\0,g" \
@@ -47,11 +54,6 @@ install:
                -e 's,^stream,#\0,g' \
                -e 's,^udpstream,#\0,g' \
                cubemap.config.sample > $(DESTDIR)$(SYSCONFDIR)/cubemap.config
-       gzip -c cubemap.1 > $(DESTDIR)$(PREFIX)/share/man/man1/cubemap.1.gz
-       sed \
-               -e "s,@prefix@,$(PREFIX),g" \
-               -e "s,@sysconfdir@,$(SYSCONFDIR),g" \
-               cubemap.service.in > $(DESTDIR)$(PREFIX)/lib/systemd/system/cubemap.service
 
 .PHONY: clean install
 .SUFFIXES: