Bug 136822

Summary: www/hiawatha port overwrites existing config-files
Product: Ports & Packages Reporter: Martin Lesser <ml-freebsd>
Component: Individual Port(s)Assignee: Wesley Shields <wxs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   

Description Martin Lesser 2009-07-16 16:20:06 UTC
After a portuprade all config-files in /usr/local/etc/hiawatha were replaced with the default-configs from the distribution.

Fix: 

Fix /usr/ports/www/hiawatha/Makefile so it does not overwrite existing configs.
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2009-07-16 22:51:41 UTC
Class Changed
From-To: maintainer-update->change-request

Fix category (submitter is not maintainer) (via the GNATS Auto Assign 
Tool)
Comment 2 Edwin Groothuis freebsd_committer freebsd_triage 2009-07-16 22:51:43 UTC
Maintainer of www/hiawatha,

Please note that PR ports/136822 has just been submitted.

If it contains a patch for an upgrade, an enhancement or a bug fix
you agree on, reply to this email stating that you approve the patch
and a committer will take care of it.

The full text of the PR can be found at:
    http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/136822

-- 
Edwin Groothuis via the GNATS Auto Assign Tool
edwin@FreeBSD.org
Comment 3 Edwin Groothuis freebsd_committer freebsd_triage 2009-07-16 22:51:44 UTC
State Changed
From-To: open->feedback

Awaiting maintainers feedback (via the GNATS Auto Assign Tool)
Comment 4 Hugo Leisink 2009-07-16 23:02:45 UTC
I don't have enough FreeBSD knowledge to solve this problem. I can use 
some help on this one.

greetings,
Hugo

> Maintainer of www/hiawatha,
>
> Please note that PR ports/136822 has just been submitted.
>
> If it contains a patch for an upgrade, an enhancement or a bug fix
> you agree on, reply to this email stating that you approve the patch
> and a committer will take care of it.
>
> The full text of the PR can be found at:
>     http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/136822
>
>
Comment 5 Wesley Shields freebsd_committer freebsd_triage 2009-07-16 23:38:50 UTC
Responsible Changed
From-To: freebsd-ports-bugs->wxs

I'll take it.
Comment 6 Wesley Shields freebsd_committer freebsd_triage 2009-07-16 23:42:06 UTC
On Thu, Jul 16, 2009 at 10:20:04PM +0000, Hugo Leisink wrote:
>  I don't have enough FreeBSD knowledge to solve this problem. I can use 
>  some help on this one.

This URL details what you need to do:
http://www.freebsd.org/doc/en/books/porters-handbook/plist-config.html

If you need further assistance with it please let me know and I can come
up with a patch when time permits, but I think it's best for you, as
maintainer, to learn it. :)

I've gone ahead and assigned this PR to myself so that I can keep track
of it and work with you if you need further help.

-- WXS
Comment 7 ml 2009-07-17 10:00:03 UTC
Here's a patch with two issues remaining open:

1. /usr/local/www/hiawatha/index.html should not be overwritten but I
   have no idea why this happens (Makefile.am from original
   distribution?)

2. Some of the exec/unexec commands in pkg-plist may be shortened with
   i.e. @dirrmtry. In general I'm not sure whether my changes to
   pkg-plist are "state of the art" or could be done better.

Cheers

Martin

diff -ur /usr/ports/www/hiawatha/Makefile /usr/local/ports/www/hiawatha/Makefile
--- /usr/ports/www/hiawatha/Makefile	2009-07-08 03:01:38.000000000 +0200
+++ /usr/local/ports/www/hiawatha/Makefile	2009-07-17 09:03:04.000000000 +0200
@@ -72,9 +72,19 @@
 	@${INSTALL_DATA} ${EXAMPLES:S,^,${WRKSRC}/extra/,} ${EXAMPLESDIR}/
 .endif
 	@${INSTALL_MAN} ${MAN1:S,^,${WRKSRC}/doc/,} ${MAN1PREFIX}/man/man1/
-	@${INSTALL_DATA} ${CONFIG_FILES:S,^,${WRKSRC}/etc/${PORTNAME}/,} ${ETCDIR}/
-	@${MKDIR} ${WWWDIR}
-	@${CP} -f ${WRKSRC}/doc/index.html ${WWWDIR}/
+.for FILE in ${CONFIG_FILES}
+	@${INSTALL_DATA} ${WRKSRC}/etc/hiawatha/${FILE} ${PREFIX}/etc/hiawatha/${FILE}.sample
+	@if [ ! -f ${PREFIX}/etc/hiawatha/${FILE} ]; then \
+		${CP} -p ${WRKSRC}/etc/hiawatha/${FILE} ${PREFIX}/etc/hiawatha/${FILE} ; \
+	fi
+.endfor
+	@if [ ! -d ${WWWDIR} ]; then \
+		@${MKDIR} ${WWWDIR} ; \
+	fi
+	@${CP} ${WRKSRC}/doc/index.html ${WWWDIR}/index.hiawatha.html
+	@if [ ! -f ${WWWDIR}/index.html ] ; then \
+		${CP} ${WRKSRC}/doc/index.html ${WWWDIR}/ ; \
+	fi
 	@${CAT} ${PKGMESSAGE}
 
 .include <bsd.port.post.mk>
diff -ur /usr/ports/www/hiawatha/files/pkg-message.in /usr/local/ports/www/hiawatha/files/pkg-message.in
--- /usr/ports/www/hiawatha/files/pkg-message.in	2008-02-17 13:24:03.000000000 +0100
+++ /usr/local/ports/www/hiawatha/files/pkg-message.in	2009-07-17 08:27:04.000000000 +0200
@@ -2,7 +2,7 @@
 
 The Hiawatha webserver is now installed.
 
