Subject: Re: pkg/22947
To: None <jlam@netbsd.org, gnats-admin@netbsd.org, pkgsrc-bugs@netbsd.org>
From: Greg A. Woods <woods@planix.com>
List: pkgsrc-bugs
Date: 03/21/2005 08:14:01
The following reply was made to PR pkg/22947; it has been noted by GNATS.

From: "Greg A. Woods" <woods@planix.com>
To: jlam@netbsd.org
Cc: pkgsrc-bugs@netbsd.org, gnats-admin@netbsd.org,
	NetBSD GNATS submissions and followups <gnats-bugs@netbsd.org>
Subject: Re: pkg/22947
Date: Mon, 21 Mar 2005 03:13:30 -0500 (EST)

 [ On Sunday, March 20, 2005 at 05:34:03 (+0000), jlam@netbsd.org wrote: ]
 > Subject: Re: pkg/22947
 >
 > Synopsis: cleanups for the messages printed by the script generated by pkg.install.mk
 > 
 > State-Changed-From-To: open->feedback
 > State-Changed-By: jlam@netbsd.org
 > State-Changed-When: Sun, 20 Mar 2005 05:34:03 +0000
 > State-Changed-Why:
 > The INSTALL/DEINSTALL script code has changed substantially.  Please let
 > me know if the error messages still need to be improved.  If you can,
 > please supply a patch against the current code.  Thanks!
 
 I did, and of course they do.
 
 The PR was submitted 2003/09/25 against the version dated 2003/09/17.
 
 Besides, it shouldn't be rocket science to figure out the intent of this
 patch just by reading it.....
 
 In any case here's a more current diff.
 
 -- 
 						Greg A. Woods
 
 H:+1 416 218-0098  W:+1 416 489-5852 x122  VE3TCP  RoboHack <woods@robohack.ca>
 Planix, Inc. <woods@planix.com>          Secrets of the Weird <woods@weird.com>
 
 
 cvs diff: Diffing mk/install
 Index: mk/install/deinstall
 ===================================================================
 RCS file: /cvs/master/m-NetBSD/main/pkgsrc/mk/install/deinstall,v
 retrieving revision 1.29
 diff -u -r1.29 deinstall
 --- mk/install/deinstall	11 Oct 2004 22:04:19 -0000	1.29
 +++ mk/install/deinstall	7 Jan 2005 04:16:15 -0000
 @@ -1,3 +1,4 @@
 +# -*- sh -*-
  # start of deinstall
  #
  # $NetBSD: deinstall,v 1.29 2004/10/11 22:04:19 reed Exp $
 Index: mk/install/install
 ===================================================================
 RCS file: /cvs/master/m-NetBSD/main/pkgsrc/mk/install/install,v
 retrieving revision 1.32
 diff -u -r1.32 install
 --- mk/install/install	11 Oct 2004 22:04:19 -0000	1.32
 +++ mk/install/install	30 Jan 2005 20:30:49 -0000
 @@ -1,3 +1,4 @@
 +# -*- sh -*-
  # start of install
  #
  # $NetBSD: install,v 1.32 2004/10/11 22:04:19 reed Exp $
 @@ -67,6 +68,7 @@
  		for userset; do
  			save_IFS="${IFS}"; IFS=":"
  			set -- ${userset}
 +			# user:group[:[userid][:[descr][:[home][:shell]]]]
  			user="$1"; group="$2"; userid="$3"
  			descr="${4:-${PKGBASE} ${user} user}"
  			home="${5:-@PKG_USER_HOME@}"
 @@ -240,7 +242,11 @@
  				msgadd "The following files should be created for ${PKGNAME}:"
  				msgadd ""
  			fi
 -			msgadd "#${file} (m=@CONF_FILES_MODE@)"
 +			if [ -e "${samplefile}" ]; then
 +				msgadd "#${file} (m=@CONF_FILES_MODE@) (see ${samplefile})"
 +			else
 +				msgadd "#${file} (m=@CONF_FILES_MODE@) (no example available)"
 +			fi
  		elif [ -f "${file}" ]; then
  			if [ ! "${file}" -ef "${samplefile}" ]; then
  				${ECHO} "	${file} already exists, example file is"
 @@ -253,6 +259,11 @@
  				${CHMOD} @CONF_FILES_MODE@ "${file}"
  			fi
  		fi
 +		if [ -f /etc/changelist ]; then
 +			if ! ${GREP} "^${file}\$" /etc/changelist; then
 +				${ECHO} "${file}" >> /etc/changelist
 +			fi
 +		fi
  	done
  	eval set -- ${SUPPORT_FILES}
  	while [ $# -gt 0 ]; do
 @@ -266,7 +277,11 @@
  				msgadd "The following files should be created for ${PKGNAME}:"
  				msgadd ""
  			fi
 -			msgadd "#${file} (m=@SUPPORT_FILES_MODE@)"
 +			if [ -e "${samplefile}" ]; then
 +				msgadd "#${file} (m=@SUPPORT_FILES_MODE@) (see ${samplefile})"
 +			else
 +				msgadd "#${file} (m=@SUPPORT_FILES_MODE@) (no example available)"
 +			fi
  		elif [ -f "${file}" ]; then
  			if [ ! "${file}" -ef "${samplefile}" ]; then
  				${ECHO} "	${file} already exists, example file is"
 @@ -290,14 +305,18 @@
  			if [ ${_print_file_header} -gt 0 ]; then
  				_print_file_header=0
  				msgadd ""
 -				msgadd "The following files should be created for ${PKGNAME}:"
 +				msgadd "The following configuration files should be created for ${PKGNAME}:"
  				msgadd ""
  			fi
 -			msgadd "#${file} (o=${owner}, g=${group}, m=${mode})"
 +			if [ -e "${samplefile}" ]; then
 +				msgadd "#${file} (owner=${owner}, group=${group}, mode=${mode}) (see ${samplefile})"
 +			else
 +				msgadd "#${file} (owner=${owner}, group=${group}, mode=${mode}) (no example available)"
 +			fi
  		elif [ -f ${file} ]; then
  			if [ ! "${file}" -ef "${samplefile}" ]; then
 -				${ECHO} "	${file} already exists, example file is"
 -				${ECHO} "	    ${samplefile}"
 +				${ECHO} "	${file} already exists"
 +				${ECHO} "	The original example configuration file is: ${samplefile}"
  			fi
  		else
  			if [ -f "${samplefile}" ]; then
 @@ -319,14 +338,18 @@
  			if [ ${_print_file_header} -gt 0 ]; then
  				_print_file_header=0
  				msgadd ""
 -				msgadd "The following files should be created for ${PKGNAME}:"
 +				msgadd "The following rc.d scripts should be created for ${PKGNAME}:"
  				msgadd ""
  			fi
 -			msgadd "#${file} (m=@RCD_SCRIPTS_MODE@)"
 +			if [ -e "${samplefile}" ]; then
 +				msgadd "#${file} (mode=@RCD_SCRIPTS_MODE@) (see ${samplefile})"
 +			else
 +				msgadd "#${file} (mode=@RCD_SCRIPTS_MODE@) (no example script available)"
 +			fi
  		elif [ -f "${file}" ]; then
  			if [ ! "${file}" -ef "${samplefile}" ]; then
 -				${ECHO} "	${file} already exists, example file is"
 -				${ECHO} "	    ${samplefile}"
 +				${ECHO} "	${file} already exists."
 +				${ECHO} "	The example rc.d script is: ${samplefile}"
  			fi
  		else
  			if [ -f "${samplefile}" ]; then
 @@ -348,7 +371,11 @@
  			msgadd "The following files and directories have special permissions:"
  			msgadd ""
  		fi
 -		msgadd "#${file} (o=${owner}, g=${group}, m=${mode})"
 +		if [ -e "${samplefile}" ]; then
 +			msgadd "#${file} (o=${owner}, g=${group}, m=${mode}) (see ${samplefile})"
 +		else
 +			msgadd "#${file} (o=${owner}, g=${group}, m=${mode}) (no example available)"
 +		fi
  		${CHOWN} "${owner}" "${file}"
  		${CHGRP} "${group}" "${file}"
  		${CHMOD} ${mode} "${file}"
 @@ -393,6 +420,7 @@
  	if [ -n "${PKG_SHELL}" -a "${PKG_REGISTER_SHELLS}" = "YES" ]; then
  		${ECHO} "===> Updating /etc/shells"
  		${TOUCH} /etc/shells
 +		### XXX this is UGLY!  Why not test if the line is there and then just append if not!?!?!?!?
  		${CP} /etc/shells /etc/shells.pkgsrc."$$"
  		(${GREP} -v "^${PKG_SHELL}" /etc/shells.pkgsrc."$$" || ${TRUE}; ${ECHO} ${PKG_SHELL}) > /etc/shells
  		${RM} /etc/shells.pkgsrc."$$"