$NetBSD$

Do not set permissions here (handled by pkgsrc).
Install man pages to "man" instead of "share/man" directory.

--- Makefile.orig	2024-09-10 17:15:06.000000000 +0000
+++ Makefile
@@ -5,7 +5,7 @@
 
 include Makefile.inc
 
-UDBFILE=/var/spool/news/wendzelnntpd/usenet.db
+UDBFILE=$(DESTDIR)/var/spool/news/wendzelnntpd/usenet.db
 DESTCFLAGS=-DCONFDIR=\"$(CONFDIR)\"
 HEADERS=$(SRC)/include/cdpstrings.h $(SRC)/include/main.h $(SRC)/include/wendzelnntpdpath.h
 CFLAGS= -c -Wall $(STACK_PROT) $(DESTCFLAGS)
@@ -109,35 +109,35 @@ install : bin/wendzelnntpd bin/wendzelnn
 	if [ ! -d $(DESTDIR)/share ]; then install -d -m 0755 $(DESTDIR)/share; fi
 	if [ ! -d $(DESTDIR)/share/doc ]; then install -d -m 0755 $(DESTDIR)/share/doc; fi
 	if [ ! -d $(DESTDIR)/share/doc/wendzelnntpd ]; then install -d -m 0755 $(DESTDIR)/share/doc/wendzelnntpd; fi
-	if [ ! -d $(DESTDIR)/share/man/man8 ]; then install -d -m 0755 $(DESTDIR)/share/man/man8; fi
+	if [ ! -d $(DESTDIR)/man/man8 ]; then install -d -m 0755 $(DESTDIR)/man/man8; fi
 	# binaries
 	cp bin/wendzelnntpd bin/wendzelnntpadm $(DESTDIR)/sbin/
-	chown 0:0 $(DESTDIR)/sbin/wendzelnntpd $(DESTDIR)/sbin/wendzelnntpadm
-	chmod 0755 $(DESTDIR)/sbin/wendzelnntpd $(DESTDIR)/sbin/wendzelnntpadm
+	#chown 0:0 $(DESTDIR)/sbin/wendzelnntpd $(DESTDIR)/sbin/wendzelnntpadm
+	#chmod 0755 $(DESTDIR)/sbin/wendzelnntpd $(DESTDIR)/sbin/wendzelnntpadm
 	# documentation and config files
 	cp $(DOCFILES_TO_INST) $(DESTDIR)/share/doc/wendzelnntpd/
 	cp -r docs/docs $(DESTDIR)/share/doc/wendzelnntpd/
 	cp docs/docs.pdf $(DESTDIR)/share/doc/wendzelnntpd/docs.pdf
