aboutsummaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-support/openwbem/openwbem/rmmof.sh
blob: a495415be523798f70365be15fe2d7ad289ead6b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/sh
# 
# options:
# rmmof.sh <MOF_PATH> <NAMESPACE> <FILES>
#
# - or -
#
# options:
# loadmof.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.

if [ "x$3" = "x" ]; then
    echo "Usage: $0 -n <NAMESPACE> <FILES> [...]"
    exit 1
fi

# get rid of "-n" arg
shift 

NS="$1"

shift 

DBDIR=/var/lib/openwbem
CIMOM_INIT=/etc/init.d/owcimomd
if [ "$YAST_IS_RUNNING" != "instsys" ] ; then
    $CIMOM_INIT status
    CIMOM_RUNNING=$?
fi
if [ "x$CIMOM_RUNNING" = "x0"  ]; then
  $CIMOM_INIT stop
fi
bkpdir=/tmp/owrep.bkp-$$
mkdir $bkpdir
cp -a $DBDIR $bkpdir/
echo "Compiling MOF files"
/usr/bin/owmofc -r -n $NS -d $DBDIR "$@" > /dev/null 2>&1
RVAL=$?
if [ "x$RVAL" != "x0" ]; then
  echo "MOF import failed!"
  rm -rf $DBDIR
  mv $bkpdir/openwbem $DBDIR
fi
rm -rf $bkpdir
if [ "x$CIMOM_RUNNING" = "x0"  ]; then
  $CIMOM_INIT start
fi
exit $RVAL