mirror of
https://git.FreeBSD.org/ports.git
synced 2025-01-15 07:56:36 +00:00
- 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]
This commit is contained in:
parent
6decbf20fc
commit
13a94294db
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=221554
@ -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:
|
||||
|
@ -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}
|
||||
@ -67,7 +68,8 @@ for ctrl in `jot ${ADPCOUNT} ${ADPMINIDX} ${ADPMAXIDX}`; do
|
||||
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 @@ for ctrl in `jot ${ADPCOUNT} ${ADPMINIDX} ${ADPMAXIDX}`; do
|
||||
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}
|
||||
|
@ -8,11 +8,32 @@ then
|
||||
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
|
||||
|
63
sysutils/linux-megacli/files/mfi_tty_log.in
Normal file
63
sysutils/linux-megacli/files/mfi_tty_log.in
Normal file
@ -0,0 +1,63 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# $FreeBSD: /tmp/pcvs/ports/sysutils/linux-megacli/files/Attic/mfi_tty_log.in,v 1.1 2008-10-13 17:22:20 stefan 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"
|
@ -30,7 +30,15 @@ Add the following to /etc/periodic.conf
|
||||
# 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
|
||||
|
@ -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%%
|
||||
|
@ -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:
|
||||
|
@ -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}
|
||||
@ -67,7 +68,8 @@ for ctrl in `jot ${ADPCOUNT} ${ADPMINIDX} ${ADPMAXIDX}`; do
|
||||
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 @@ for ctrl in `jot ${ADPCOUNT} ${ADPMINIDX} ${ADPMAXIDX}`; do
|
||||
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}
|
||||
|
@ -8,11 +8,32 @@ then
|
||||
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
|
||||
|
63
sysutils/linux-megacli2/files/mfi_tty_log.in
Normal file
63
sysutils/linux-megacli2/files/mfi_tty_log.in
Normal file
@ -0,0 +1,63 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# $FreeBSD: /tmp/pcvs/ports/sysutils/linux-megacli2/files/Attic/mfi_tty_log.in,v 1.1 2008-10-13 17:22:20 stefan 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"
|
@ -30,7 +30,15 @@ Add the following to /etc/periodic.conf
|
||||
# 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
|
||||
|
@ -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%%
|
||||
|
Loading…
Reference in New Issue
Block a user