-	chown 0:0 $(DESTDIR)/share/doc/wendzelnntpd/*
-	chmod 0644 $(DESTDIR)/share/doc/wendzelnntpd/*
+	#chown 0:0 $(DESTDIR)/share/doc/wendzelnntpd/*
+	#chmod 0644 $(DESTDIR)/share/doc/wendzelnntpd/*
 	# manpages
-	cp $(MANPAGES) $(DESTDIR)/share/man/man8/
-	chmod 644 $(DESTDIR)/share/man/man8/wendzelnntpd.8
-	chmod 644 $(DESTDIR)/share/man/man8/wendzelnntpadm.8
+	cp $(MANPAGES) $(DESTDIR)/man/man8/
+	#chmod 644 $(DESTDIR)/man/man8/wendzelnntpd.8
+	#chmod 644 $(DESTDIR)/man/man8/wendzelnntpadm.8
 	# config
-	@if [ -f $(FAKECDIR)/wendzelnntpd.conf ]; then cp $(FAKECDIR)/wendzelnntpd.conf $(FAKECDIR)/wendzelnntpd.conf.bkp; chmod 0644 $(FAKECDIR)/wendzelnntpd.conf.bkp; echo "***Your old wendzelnntpd.conf was backuped!***"; fi
+	#@if [ -f $(FAKECDIR)/wendzelnntpd.conf ]; then cp $(FAKECDIR)/wendzelnntpd.conf $(FAKECDIR)/wendzelnntpd.conf.bkp; chmod 0644 $(FAKECDIR)/wendzelnntpd.conf.bkp; echo "***Your old wendzelnntpd.conf was backuped!***"; fi
 	cp $(CONFFILE) $(FAKECDIR)/wendzelnntpd.conf
-	chown 0:0 $(FAKECDIR)/wendzelnntpd.conf
-	chmod 0644 $(FAKECDIR)/wendzelnntpd.conf
+	#chown 0:0 $(FAKECDIR)/wendzelnntpd.conf
+	#chmod 0644 $(FAKECDIR)/wendzelnntpd.conf
 	# nextmsgid and database/usenet.db are placed here:
-	mkdir -p /var/spool/news/wendzelnntpd
+	mkdir -p $(DESTDIR)/var/spool/news/wendzelnntpd
 	# og-rwx since the passwords are stored in the database too!
-	chmod 700 /var/spool/news/wendzelnntpd
+	#chmod 700 /var/spool/news/wendzelnntpd
 	# create a backup of the old usenet database, if needed (only if not dev-mode)
-	@if [ -f $(UDBFILE) ] && [ $(CONFFILE) != *"dev"* ]; then mv $(UDBFILE) $(UDBFILE).`date +"%m-%d-%y-%H:%M"`.bkp; chmod 0600 $(UDBFILE).`date +"%m-%d-%y-%H:%M"`.bkp; echo "***Your old usenet database was backuped!***"; fi
+	#@if [ -f $(UDBFILE) ] && [ $(CONFFILE) != *"dev"* ]; then mv $(UDBFILE) $(UDBFILE).`date +"%m-%d-%y-%H:%M"`.bkp; chmod 0600 $(UDBFILE).`date +"%m-%d-%y-%H:%M"`.bkp; echo "***Your old usenet database was backuped!***"; fi
 			
 	@# create new database, dir already exists due to earlier mkdir call
-	install -d -m 0700 $(CMD_INSTALL_USEROPT) 0 -g 0 /var/spool/news/wendzelnntpd
+	install -d -m 0700 $(CMD_INSTALL_USEROPT) 0 -g 0 $(DESTDIR)/var/spool/news/wendzelnntpd
 	@#
 	@# create sqlite initial database if Sqlite3 is used
 	@# AND
@@ -153,13 +153,13 @@ upgrade : bin/wendzelnntpd bin/wendzelnn
 	@read uselessinput
 	# binaries
 	cp bin/wendzelnntpd bin/wendzelnntpadm $(DESTDIR)/sbin/
-	chown 0:0 $(DESTDIR)/sbin/wendzelnntpd $(DESTDIR)/sbin/wendzelnntpadm
-	chmod 0755 $(DESTDIR)/sbin/wendzelnntpd $(DESTDIR)/sbin/wendzelnntpadm
+	#chown 0:0 $(DESTDIR)/sbin/wendzelnntpd $(DESTDIR)/sbin/wendzelnntpadm
+	#chmod 0755 $(DESTDIR)/sbin/wendzelnntpd $(DESTDIR)/sbin/wendzelnntpadm
 	# documentation
 	cp -r docs/docs $(DESTDIR)/share/doc/wendzelnntpd/
 	cp docs/docs.pdf $(DESTDIR)/share/doc/wendzelnntpd/docs.pdf
-	chown 0:0 $(DESTDIR)/share/doc/wendzelnntpd/*
-	chmod 0644 $(DESTDIR)/share/doc/wendzelnntpd/*
+	#chown 0:0 $(DESTDIR)/share/doc/wendzelnntpd/*
+	#chmod 0644 $(DESTDIR)/share/doc/wendzelnntpd/*
 	@echo "Upgrade finished. Thank you for upgrading and using this software. Have fun!"
 
 exec : bin/wendzelnntpd
