File rmmof.sh of Package tog-pegasus

#!/bin/sh
# 
# options:
# rmmof.sh <MOF_PATH> <NAMESPACE> <FILES>
#
# - or -
#
# options:
# rmmof.sh -n <NAMESPACE> <FILES> [...]
#
# The former is preserved for compatibility with Pegasus and 
# sblim providers.  The latter is preferred.  If $1 is "-n",
# the latter code path is executed.  Otherwise the former is 
# executed.

ALLOW_ONLINEUPDATE="false"
CIMOM_INIT=/etc/init.d/tog-pegasus
DBDIR="/var/lib/Pegasus"
REPOSITORY="$DBDIR/repository"
LOGFILE=$DBDIR/loadmof.log
if [ "x$3" = "x" ]; then
    echo "Usage: $0 -n <NAMESPACE> <FILES> [...]"
    exit 1
fi
echo -- "$@"
if [ ! -f "$CIMOM_INIT" ]; then
    echo "missing \"$CIMOM_INIT\". exiting" >&2
    exit 1
fi
if [ "$YAST_IS_RUNNING" != "instsys" ] ; then
    $CIMOM_INIT status &> /dev/null
    CIMOM_RUNNING=$?
fi
#
if [ "x$CIMOM_RUNNING" != "x0"  ]; then
    echo "Pegasus WBEM requires a running cimom to unregister providers. running '$CIMOM_INIT start'." >&2
    $CIMOM_INIT start &> /dev/null
    if [ $? == 0 ] ; then
        STARTED="true"
    else
        STARTED="false"
    fi
fi
if [ "$YAST_IS_RUNNING" != "instsys" ] ; then
    $CIMOM_INIT status &> /dev/null
    CIMOM_RUNNING=$?
fi
# get rid of "-n" arg
shift 

NS="$1"

shift
REG=""
case "$1" in
  "/usr/share/sblim-cmpi-base/Linux_Base.mof")
    REG="/usr/share/sblim-cmpi-base/Linux_BaseIndication.registration"
  ;;
  *)
    REG="${1%%.mof}.registration"
  ;;
esac

/usr/share/Pegasus/scripts/provider-register.sh -d -t pegasus -r "$REG" -m "$1"       &> $LOGFILE
RVAL=$?
if [ "$RVAL" != 0 ]; then
    echo  "Error unregistering $mod provider."
    exit 1
fi

if [ "x$STARTED" = "xtrue" ]; then
    /etc/init.d/tog-pegasus stop 1>&2 > /dev/null
fi

exit $RVAL
openSUSE Build Service is sponsored by