Subject: pkg/22328: option to mail MESSAGE (+DISPLAY) at install time
To: None <gnats-bugs@gnats.netbsd.org>
From: None <reed@reedmedia.net>
List: netbsd-bugs
Date: 07/31/2003 20:52:57
>Number:         22328
>Category:       pkg
>Synopsis:       option to mail MESSAGE (+DISPLAY) at install time
>Confidential:   yes
>Severity:       non-critical
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Fri Aug 01 03:54:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     
>Release:        NetBSD 1.6
>Organization:
http://bsd.reedmedia.net/
>Environment:
	
	
System: NetBSD rainier.reedmedia.net 1.6 NetBSD 1.6 (JCR-20020927) #3: Sat Sep 28 13:40:20 PDT 2002 reed@rainier.reedmedia.net:/usr/src/sys/arch/i386/compile/JCR-20020927 i386
Architecture: i386
Machine: i386
>Description:
Frequently NetBSD users are asking about issues that are clearly explained
when packages are installed (in the MESSAGE or +DISPLAY). But since
many things may scroll by (especially during multiple installs) the
messages are often overlooked or forgotton about.
>How-To-Repeat:
Install something that depends on fontconfig, for example, and miss the
important note. 
>Fix:

I have had my MESSAGEs emailed to me for over a year. I like it that
some other operating systems have that feature when installing
packages.

(I also made patch for pkg_install, but that was many changes ago.
I need to recode it, but we need to decide on an environment variable
or some switch.)

This idea should be fixed to show the username before the SU_CMD.
You can test the patch below by installing pkgtools/pkgsurvey.

This has been discussed around June 11 this year and November 1, 2002.
Many people want this feature, including a member of the Core group.

It was suggested, last year, to have MAIL_MESSAGE=root or
MAIL_MESSAGE=user -- and if user then email the MESSAGE to the user
and to root. (My patch doesn't implement that.)

Now to record the username, because currently it does
the SU_CMD and becomes root at that point. Maybe this needs to be
reordered: because root privilege is not needed to just display
the MESSAGE.

diff -b -u -r1.1227 bsd.pkg.mk
--- mk/bsd.pkg.mk	2003/07/31 13:50:11	1.1227
+++ mk/bsd.pkg.mk	2003/08/01 03:38:50
@@ -2493,6 +2493,14 @@
 	@${ECHO_MSG} ""
 	@${CAT} ${MESSAGE}
 	@${ECHO_MSG} ""
+.ifdef MAIL_MESSAGE
+	@(${ECHO} "The ${PKGNAME} package was installed by user `whoami`" ; \
+	${ECHO} "using pkgsrc ${PKGPATH}. Please note the following:" ; \
+	${ECHO} "" ; \
+	${CAT} ${MESSAGE} ; \
+	${ECHO} "" ) | \
+	mail -s "Package ${PKGNAME} installed" root
+.endif
 .endif
 .if !defined(NO_PKG_REGISTER)
 	${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${MAKE} ${MAKEFLAGS} fake-pkg

>Release-Note:
>Audit-Trail:
>Unformatted: