blob: cce058b47306bf84ac0d1c36172dc72b9d92c89b (
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
#!/bin/sh
#
# Copyright (C) 2012 Red Hat, Inc. All rights reserved.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#
# Authors: Radek Novacek <rnovacek@redhat.com>
#
pegasus_repository="/var/lib/Pegasus/repository"
function usage()
{
printf "Usage: $0 [ register | unregister ] mof reg\n"
}
function register()
{
mof=$1
reg=$2
if [ $HAS_SFCBD -eq 1 ];
then
/usr/bin/sfcbstage -r $reg $mof
/usr/bin/sfcbrepos -f
/usr/bin/systemctl reload-or-try-restart sblim-sfcb.service
fi
if [ $HAS_PEGASUS -eq 1 ];
then
/usr/sbin/cimserver --status > /dev/null 2>&1
if [ $? -eq 0 ];
then
CIMMOF="/usr/bin/cimmof"
else
CIMMOF="/usr/bin/cimmofl -R $pegasus_repository"
fi
$CIMMOF -uc $mof
if [ -x $(dirname $0)/openlmi-register-pegasus ];
then
cat $reg | $(dirname $0)/openlmi-register-pegasus | $CIMMOF -uc -n root/PG_Interop
else
cat $reg | /usr/libexec/openlmi-register-pegasus | $CIMMOF -uc -n root/PG_Interop
fi
fi
}
function unregister()
{
mof=$1
reg=$2
if [ $HAS_SFCBD -eq 1 ];
then
/usr/bin/sfcbunstage -r $(basename $reg) $(basename $mof)
/usr/bin/sfcbrepos -f
/usr/bin/systemctl reload-or-try-restart sblim-sfcb.service
fi
if [ $HAS_PEGASUS -eq 1 ];
then
for provider in $(sed -n 's/ *location: *//p' $reg | sort | uniq);
do
/usr/bin/cimprovider -d -m ${provider} && /usr/bin/cimprovider -r -m ${provider}
done
fi
}
if [ $# -lt 3 ];
then
usage
exit 1
fi
if [ -e /usr/sbin/sfcbd ];
then
HAS_SFCBD=1
else
HAS_SFCBD=0
fi
if [ -e /usr/sbin/cimserver ];
then
HAS_PEGASUS=1
else
HAS_PEGASUS=0
fi
# TODO: check if at least one server is installed
case $1 in
register)
register $2 $3
break;;
unregister)
unregister $2 $3
break;;
**)
usage
exit 1
esac
|