From bz@zabbadoz.net  Mon Jul 28 15:05:46 2008
Return-Path: <bz@zabbadoz.net>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 34DEF106567B
	for <freebsd-gnats-submit@freebsd.org>; Mon, 28 Jul 2008 15:05:46 +0000 (UTC)
	(envelope-from bz@zabbadoz.net)
Received: from mail.cksoft.de (mail.cksoft.de [62.111.66.27])
	by mx1.freebsd.org (Postfix) with ESMTP id 8209E8FC35
	for <freebsd-gnats-submit@freebsd.org>; Mon, 28 Jul 2008 15:05:45 +0000 (UTC)
	(envelope-from bz@zabbadoz.net)
Received: from localhost (amavis.str.cksoft.de [192.168.74.71])
	by mail.cksoft.de (Postfix) with ESMTP id 3F61041C798
	for <freebsd-gnats-submit@freebsd.org>; Mon, 28 Jul 2008 16:50:07 +0200 (CEST)
Received: from mail.cksoft.de ([62.111.66.27])
	by localhost (amavis.str.cksoft.de [192.168.74.71]) (amavisd-new, port 10024)
	with ESMTP id ndJmUGU4Z2HQ for <freebsd-gnats-submit@freebsd.org>;
	Mon, 28 Jul 2008 16:50:05 +0200 (CEST)
Received: by mail.cksoft.de (Postfix, from userid 66)
	id A92B141C7A7; Mon, 28 Jul 2008 16:50:05 +0200 (CEST)
Received: from storage.int.zabbadoz.net (storage.int.zabbadoz.net [10.111.66.189])
	by mail.int.zabbadoz.net (Postfix) with ESMTP id 140B144487F;
	Mon, 28 Jul 2008 14:49:45 +0000 (UTC)
Received: by storage.int.zabbadoz.net (Postfix, from userid 1060)
	id AC2A54899B8; Mon, 28 Jul 2008 14:49:45 +0000 (UTC)
Message-Id: <20080728144945.AC2A54899B8@storage.int.zabbadoz.net>
Date: Mon, 28 Jul 2008 14:49:45 +0000 (UTC)
From: "Bjoern A. Zeeb" <bzeeb+freebsdports@zabbadoz.net>
Reply-To: "Bjoern A. Zeeb" <bzeeb+freebsdports@zabbadoz.net>
To: FreeBSD-gnats-submit@freebsd.org
Cc: "Bjoern A. Zeeb" <bzeeb+freebsdports@zabbadoz.net>
Subject: update sysutils/linux-megacli
X-Send-Pr-Version: 3.113
X-GNATS-Notify: ruben@verweg.com

>Number:         126040
>Category:       ports
>Synopsis:       update sysutils/linux-megacli
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    stefan
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jul 28 15:10:00 UTC 2008
>Closed-Date:    Mon Oct 13 17:23:01 UTC 2008
>Last-Modified:  Mon Oct 13 17:30:02 UTC 2008
>Originator:     Bjoern A. Zeeb
>Release:        FreeBSD 7.0-CURRENT amd64
>Organization:
Zabbadoz.NeT
>Environment:
System: FreeBSD foo 7.0-CURRENT FreeBSD 7.0-CURRENT #0: Sun Oct 30 18:31:51 UTC 2005 bz@foo:/path/to/HEAD/sys/KERNEL amd64

>Description:

	When trying to diagnose problems, vendors like Dell
	ask for the "TTY Log" so save that upon reboot.
	It should only be there after a "warm boot". After power cycling
	old contents should be gone unless special knobs turned,
	which you do not want unless you really need and they tell you to.

	In case you like debugging in daily mails you can even get
	daily diffs of the TTY log by turning on the switch in
	periodic.conf. Most people will not want to.

	You should make sure to have a well known good latest
	version of mfi(4) and the latest firmware.
	The rc.d script is enabled by default but you can turn it off
	in rc.conf if it gives trouble.

	I am not good on rc scripts so you may want to review;-)

	I'll hopefully add more information on mfi debugging to the
	wiki soon.

>How-To-Repeat:

>Fix:

You can also (temporary) fetch the patch from
http://people.freebsd.org/~bz/sysutils-linux-megacli-20080727-01.diff

