$NetBSD$

--- files/Makefile.orig	2008-10-30 11:28:59.000000000 +0000
+++ files/Makefile
@@ -47,26 +47,28 @@ clean:
 	find logs       \! -path "logs/CVS*"       \! -type d | xargs rm -f
 	rm -f  certs/*~ certs/\#*\#
 
+EXAMPLE_DIR=${PREFIX}/share/examples/prayer
+
 distclean:
 	rm -f certs/prayer.pem
 
 install-cert:
 	if [ -f certs/prayer.pem ]; then \
-	$(INSTALL) -o $(RO_USER) -g $(RO_GROUP) \
+	$(INSTALL) \
 	-m $(PRIVATE_FILE) certs/prayer.pem ${BROOT}${PREFIX}/certs; \
 	fi
 
 install-config: etc/prayer.cf
-	$(INSTALL) -D -o $(RO_USER) -g $(RO_GROUP) -m $(PUBLIC_FILE) \
-	etc/prayer.cf ${BROOT}${PRAYER_CONFIG_FILE}
+	$(INSTALL) -D $(DESTDIR) -m $(PUBLIC_FILE) \
+	etc/prayer.cf ${BROOT}${EXAMPLE_DIR}
 
 install-aconfig:
-	$(INSTALL) -D -o $(RO_USER) -g $(RO_GROUP) -m $(PUBLIC_FILE) \
-	etc/prayer-accountd.cf ${BROOT}${ACCOUNTD_CONFIG_FILE}
+	$(INSTALL) -D $(DESTDIR) -m $(PUBLIC_FILE) \
+	etc/prayer-accountd.cf ${BROOT}${EXAMPLE_DIR}
 
 install-motd:
-	$(INSTALL) -o $(RO_USER) -g $(RO_GROUP) -m $(PUBLIC_FILE) \
-	etc/motd.html ${BROOT}${PREFIX}/etc
+	$(INSTALL) -m $(PUBLIC_FILE) \
+	etc/motd.html ${BROOT}${EXAMPLE_DIR}
 
 install:
 	PREFIX=$(BROOT)$(PREFIX) VAR_PREFIX=$(BROOT)$(VAR_PREFIX) \
@@ -75,14 +77,14 @@ install:
 	PUBLIC_DIR=$(PUBLIC_DIR) PRIVATE_DIR=$(PRIVATE_DIR) \
 	PUBLIC_FILE=$(PUBLIC_FILE) PRIVATE_FILE=$(PRIVATE_FILE) \
 	PUBLIC_EXEC=$(PUBLIC_FILE) PRIVATE_EXEC=$(PRIVATE_EXEC) \
-	BIN_DIR=$(BIN_DIR) INSTALL=$(INSTALL) \
+	BIN_DIR=$(BIN_DIR) INSTALL="$(INSTALL)" \
 	./install.sh
 	if [ ! -f $(BROOT)$(PREFIX)/certs/prayer.pem ]; then $(MAKE) install-cert; fi
-	if [ ! -f $(BROOT)$(PRAYER_CONFIG_FILE) ]; then $(MAKE) install-config; fi
-	if [ ! -f $(BROOT)$(ACCOUNTD_CONFIG_FILE) ]; then $(MAKE) install-aconfig; fi
+	if [ ! -f $(BROOT)$(PRAYER_CONFIG_FILE_EXAMPLE) ]; then $(MAKE) install-config; fi
+	if [ ! -f $(BROOT)$(ACCOUNTD_CONFIG_FILE_EXAMPLE) ]; then $(MAKE) install-aconfig; fi
 	if [ ! -f $(BROOT)$(PREFIX)/etc/motd.html ]; then $(MAKE) install-motd; fi
 
 redhat-install-init.d:
-	install -D -o root -g root -m 755 \
+	install -D $(DESTDIR) -m 755 \
 		./init.d/prayer $(BROOT)/etc/rc.d/init.d/prayer
 	#chkconfig prayer --level 2345 on
