ports/118416: [PATCH] sysutils/linux-megacli: Fix minor nits

Ulrich Spoerlein uspoerlein at gmail.com
Tue Dec 4 09:20:03 UTC 2007


>Number:         118416
>Category:       ports
>Synopsis:       [PATCH] sysutils/linux-megacli: Fix minor nits
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Tue Dec 04 09:20:01 UTC 2007
>Closed-Date:
>Last-Modified:
>Originator:     Ulrich Spoerlein
>Release:        FreeBSD 6.2-STABLE i386
>Organization:
>Environment:
System: FreeBSD coyote 6.2-STABLE FreeBSD 6.2-STABLE #0: Sun Sep 23 01:37:54 CEST 2007
>Description:
Main changes:
- The periodic script should print a banner, like all other periodic script
- Don't sort the PD heading output, it breaks with certain numbering

Minor nits:
- Fix spelling
- pet portlint(1)
- Use awk(1) to alleviate the need for additional wc(1)
- remove non-portable -z flag to cmp(1)
  (yes, I'm using this script on RedHat Linux, it eases my pain :)

Feel free to incorporate only the changes you see fit, the sorting and periodic banner
should stay, however.
Port maintainer (ruben at verweg.com) is cc'd.

Generated with FreeBSD Port Tools 0.77
>How-To-Repeat:
When the enclosure numbering starts from zero, the sorting will shuffle the 
heading line around, observe:

# printf "ENC\n0\n1\n"|sort -n -k 1
0
ENC
1

So the heading must be printed before the pipeline to awk|sort.

>Fix:

--- linux-megacli-1.01.09_2.patch begins here ---
Index: Makefile
===================================================================
RCS file: /home/ncvs/ports/sysutils/linux-megacli/Makefile,v
retrieving revision 1.4
diff -u -p -u -r1.4 Makefile
--- Makefile	9 Mar 2007 13:15:02 -0000	1.4
+++ Makefile	4 Dec 2007 09:04:27 -0000
@@ -7,7 +7,7 @@
 
 PORTNAME=	megacli
 PORTVERSION=	1.01.09
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	sysutils linux
 MASTER_SITES=	http://lsi.com/files/support/rsa/MR_SAS_1.0/
 PKGNAMEPREFIX=	linux-
@@ -28,7 +28,6 @@ SUB_FILES+=	407.status-mfi-raid
 RPM2CPIO?=			${LOCALBASE}/bin/rpm2cpio
 EXTRACT_DEPENDS+=		${RPM2CPIO}:${PORTSDIR}/archivers/rpm
 
-
 post-extract:
 	@cd ${WRKSRC} && \
 		${UNZIP_CMD} MegaCliLin.zip && \
@@ -39,7 +38,7 @@ do-build:
 
 do-install:
 	${INSTALL_SCRIPT} ${WRKSRC}/megacli.sh ${PREFIX}/sbin/megacli
-	${MKDIR} -p ${PREFIX}/etc/periodic/daily
+	${MKDIR} ${PREFIX}/etc/periodic/daily
 	${INSTALL_SCRIPT} ${WRKSRC}/407.status-mfi-raid ${PREFIX}/etc/periodic/daily
 	${INSTALL_PROGRAM} ${WRKSRC}/usr/sbin/MegaCli ${PREFIX}/libexec
 
Index: files/407.status-mfi-raid.in
===================================================================
RCS file: /home/ncvs/ports/sysutils/linux-megacli/files/407.status-mfi-raid.in,v
retrieving revision 1.1
diff -u -p -u -r1.1 407.status-mfi-raid.in
--- files/407.status-mfi-raid.in	9 Mar 2007 13:15:02 -0000	1.1
+++ files/407.status-mfi-raid.in	4 Dec 2007 09:03:51 -0000
@@ -22,6 +22,8 @@ logdir=${logdir:-/var/log}
 
 case "$daily_status_mfi_raid_enable" in
     [Yy][Ee][Ss])
+	echo
+	echo 'Checking status of MFI RAID controllers:'
 	;;
     *)
 	exit 0
@@ -58,12 +60,12 @@ for ctrl in `jot ${ADPCOUNT} ${ADPMINIDX
 	# Print summary information.
 	echo "------------------------------------------------------------------------"
 	echo "Physical Drive Information:"
+	printf "ENC SLO DEV SEQ MEC OEC PFC LPF STATE\n"
 	${megacli} -PDList -a${ctrl} | \
 	awk '
 		BEGIN {
 			E=-1; S=-1; D=-1; s=-1; mec=-1; oec=-1; pfc=-1; lpfeqn=-1;
 			state="";
-			printf "ENC SLO DEV SEQ MEC OEC PFC LPF STATE\n";
 		}
 		/^Enclosure Number:/ { E=$3; }
 		/^Slot Number:/ { S=$3; }
@@ -199,7 +201,7 @@ for ctrl in `jot ${ADPCOUNT} ${ADPMINIDX
 	# Now show the differences or the entire log.
 	case "$daily_status_mfi_raid_persist_logs" in
 	[Yy][Ee][Ss])
-		cmp -zs ${ctrl_log}.yesterday ${ctrl_log}.today
+		cmp -s ${ctrl_log}.yesterday ${ctrl_log}.today
 		raid_rc=$?
 		if test $raid_rc -ne 0; then
 			diff -u ${ctrl_log}.yesterday ${ctrl_log}.today | \
Index: files/README-status-mfi-raid.txt
===================================================================
RCS file: /home/ncvs/ports/sysutils/linux-megacli/files/README-status-mfi-raid.txt,v
retrieving revision 1.1
diff -u -p -u -r1.1 README-status-mfi-raid.txt
--- files/README-status-mfi-raid.txt	9 Mar 2007 13:15:02 -0000	1.1
+++ files/README-status-mfi-raid.txt	4 Dec 2007 09:03:51 -0000
@@ -1,7 +1,7 @@
 # $FreeBSD: ports/sysutils/linux-megacli/files/README-status-mfi-raid.txt,v 1.1 2007/03/09 13:15:02 rafan Exp $
 
 The output of periodic/daily/407.status-mfi-raid uses several
-abbreviations. This documents maps the abbreviations to the
+abbreviations. This document maps the abbreviations to the
 names MegaCli uses, which were just too long for summary mails.
 
 Section 'Physical Drive Information:'
Index: files/megacli.sh.in
===================================================================
RCS file: /home/ncvs/ports/sysutils/linux-megacli/files/megacli.sh.in,v
retrieving revision 1.2
diff -u -p -u -r1.2 megacli.sh.in
--- files/megacli.sh.in	9 Mar 2007 13:15:02 -0000	1.2
+++ files/megacli.sh.in	4 Dec 2007 09:03:51 -0000
@@ -13,12 +13,12 @@ if ! [ `sysctl -n compat.linux.osrelease
 	exit 1
 fi
 
-lpfs=`mount -t linprocfs | wc -l | awk '{ print $1 }'`
+lpfs=`mount -t linprocfs | awk 'END{ print NR }'`
 if [ ${lpfs} -le 0 ]; then
 	echo "You need to mount linprocfs to run `basename $0`." >&2
 	exit 1
 fi
-lsfs=`mount -t linsysfs | wc -l | awk '{ print $1 }'`
+lsfs=`mount -t linsysfs | awk 'END{ print NR }'`
 if [ ${lsfs} -le 0 ]; then
 	echo "You need to mount linsysfs to run `basename $0`." >&2
 	exit 1
--- linux-megacli-1.01.09_2.patch ends here ---

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



More information about the freebsd-ports-bugs mailing list