Index: sysutils/linux-megacli/Makefile
===================================================================
RCS file: /local/mirror/FreeBSD/r/pcvs/ports/sysutils/linux-megacli/Makefile,v
retrieving revision 1.7
diff -u -p -r1.7 Makefile
--- sysutils/linux-megacli/Makefile	18 Jun 2008 13:02:45 -0000	1.7
+++ sysutils/linux-megacli/Makefile	28 Jul 2008 14:38:14 -0000
@@ -7,7 +7,7 @@
 
 PORTNAME=	megacli
 PORTVERSION=	1.01.40
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	sysutils linux
 MASTER_SITES=	http://www.lsi.com/support/downloads/megaraid/miscellaneous/linux/
 PKGNAMEPREFIX=	linux-
@@ -23,6 +23,7 @@ ONLY_FOR_ARCHS=	i386 amd64
 USE_LINUX=	yes
 SUB_FILES=	megacli.sh
 SUB_FILES+=	407.status-mfi-raid
+SUB_FILES+=	mfi_tty_log
 
 # From bsd.linux.rpm.mk
 RPM2CPIO?=			${LOCALBASE}/bin/rpm2cpio
@@ -39,6 +40,7 @@ do-install:
 	${INSTALL_SCRIPT} ${WRKSRC}/megacli.sh ${PREFIX}/sbin/megacli
 	${MKDIR} ${PREFIX}/etc/periodic/daily
 	${INSTALL_SCRIPT} ${WRKSRC}/407.status-mfi-raid ${PREFIX}/etc/periodic/daily
+	${INSTALL_SCRIPT} ${WRKSRC}/mfi_tty_log ${PREFIX}/etc/rc.d
 	${INSTALL_PROGRAM} ${WRKSRC}/opt/MegaRAID/MegaCli/MegaCli ${PREFIX}/libexec
 
 post-install:
Index: sysutils/linux-megacli/pkg-plist
===================================================================
RCS file: /local/mirror/FreeBSD/r/pcvs/ports/sysutils/linux-megacli/pkg-plist,v
retrieving revision 1.2
diff -u -p -r1.2 pkg-plist
--- sysutils/linux-megacli/pkg-plist	9 Mar 2007 13:15:02 -0000	1.2
+++ sysutils/linux-megacli/pkg-plist	28 Jul 2008 14:38:14 -0000
@@ -1,6 +1,7 @@
 sbin/megacli
 libexec/MegaCli
 etc/periodic/daily/407.status-mfi-raid
+etc/rc.d/mfi_tty_log
 %%PORTDOCS%%%%DOCSDIR%%/readme.txt
 %%PORTDOCS%%%%DOCSDIR%%/README-status-mfi-raid.txt
 %%PORTDOCS%%@dirrm %%DOCSDIR%%
Index: sysutils/linux-megacli/files/407.status-mfi-raid.in
===================================================================
RCS file: /local/mirror/FreeBSD/r/pcvs/ports/sysutils/linux-megacli/files/407.status-mfi-raid.in,v
retrieving revision 1.4
diff -u -p -r1.4 407.status-mfi-raid.in
--- sysutils/linux-megacli/files/407.status-mfi-raid.in	18 Jun 2008 13:02:46 -0000	1.4
+++ sysutils/linux-megacli/files/407.status-mfi-raid.in	28 Jul 2008 14:38:14 -0000
@@ -16,6 +16,7 @@ fi
 : ${daily_status_mfi_raid_enable:=NO}
 : ${daily_status_mfi_raid_verbose:=NO}
 : ${daily_status_mfi_raid_persist_logs:=YES}
+: ${daily_status_mfi_raid_tty_log:=NO}
 
 megacli=${megacli:-%%PREFIX%%/sbin/megacli}
 logdir=${logdir:-/var/log}
