File: //opt/perf/bin/xglance
#!/bin/sh
#==============================================================================
# @(#)xglance script 11.00.011 =*=
#==============================================================================
Check_Dep() {
EXIT_STATUS=0
LIST=`/usr/lib/rpm/find-requires << EOF
$XGLANCE
EOF`
for i in $LIST
do
rpm -q --whatprovides $i > /dev/null 2>&1
if [ $? -ne 0 ]
then
if [ `uname -s` = "Linux" ] && [ ${i:0:10} = "libXm.so.3" ]; then
if [ `uname -m` = "x86" ] ; then
if [ ! -L /opt/perf/lib/libXm.so.3 ] ; then
LIB_NOT_FOUND="$i $LIB_NOT_FOUND"
EXIT_STATUS=1
else
if [ ! -f `readlink /opt/perf/lib/libXm.so.3` ]; then
LIB_NOT_FOUND="$i $LIB_NOT_FOUND"
EXIT_STATUS=1
fi
fi
else
if [ `uname -m` = "ppc64" ] || [ `uname -m` = "x86_64" ]; then
if [ ! -L /opt/perf/lib64/libXm.so.3 ] ; then
LIB_NOT_FOUND="$i $LIB_NOT_FOUND"
EXIT_STATUS=1
else
if [ ! -f `readlink /opt/perf/lib64/libXm.so.3` ]; then
LIB_NOT_FOUND="$i $LIB_NOT_FOUND"
EXIT_STATUS=1
fi
fi
fi
fi
else
LIB_NOT_FOUND="$i $LIB_NOT_FOUND"
EXIT_STATUS=1
fi
fi
done
if [ $EXIT_STATUS -ne 0 ]
then
echo "ERROR: The following dependencies have not been met for $XGLANCE"
echo " $LIB_NOT_FOUND"
fi
return $EXIT_STATUS
}
Launch_Xglance() {
if [ "$LAUNCH_XGLANCE" = "YES" ]
then
exec $XGLANCE ${1+"$@"}
fi
}
#==============================================================================
# MAIN
#==============================================================================
LAUNCH_XGLANCE="YES"
XGLANCE="/opt/perf/bin/xglance-bin"
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/perf/lib64
#
# Do not launch the xglance-bin binary if the -check option is passed
#
if [ "$1" = "-check" ]
then
LAUNCH_XGLANCE=NO
fi
if [ ! -x $XGLANCE ]
then
echo "ERROR: $XGLANCE not found"
exit 1
fi
#
# Check for the dependencies first, and launch xglance-bin
# if -check option is not passed
#
if Check_Dep
then
Launch_Xglance $*
else
exit 1
fi