-Edit the configuration files in %%ETCDIRX%% to suit your needs.
+Edit the configuration files in %%ETCDIR%% to suit your needs.
 
 Add hiawatha_enable="YES" to rc.conf and start Hiawatha by running:
 %%PREFIX%%/etc/rc.d/hiawatha start
diff -ur /usr/ports/www/hiawatha/pkg-plist /usr/local/ports/www/hiawatha/pkg-plist
--- /usr/ports/www/hiawatha/pkg-plist	2009-07-08 03:01:38.000000000 +0200
+++ /usr/local/ports/www/hiawatha/pkg-plist	2009-07-17 09:40:12.000000000 +0200
@@ -4,11 +4,24 @@
 sbin/newroot
 sbin/php-fcgi
 sbin/wigwam
-%%ETCDIR%%/cgi-wrapper.conf
-%%ETCDIR%%/httpd.conf
-%%ETCDIR%%/mimetype.conf
-%%ETCDIR%%/php-fcgi.conf
-%%WWWDIR%%/index.html
+@unexec if cmp -s %D/etc/hiawatha/cgi-wrapper.conf.sample %D/etc/hiawatha/cgi-wrapper.conf ; then rm -f %D/etc/hiawatha/cgi-wrapper.conf; fi
+%%ETCDIR%%/cgi-wrapper.conf.sample
+@exec if [ ! -f %D/etc/hiawatha/cgi-wrapper.conf ] ; then cp -p %D/%F %%ETCDIR%%/cgi-wrapper.conf; fi
+@unexec if cmp -s %D/etc/hiawatha/httpd.conf.sample %D/etc/hiawatha/httpd.conf ; then rm -f %D/etc/hiawatha/httpd.conf; fi
+%%ETCDIR%%/httpd.conf.sample
+@exec if [ ! -f %D/etc/hiawatha/httpd.conf ] ; then cp -p %D/%F %%ETCDIR%%/httpd.conf; fi
+@unexec if cmp -s %D/etc/hiawatha/mimetype.conf.sample %D/etc/hiawatha/mimetype.conf ; then rm -f %D/etc/hiawatha/mimetype.conf; fi
+%%ETCDIR%%/mimetype.conf.sample
+@exec if [ ! -f %D/etc/hiawatha/mimetype.conf ] ; then cp -p %D/%F %%ETCDIR%%/mimetype.conf; fi
+@unexec if cmp -s %D/etc/hiawatha/php-fcgi.conf.sample %D/etc/hiawatha/php-fcgi.conf ; then rm -f %D/etc/hiawatha/php-fcgi.conf; fi
+%%ETCDIR%%/php-fcgi.conf.sample
+@exec if [ ! -f %D/etc/hiawatha/php-fcgi.conf ] ; then cp -p %D/%F %%ETCDIR%%/php-fcgi.conf; fi
+@unexec t=`/bin/ls %D/etc/hiawatha`; if [ -z "$t" ]; then echo "Configuration directory is empty, remove it."; rmdir %D/etc/hiawatha; fi;
+@unexec t=`/bin/ls /var/log/hiawatha`; if [ -z "$t" ]; then echo "Log directory is empty, remove it."; rmdir /var/log/hiawatha; fi;
+@unexec if cmp -s %D/www/hiawatha/index.html %D/www/hiawatha/index.hiawatha.html ; then rm -f %D/www/hiawatha/index.html; fi
+%%WWWDIR%%/index.hiawatha.html
+@exec if [ ! -f %D/www/hiawatha/index.html ] ; then cp -p %D/%F %%WWWDIR%%/index.html; fi
+@unexec t=`/bin/ls %D/www/hiawatha`; if [ -z "$t" ]; then echo "WWW directory is empty, remove it."; rmdir %D/www/hiawatha; fi;
 %%PORTDOCS%%%%DOCSDIR%%/AUTHORS
 %%PORTDOCS%%%%DOCSDIR%%/COPYING
 %%PORTDOCS%%%%DOCSDIR%%/ChangeLog
@@ -17,7 +30,5 @@
 %%PORTEXAMPLES%%%%EXAMPLESDIR%%/mkcert
 %%PORTEXAMPLES%%%%EXAMPLESDIR%%/newroot
 %%PORTEXAMPLES%%%%EXAMPLESDIR%%/php-fcgi
-@dirrm %%ETCDIR%%
-@dirrm %%WWWDIR%%
 %%PORTDOCS%%@dirrm %%DOCSDIR%%
 %%PORTEXAMPLES%%@dirrm %%EXAMPLESDIR%%
Comment 8 Wesley Shields freebsd_committer freebsd_triage 2009-08-01 16:16:00 UTC
State Changed
From-To: feedback->closed

Committed. Thanks!
Comment 9 dfilter service freebsd_committer freebsd_triage 2009-08-01 16:16:08 UTC
wxs         2009-08-01 15:15:54 UTC

  FreeBSD ports repository

  Modified files:
    www/hiawatha         Makefile pkg-plist 
    www/hiawatha/files   pkg-message.in 
  Log:
  - Don't overwrite configuration files, or index.html.
  - s/ETCDIRX/ETCDIR/ in files/pkg-message.in
  
  PR:             ports/136822
  Submitted by:   Martin Lesser <ml@bettercom.de>
  Approved by:    maintainer timeout
  
  Revision  Changes    Path
  1.18      +13 -3     ports/www/hiawatha/Makefile
  1.3       +1 -1      ports/www/hiawatha/files/pkg-message.in
  1.8       +18 -7     ports/www/hiawatha/pkg-plist
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"