@@ -222,7 +223,31 @@ for ctrl in `jot ${ADPCOUNT} ${ADPMINIDX
 	if test $raid_rc -eq 0; then
 		echo "  No new log messages."
 	fi
-	[ $rc -eq 0 ] && [ $raid_rc -ne 0 ] && rc=3
+
+	# TTY Log
+	echo "TTY Log:"
+	tty_log=${logdir}/mfi_raid_${ctrl}_tty
+	tty_rc=0
+	case "$daily_status_mfi_raid_tty_log" in
+	[Yy][Ee][Ss])
+		if test ! -f ${tty_log}.today; then
+			touch ${tty_log}.today
+		fi
+		mv -f ${tty_log}.today ${tty_log}.yesterday
+		${megacli} -FwTermLog Dsply -a${ctrl} > ${tty_log}.today
+		cmp -s ${tty_log}.yesterday ${tty_log}.today
+		tty_rc=$?
+		if test $tty_rc -ne 0; then
+			diff -u ${tty_log}.yesterday ${tty_log}.today | \
+				grep -v '^-\|^$'
+		else
+			echo "  No new TTY log messages."
+		fi
+		;;
+	*)
+		;;
+	esac
+	[ $rc -eq 0 ] && [ $raid_rc -ne 0 -o $tty_rc -ne 0 ] && rc=3
 done
 
 exit ${rc}
Index: sysutils/linux-megacli/files/mfi_tty_log.in
===================================================================
RCS file: sysutils/linux-megacli/files/mfi_tty_log.in
diff -N sysutils/linux-megacli/files/mfi_tty_log.in
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ sysutils/linux-megacli/files/mfi_tty_log.in	28 Jul 2008 14:38:14 -0000
@@ -0,0 +1,63 @@
+#!/bin/sh
+#
+# $FreeBSD: src/etc/rc.d/abi,v 1.4.2.4 2007/03/10 14:04:01 yar Exp $
+#
+
+# PROVIDE: mfi_tty_log
+# REQUIRE: abi
+# KEYWORD: nojail
+
+: ${rc_mfi_raid_tty_log:=YES}
+
+. /etc/rc.subr
+
+name="mfi_tty_log"
+start_cmd="${name}_start"
+stop_cmd=":"
+
+mfi_tty_log_start()
+{
+	megacli=${megacli:-%%PREFIX%%/sbin/megacli}
+	logdir=${logdir:-/var/log}
+
+	case "$rc_mfi_raid_tty_log" in
+	    [Yy][Ee][Ss])
+		echo
+		echo 'Checking for TTY logs of MFI(4) RAID controllers:'
+		;;
+	    *)
+		return 0
+		;;
+	esac
+
+	if test `id -u` -ne 0; then
+		echo "You must be root to run `basename $0`." >&2
+		return 1
+	fi
+
+	ADPCOUNT=$(${megacli} -adpCount | \
+		awk '/Controller Count:/ { gsub("\\.", ""); print $3 }')
+
+	case ${ADPCOUNT} in
+		0)	echo "Error: Cannot find an adapter." >&2
+			return 1
+			;;
+		[1-9]|[1-9][0-9]|[1-2][0-9][0-9])
+			;;
+		*)
+			echo "Error: Cannot get the number of adapters: ${ADPCOUNT}" >&2
+			return 1
+			;;
+	esac
+
+	ADPMINIDX=0
+	ADPMAXIDX=`expr ${ADPCOUNT} - 1`
+
+	for ctrl in `jot ${ADPCOUNT} ${ADPMINIDX} ${ADPMAXIDX}`; do
+		tty_log=${logdir}/mfi_raid_${ctrl}_tty.boot
+		echo " Adapter: ${ctrl} - TTY log saved to ${tty_log}"
+		${megacli} -FwTermLog Dsply -a${ctrl} > ${tty_log}
+	done
+}
+
+run_rc_command "$1"

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->feedback 
State-Changed-By: edwin 
State-Changed-When: Mon Jul 28 15:10:10 UTC 2008 
State-Changed-Why:  
Awaiting maintainers feedback (via the GNATS Auto Assign Tool) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=126040 

From: Edwin Groothuis <edwin@FreeBSD.org>
To: ruben@verweg.com
Cc: bug-followup@FreeBSD.org
Subject: Re: ports/126040: update sysutils/linux-megacli
Date: Mon, 28 Jul 2008 15:10:09 UT

 Maintainer of sysutils/linux-megacli,
 
 Please note that PR ports/126040 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/126040
 
 -- 
 Edwin Groothuis via the GNATS Auto Assign Tool
 edwin@FreeBSD.org

From: Ruben van Staveren <ruben@verweg.com>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/126040: update sysutils/linux-megacli
Date: Sat, 2 Aug 2008 12:36:31 +0200

 This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
 --Apple-Mail-3-995506818
 Content-Type: text/plain; charset=US-ASCII; format=flowed
 Content-Transfer-Encoding: 7bit
 
 It is ok, but I yet need to merge in some stuff as mentioned in
 
 http://www.mail-archive.com/freebsd-stable@freebsd.org/msg96860.html
 
 Expect this sometime next week.
 
 Thanks,
 	Ruben
 
 --Apple-Mail-3-995506818
 content-type: application/pgp-signature; x-mac-type=70674453;
 	name=PGP.sig
 content-description: This is a digitally signed message part
 content-disposition: inline; filename=PGP.sig
 content-transfer-encoding: 7bit
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.6 (Darwin)
 
 iD8DBQFIlDiwZ88+mcQxRw0RAlSgAJ41fmeazu+RGE90tGCRG6nQlvYhEACcDBcn
 rdpLuE2wlZkruQ/dSmqcBP4=
 =bCc3
 -----END PGP SIGNATURE-----
 
 --Apple-Mail-3-995506818--
State-Changed-From-To: feedback->suspended 
State-Changed-By: linimon 
State-Changed-When: Sat Aug 2 16:53:17 UTC 2008 
State-Changed-Why:  
Maintainer is working on a patch that will incorporate this one. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=126040 

From: Pav Lucistnik <pav@FreeBSD.org>
To: bug-followup@FreeBSD.org, ruben@verweg.com
Cc:  
Subject: Re: ports/126040: update sysutils/linux-megacli
Date: Fri, 05 Sep 2008 17:28:17 +0200

 Ruben, what's the status on this? Has been a month.
 
 -- 
 Pav Lucistnik <pav@oook.cz>
               <pav@FreeBSD.org>
 
 In the computer industry, there are three kinds of lies:
 lies, damn lies, and benchmarks.

From: Ruben van Staveren <ruben@verweg.com>
To: pav@FreeBSD.org
Cc: bug-followup@FreeBSD.org
Subject: Re: ports/126040: update sysutils/linux-megacli
Date: Sat, 6 Sep 2008 10:15:02 +0200

 This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
 --Apple-Mail-11--283949637
 Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes
 Content-Transfer-Encoding: 7bit
 
 Hi Pav,
 
 On 5 Sep 2008, at 17:28, Pav Lucistnik wrote:
 
 > Ruben, what's the status on this? Has been a month.
 
 Well, holiday period, other things that kept me preoccupied and the  
 strange thing that my patch didn't apply cleanly on a freshly  
 portsnapped tree on a RELENG_6 machine.
 
 I'll get that patch up to shape on this Sunday, apologies for the  
 delay...
 
 Regards,
 	Ruben
 
 >
 >
 > -- 
 > Pav Lucistnik <pav@oook.cz>
 >              <pav@FreeBSD.org>
 >
 > In the computer industry, there are three kinds of lies:
 > lies, damn lies, and benchmarks.
 
 
 --Apple-Mail-11--283949637
 content-type: application/pgp-signature; x-mac-type=70674453;
 	name=PGP.sig
 content-description: This is a digitally signed message part
 content-disposition: inline; filename=PGP.sig
 content-transfer-encoding: 7bit
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.6 (Darwin)
 
 iD8DBQFIwjwHZ88+mcQxRw0RAkNIAJ47p7OASjJtpTDBpuoXKnCpqUx9fgCeLBS/
 PZxS+8N1UHcsVZhAKXyZzTY=
 =09rK
 -----END PGP SIGNATURE-----
 
 --Apple-Mail-11--283949637--
State-Changed-From-To: suspended->open 
State-Changed-By: pav 
State-Changed-When: Sun Sep 7 21:29:03 UTC 2008 
State-Changed-Why:  
Patch on it's way 

http://www.freebsd.org/cgi/query-pr.cgi?pr=126040 

From: Ruben van Staveren <ruben@verweg.com>
To: Pav Lucistnik <pav@FreeBSD.org>
Cc: bug-followup@FreeBSD.org
Subject: Re: ports/126040: update sysutils/linux-megacli
Date: Sun, 7 Sep 2008 21:02:14 +0000

 -----BEGIN PGP SIGNED MESSAGE-----
 Hash: SHA1
 
 - - Submitters changes except default enabling of rc.d script (As I feel FreeBSD
   is not about that, especially with regards to ports)
 
 - - Don't complain about higher compat.linux.osrelease versions
   (Mentioned in
 http://www.mail-archive.com/freebsd-stable@freebsd.org/msg96860.html)
 
 cd /usr/ports && patch -p0 /path/to/patch
 
 diff -urN sysutils/linux-megacli.orig/Makefile sysutils/linux-megacli/Makefile
 - --- sysutils/linux-megacli.orig/Makefile	2008-09-07 22:33:51.000000000 +0200
 +++ sysutils/linux-megacli/Makefile	2008-09-07 22:36:13.000000000 +0200
 @@ -7,7 +7,7 @@
  
  PORTNAME=	megacli
  PORTVERSION=	1.01.40
 - -PORTREVISION=	1
 +PORTREVISION=	2
  CATEGORIES=	sysutils linux
  MASTER_SITES=	http://www.lsi.com/support/downloads/megaraid/miscellaneous/linux/
  PKGNAMEPREFIX=	linux-
 @@ -23,6 +23,7 @@
  USE_LINUX=	yes
  SUB_FILES=	megacli.sh
  SUB_FILES+=	407.status-mfi-raid
 +SUB_FILES+=	mfi_tty_log
  
  # From bsd.linux.rpm.mk
  RPM2CPIO?=			${LOCALBASE}/bin/rpm2cpio
 @@ -39,6 +40,7 @@
  	${INSTALL_SCRIPT} ${WRKSRC}/megacli.sh ${PREFIX}/sbin/megacli
  	${MKDIR} ${PREFIX}/etc/periodic/daily
  	${INSTALL_SCRIPT} ${WRKSRC}/407.status-mfi-raid ${PREFIX}/etc/periodic/daily
 +	${INSTALL_SCRIPT} ${WRKSRC}/mfi_tty_log ${PREFIX}/etc/rc.d
  	${INSTALL_PROGRAM} ${WRKSRC}/opt/MegaRAID/MegaCli/MegaCli ${PREFIX}/libexec
  
  post-install:
 diff -urN sysutils/linux-megacli.orig/files/407.status-mfi-raid.in sysutils/linux-megacli/files/407.status-mfi-raid.in
 - --- sysutils/linux-megacli.orig/files/407.status-mfi-raid.in	2008-09-07 22:33:51.000000000 +0200
 +++ sysutils/linux-megacli/files/407.status-mfi-raid.in	2008-09-07 22:36:13.000000000 +0200
 @@ -16,6 +16,7 @@
  : ${daily_status_mfi_raid_enable:=NO}
  : ${daily_status_mfi_raid_verbose:=NO}
  : ${daily_status_mfi_raid_persist_logs:=YES}
 +: ${daily_status_mfi_raid_tty_log:=NO}
  
  megacli=${megacli:-%%PREFIX%%/sbin/megacli}
  logdir=${logdir:-/var/log}
 @@ -67,7 +68,8 @@
  			E=-1; S=-1; D=-1; s=-1; mec=-1; oec=-1; pfc=-1; lpfeqn=-1;
  			state="";
  		}
 - -		/^Enclosure (Number|Device ID):/ { E=$3; }
 +		/^Enclosure (Number:/ { E=$3; }
 +		/^Enclosure Device ID:/ { E=$4; }
  		/^Slot Number:/ { S=$3; }
  		/^Device Id:/ { D=$3; }
  		/^Sequence Number:/ { s=$3; }
 @@ -222,7 +224,31 @@
  	if test $raid_rc -eq 0; then
  		echo "  No new log messages."
  	fi
 - -	[ $rc -eq 0 ] && [ $raid_rc -ne 0 ] && rc=3
 +
 +	# TTY Log
 +	echo "TTY Log:"
 +	tty_log=${logdir}/mfi_raid_${ctrl}_tty
 +	tty_rc=0
 +	case "$daily_status_mfi_raid_tty_log" in
 +	[Yy][Ee][Ss])
 +		if test ! -f ${tty_log}.today; then
 +			touch ${tty_log}.today
 +		fi
 +		mv -f ${tty_log}.today ${tty_log}.yesterday
 +		${megacli} -FwTermLog Dsply -a${ctrl} > ${tty_log}.today
 +		cmp -s ${tty_log}.yesterday ${tty_log}.today
 +		tty_rc=$?
 +		if test $tty_rc -ne 0; then
 +			diff -u ${tty_log}.yesterday ${tty_log}.today | \
 +				grep -v '^-\|^$'
 +		else
 +			echo "  No new TTY log messages."
 +		fi
 +		;;
 +	*)
 +		;;
 +	esac
 +	[ $rc -eq 0 ] && [ $raid_rc -ne 0 -o $tty_rc -ne 0 ] && rc=3
  done
  
  exit ${rc}
 diff -urN sysutils/linux-megacli.orig/files/megacli.sh.in sysutils/linux-megacli/files/megacli.sh.in
 - --- sysutils/linux-megacli.orig/files/megacli.sh.in	2008-09-07 22:33:51.000000000 +0200
 +++ sysutils/linux-megacli/files/megacli.sh.in	2008-09-07 22:36:13.000000000 +0200
 @@ -8,11 +8,32 @@
  	exit 1
  fi
  
 - -if ! [ `sysctl -n compat.linux.osrelease` = "2.6.12" ]; then
 - -	echo "You need to set compat.linux.osrelease to 2.6.12 to run `basename $0`." >&2
 - -	exit 1
 +osrelease=`sysctl -n compat.linux.osrelease`
 +
 +case $osrelease in
 +	2.6.*)
 +		if [ `echo $osrelease | cut -d . -f 3` -lt 12 ]; then
 +		osrelease=TOOLOW
 +		fi
 +	;;
 +	2.*)
 +		if [ `echo $osrelease | cut -d . -f 2` -lt 6 ]; then
 +		osrelease=TOOLOW
 +		fi
 +	;;
 +	*)
 +		if [ `echo $osrelease | cut -d . -f 1` -lt 2 ]; then
 +		osrelease=TOOLOW
 +		fi
 +	;;
 +esac
 +
 +if [ $osrelease = "TOOLOW" ]; then
 +        echo "You need to set compat.linux.osrelease to atleast 2.6.12 to run `basename $0`." >&2
 +        exit 1
  fi
  
 +
  lpfs=`mount -t linprocfs | awk 'END{ print NR }'`
  if [ ${lpfs} -le 0 ]; then
  	echo "You need to mount linprocfs to run `basename $0`." >&2
 diff -urN sysutils/linux-megacli.orig/files/mfi_tty_log.in sysutils/linux-megacli/files/mfi_tty_log.in
 - --- sysutils/linux-megacli.orig/files/mfi_tty_log.in	1970-01-01 01:00:00.000000000 +0100
 +++ sysutils/linux-megacli/files/mfi_tty_log.in	2008-09-07 22:36:13.000000000 +0200
 @@ -0,0 +1,63 @@
 +#!/bin/sh
 +#
 +# $FreeBSD: src/etc/rc.d/abi,v 1.4.2.4 2007/03/10 14:04:01 yar Exp $
 +#
 +
 +# PROVIDE: mfi_tty_log
 +# REQUIRE: abi
 +# KEYWORD: nojail
 +
 +: ${rc_mfi_raid_tty_log:=NO}
 +
 +. /etc/rc.subr
 +
 +name="mfi_tty_log"
 +start_cmd="${name}_start"
 +stop_cmd=":"
 +
 +mfi_tty_log_start()
 +{
 +	megacli=${megacli:-%%PREFIX%%/sbin/megacli}
 +	logdir=${logdir:-/var/log}
 +
 +	case "$rc_mfi_raid_tty_log" in
 +	    [Yy][Ee][Ss])
 +		echo
 +		echo 'Checking for TTY logs of MFI(4) RAID controllers:'
 +		;;
 +	    *)
 +		return 0
 +		;;
 +	esac
 +
 +	if test `id -u` -ne 0; then
 +		echo "You must be root to run `basename $0`." >&2
 +		return 1
 +	fi
 +
 +	ADPCOUNT=$(${megacli} -adpCount | \
 +		awk '/Controller Count:/ { gsub("\\.", ""); print $3 }')
 +
 +	case ${ADPCOUNT} in
 +		0)	echo "Error: Cannot find an adapter." >&2
 +			return 1
 +			;;
 +		[1-9]|[1-9][0-9]|[1-2][0-9][0-9])
 +			;;
 +		*)
 +			echo "Error: Cannot get the number of adapters: ${ADPCOUNT}" >&2
 +			return 1
 +			;;
 +	esac
 +
 +	ADPMINIDX=0
 +	ADPMAXIDX=`expr ${ADPCOUNT} - 1`
 +
 +	for ctrl in `jot ${ADPCOUNT} ${ADPMINIDX} ${ADPMAXIDX}`; do
 +		tty_log=${logdir}/mfi_raid_${ctrl}_tty.boot
 +		echo " Adapter: ${ctrl} - TTY log saved to ${tty_log}"
 +		${megacli} -FwTermLog Dsply -a${ctrl} > ${tty_log}
 +	done
 +}
 +
 +run_rc_command "$1"
 diff -urN sysutils/linux-megacli.orig/pkg-message sysutils/linux-megacli/pkg-message
 - --- sysutils/linux-megacli.orig/pkg-message	2008-09-07 22:33:51.000000000 +0200
 +++ sysutils/linux-megacli/pkg-message	2008-09-07 22:52:55.000000000 +0200
 @@ -30,7 +30,15 @@
  	# For daily summary mails and log diffs:
  	daily_status_mfi_raid_enable="YES"
  	# In case you want really lots of details enable this:
 - -	daily_status_mfi_raid_verbose="NO"
 +	daily_status_mfi_raid_verbose="YES"
 +	# In case you want the tty logs from the controller
 +	daily_status_mfi_raid_tty_log="YES"
 +
 +Add the following to /etc/rc.conf
 +
 +# Save tty log on reboot (you want this)
 +rc_mfi_raid_tty_log="YES"
 +
  
  If you find mfi(4) too verbose, see mfi_evt_class_t in
  /usr/src/sys/dev/mfi/mfireg.h for values you can use in the
 diff -urN sysutils/linux-megacli.orig/pkg-plist sysutils/linux-megacli/pkg-plist
 - --- sysutils/linux-megacli.orig/pkg-plist	2008-09-07 22:33:51.000000000 +0200
 +++ sysutils/linux-megacli/pkg-plist	2008-09-07 22:36:13.000000000 +0200
 @@ -1,6 +1,7 @@
  sbin/megacli
  libexec/MegaCli
  etc/periodic/daily/407.status-mfi-raid
 +etc/rc.d/mfi_tty_log
  %%PORTDOCS%%%%DOCSDIR%%/readme.txt
  %%PORTDOCS%%%%DOCSDIR%%/README-status-mfi-raid.txt
  %%PORTDOCS%%@dirrm %%DOCSDIR%%
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.9 (FreeBSD)
 
 iD8DBQFIxEFHZ88+mcQxRw0RAgzMAKCEAU0f4TqHi6W02gZmuRnXqBaZAgCfZDqJ
 R3SgTUpIuXlzJEBPmLp+j6s=
 =fJPp
 -----END PGP SIGNATURE-----
Responsible-Changed-From-To: freebsd-ports-bugs->stefan 
Responsible-Changed-By: stefan 
Responsible-Changed-When: Mon Oct 13 17:16:08 UTC 2008 
Responsible-Changed-Why:  
Take. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=126040 
State-Changed-From-To: open->closed 
State-Changed-By: stefan 
State-Changed-When: Mon Oct 13 17:22:42 UTC 2008 
State-Changed-Why:  
Committed, thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=126040 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/126040: commit references a PR
Date: Mon, 13 Oct 2008 17:22:29 +0000 (UTC)

 stefan      2008-10-13 17:22:20 UTC
 
   FreeBSD ports repository
 
   Modified files:
     sysutils/linux-megacli Makefile pkg-message pkg-plist 
     sysutils/linux-megacli/files 407.status-mfi-raid.in 
                                  megacli.sh.in 
   Added files:
     sysutils/linux-megacli/files mfi_tty_log.in 
   Log:
   - Add rc.d script for taking TTY logs. [1]
   - Don't complain about higher compat.linux.osrelease versions. [2]
   
   PR:             126040
   Submitted by:   bz [1], maintainer [2]
   Approved by:    maintainer [1]
   
   Revision  Changes    Path
   1.8       +3 -1      ports/sysutils/linux-megacli/Makefile
   1.5       +29 -3     ports/sysutils/linux-megacli/files/407.status-mfi-raid.in
   1.4       +24 -3     ports/sysutils/linux-megacli/files/megacli.sh.in
   1.1       +63 -0     ports/sysutils/linux-megacli/files/mfi_tty_log.in (new)
   1.3       +9 -1      ports/sysutils/linux-megacli/pkg-message
   1.3       +1 -0      ports/sysutils/linux-megacli/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"
 
>Unformatted:
