2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-30 17:46:38 +00:00

Merge pull request #2347 from zet809/have_bmcsetup_run_in_postscript

modify getipmi and bmcsetup works also as a post/postboot script for …
This commit is contained in:
zet809 2017-01-10 14:02:00 +08:00 committed by GitHub
commit 491ad4c605
4 changed files with 49 additions and 5 deletions

View File

@ -232,6 +232,7 @@ then
#genesis scripts package, don't remove genesis amd64 files
#rm -f ../../$package_dir_name/${file_low}-amd64_*.deb
cd $file
CURDIR=$(pwd)
dch -v $pkg_version -b -c debian/changelog $build_string
if [ "$target_arch" = "all" ]; then
#xcat probe use some functions shipped by xCAT, for below reasons we need to copy files to xCAT-probe directory
@ -239,7 +240,6 @@ then
#2 don't maintain two files for each script
#3 symbolic link can't work during package
if [ $file_low = "xcat-probe" ]; then
CURDIR=$(pwd)
mkdir -p ${CURDIR}/lib/perl/xCAT/
cp -f ${CURDIR}/../perl-xCAT/xCAT/NetworkUtils.pm ${CURDIR}/lib/perl/xCAT/
cp -f ${CURDIR}/../perl-xCAT/xCAT/GlobalDef.pm ${CURDIR}/lib/perl/xCAT/
@ -253,9 +253,15 @@ then
mv ${CURDIR}/debian/control.save.998 ${CURDIR}/debian/control
else
if [ "$file" = "xCAT-genesis-scripts" ]; then
CURDIR=$(pwd)
echo "Rename control file to build pkg: cp ${CURDIR}/debian/control-${target_arch} ${CURDIR}/debian/control"
echo "Rename control file to build pkg: mv ${CURDIR}/debian/control-${target_arch} ${CURDIR}/debian/control"
cp ${CURDIR}/debian/control-${target_arch} ${CURDIR}/debian/control
elif [ "$file" = "xCAT" ]; then
# shipping bmcsetup and getipmi scripts as part of postscripts
files=("bmcsetup" "getipmi")
for f in "${files[@]}"; do
cp ${CURDIR}/../xCAT-genesis-scripts/bin/$f ${CURDIR}/postscripts/$f
sed -i "s/xcat.genesis.$f/$f/g" ${CURDIR}/postscripts/$f
done
fi
CURDIR=$(pwd)
cp ${CURDIR}/debian/control ${CURDIR}/debian/control.save.998
@ -264,9 +270,13 @@ then
dpkg-buildpackage -rfakeroot -uc -us -a$target_arch
mv ${CURDIR}/debian/control.save.998 ${CURDIR}/debian/control
if [ "$file" = "xCAT-genesis-scripts" ]; then
CURDIR=$(pwd)
echo "Move control file back: mv ${CURDIR}/debian/control ${CURDIR}/debian/control-${target_arch}"
rm ${CURDIR}/debian/control
elif [ "$file" = "xCAT" ]; then
files=("bmcsetup" "getipmi")
for f in "${files[@]}"; do
rm -f ${CURDIR}/postscripts/$f
done
fi
fi
rc=$?

13
makerpm
View File

@ -107,6 +107,13 @@ function makexcat {
TARGET="--target $ARCH"
if [ "$RPMNAME" = "xCAT" ]; then
cd `dirname $0`/
# shipping bmcsetup and getipmi scripts as part of postscripts
files=("bmcsetup" "getipmi")
for f in "${files[@]}"; do
cp "xCAT-genesis-scripts/bin/"$f ${RPMNAME}/postscripts/$f
sed -i "s/xcat.genesis.$f/$f/g" ${RPMNAME}/postscripts/$f
done
cd `dirname $0`/$RPMNAME
tar --exclude .svn --exclude upflag -czf $RPMROOT/SOURCES/postscripts.tar.gz postscripts LICENSE.html
tar --exclude .svn -czf $RPMROOT/SOURCES/prescripts.tar.gz prescripts
@ -139,6 +146,12 @@ function makexcat {
echo "Building $RPMROOT/RPMS/$ARCH/$RPMNAME-$VER-snap*.$ARCH.rpm $EMBEDTXT..."
rpmbuild $QUIET -ba $RPMNAME/$RPMNAME.spec $TARGET --define "version $VER" $REL "$EASE"
RC=$?
if [ "$RPMNAME" = "xCAT" ]; then
files=("bmcsetup" "getipmi")
for f in "${files[@]}"; do
rm -f `dirname $0`/${RPMNAME}/postscripts/$f
done
fi
fi
}

View File

@ -29,6 +29,7 @@ TIMEOUT=15
function cold_reset_bmc() {
if [ -z $XPROD ]; then
logger -s -t $log_label -p local4.crit "CRITICAL ERROR - XPROD must be set before calling ${FUNCNAME[0]}"
rm -f /tmp/ipmicfg.xml
exit 1
fi
if [ "$XPROD" = "43707" -a "$IPMIMFG" != '0' ]; then
@ -87,6 +88,7 @@ function cold_reset_bmc() {
function snooze() {
if [ -z $XPROD ]; then
logger -s -t $log_label -p local4.crit "CRITICAL ERROR - XPROD must be set before calling ${FUNCNAME[0]}"
rm -f /tmp/ipmicfg.xml
exit 1
fi
if [ "$XPROD" = "43707" -a "$IPMIMFG" != '0' ]; then
@ -100,7 +102,15 @@ function snooze() {
logger -s -t $log_label -p local4.debug "snooze for 1 second..."
sleep 1
fi
}
}
if which ipmitool 2>&1 | grep no; then
echo "No ipmitool find, please install it first";
exit 1;
fi
# Add ipmi_devintf module to allow the ipmitool operation in-band
modprobe ipmi_devintf
allowcred.awk &
CREDPID=$!
@ -605,3 +615,5 @@ while [ $idev -gt 0 ]; do
fi
done
# remove the bmc configuration information before exit
rm -f /tmp/ipmicfg.xml

View File

@ -1,4 +1,5 @@
#!/bin/bash
log_label="xcat.genesis.getipmi"
allowcred.awk &
@ -6,6 +7,8 @@ CREDPID=$!
if [ -z "$XCATDEST" ]; then
XCATDEST=$1
fi
# This section only works in genesis
if [ -z "$XCATDEST" ]; then
for parm in `cat /proc/cmdline` ; do
if echo $parm |grep xcatd= > /dev/null; then
@ -13,6 +16,12 @@ if [ -z "$XCATDEST" ]; then
fi
done
fi
# This section works in diskless/diskful
# The environment MASTER_IP and XCATDPORT is exported by mypostscript
if [ -z "$XCATDEST" ]; then
XCATDEST=$MASTER_IP:$XCATDPORT
fi
for LANCHAN in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16; do
if ipmitool channel info $LANCHAN 2> /dev/null | grep 802.3 > /dev/null 2>&1 && ipmitool raw 0xc 2 $LANCHAN 5 0 0 > /dev/null 2>&1;
then break;