1
by Guillaume BOTTEX
Import upstream version 1.0.1 |
1 |
#!/bin/bash
|
2 |
||
3 |
################################################################################
|
|
4 |
# Linux Management Providers (LMP), System Memory provider package
|
|
5 |
# Copyright (C) 2008 Guillaume BOTTEX, ETRI <guillaumebottex@etri.re.kr, guillaumebottex@gmail.com>
|
|
6 |
#
|
|
7 |
# This program is being developed under the "OpenDRIM" project.
|
|
8 |
# The "OpenDRIM" project web page: http://opendrim.sourceforge.net
|
|
9 |
# The "OpenDRIM" project mailing list: opendrim@googlegroups.com
|
|
10 |
#
|
|
11 |
# This program is free software; you can redistribute it and/or
|
|
12 |
# modify it under the terms of the GNU General Public License
|
|
13 |
# as published by the Free Software Foundation; version 2
|
|
14 |
# of the License.
|
|
15 |
#
|
|
16 |
# This program is distributed in the hope that it will be useful,
|
|
17 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
18 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
19 |
# GNU General Public License for more details.
|
|
20 |
#
|
|
21 |
# You should have received a copy of the GNU General Public License
|
|
22 |
# along with this program; if not, write to the Free Software
|
|
23 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
24 |
#################################################################################
|
|
25 |
||
26 |
#################################################################################
|
|
27 |
# To contributors, please leave your contact information in this section
|
|
28 |
# AND comment your changes in the source code.
|
|
29 |
#
|
|
30 |
# Modified by <Author(s)>, <Affiliation>, <Year>
|
|
31 |
################################################################################
|
|
32 |
||
33 |
if test "$2" = pegasus |
|
34 |
then
|
|
35 |
||
36 |
cimprovider -d -m SystemMemory_OpenDRIM_RegisteredMemoryProfileModule |
|
37 |
cimprovider -r -m SystemMemory_OpenDRIM_RegisteredMemoryProfileModule |
|
38 |
||
39 |
OUTFILE=./TEMP_REGISTRATION |
|
40 |
||
41 |
cat >> $OUTFILE <<EOFC |
|
42 |
<?xml version="1.0" encoding="utf-8" ?>
|
|
43 |
<CIM CIMVERSION="2.0" DTDVERSION="2.0">
|
|
44 |
<MESSAGE ID="1" PROTOCOLVERSION="1.0">
|
|
45 |
<SIMPLEREQ>
|
|
46 |
<IMETHODCALL NAME="DeleteClass">
|
|
47 |
<LOCALNAMESPACEPATH>
|
|
48 |
EOFC
|
|
49 |
||
50 |
namespace=$3 |
|
51 |
index=`expr index $namespace /` |
|
52 |
||
53 |
while [ $index != 0 ] |
|
54 |
do
|
|
55 |
namespaceFragment=${namespace:0:index-1} |
|
56 |
namespace=${namespace:index:${#namespace}-index} |
|
57 |
index=`expr index $namespace /` |
|
58 |
cat >> $OUTFILE <<EOFC |
|
59 |
<NAMESPACE NAME="$namespaceFragment"></NAMESPACE>
|
|
60 |
EOFC
|
|
61 |
done
|
|
62 |
||
63 |
cat >> $OUTFILE <<EOFC |
|
64 |
<NAMESPACE NAME="$namespace"></NAMESPACE>
|
|
65 |
EOFC
|
|
66 |
||
67 |
cat >> $OUTFILE <<EOFC |
|
68 |
</LOCALNAMESPACEPATH>
|
|
69 |
<IPARAMVALUE NAME="ClassName">
|
|
70 |
<CLASSNAME NAME="OpenDRIM_RegisteredMemoryProfile"/>
|
|
71 |
</IPARAMVALUE>
|
|
72 |
</IMETHODCALL>
|
|
73 |
</SIMPLEREQ>
|
|
74 |
</MESSAGE>
|
|
75 |
</CIM>
|
|
76 |
||
77 |
EOFC
|
|
78 |
||
79 |
PATH=$PATH:$PEGASUS_HOME/bin |
|
80 |
wbemexec $OUTFILE
|
|
81 |
||
82 |
rm -f $OUTFILE
|
|
83 |
||
84 |
fi
|
|
85 |
||
86 |
if test "$2" = sfcb |
|
87 |
then
|
|
88 |
||
89 |
OUTFILE=./OpenDRIM_RegisteredMemoryProfile.reg |
|
90 |
||
91 |
cat >> $OUTFILE <<EOFC |
|
92 |
[OpenDRIM_RegisteredMemoryProfile]
|
|
93 |
provider: SystemMemory_OpenDRIM_RegisteredMemoryProfileProvider
|
|
94 |
location: cmpiSystemMemory_OpenDRIM_RegisteredMemoryProfileProvider
|
|
95 |
type: instance
|
|
96 |
namespace: $3
|
|
97 |
#
|
|
98 |
EOFC
|
|
99 |
||
100 |
sfcbunstage -r $OUTFILE -n $3 OpenDRIM_RegisteredMemoryProfile.mof |
|
101 |
||
102 |
rm -f $OUTFILE
|
|
103 |
||
104 |
sfcbrepos -f |
|
105 |
||
106 |
fi
|
|
107 |
||
108 |
if test "$2" = openwbem |
|
109 |
then
|
|
110 |
||
111 |
OUTFILE=./OpenDRIM_RegisteredMemoryProfile-reg.mof |
|
112 |
rm -f $OUTFILE
|
|
113 |
sed "s/Provider *( *\"cmpi:/Provider(\"cmpi::/g" < $4/mof/OpenDRIM_RegisteredMemoryProfile.mof >> $OUTFILE |
|
114 |
owmofc -u http://localhost/$3 -r $OUTFILE |
|
115 |
||
116 |
rm -f $OUTFILE
|
|
117 |
||
118 |
fi
|