summaryrefslogtreecommitdiffstats
path: root/openlmi-mof-register
diff options
context:
space:
mode:
authorMichal Minar <miminar@redhat.com>2013-03-22 10:30:35 +0100
committerMichal Minar <miminar@redhat.com>2013-03-22 10:30:35 +0100
commit6565f1261bf5ec326e780a2b2becbb8200c63b7c (patch)
treefdf73ef40abc1073112befb98ec55bdf1562167a /openlmi-mof-register
parentefd5ac0f86f69e146444f199d575b3e980492fee (diff)
downloadopenlmi-providers-6565f1261bf5ec326e780a2b2becbb8200c63b7c.tar.gz
openlmi-providers-6565f1261bf5ec326e780a2b2becbb8200c63b7c.tar.xz
openlmi-providers-6565f1261bf5ec326e780a2b2becbb8200c63b7c.zip
support the registration of mof files only0.0.20
openlmi-mof-register script now allows to register just the mof files without any providers LMI_Qualifiers.mof should be included in dependent mof files with # pragma include ("LMI_Qualifiers.mof")
Diffstat (limited to 'openlmi-mof-register')
-rwxr-xr-xopenlmi-mof-register48
1 files changed, 35 insertions, 13 deletions
diff --git a/openlmi-mof-register b/openlmi-mof-register
index 61e54af..e322664 100755
--- a/openlmi-mof-register
+++ b/openlmi-mof-register
@@ -23,17 +23,29 @@ pegasus_repository="/var/lib/Pegasus/"
function usage()
{
- printf "Usage: $0 [ register | unregister ] <mof> [mof] [...] <reg>\n"
+ printf "Usage: $0 [ --just-mofs ] CMD <mof> [mof] [...] [reg]
+ CMD is one of [ register, unregister ]
+
+ just-mofs option causes that all arguments after CMD will be
+ treated as mof files - no registration file is expected.
+
+ usage with --just-mofs:
+ $0 CMD <mof> [mof] [...]
+ usage without:
+ $0 CMD <mof> [mof] [...] <reg>\n"
+
}
function register()
{
- reg=$1
- shift
+ if [ $JUST_MOFS -eq 0 ]; then
+ reg=$1
+ shift
+ fi
mofs="$@"
if [ $HAS_SFCBD -eq 1 ];
then
- /usr/bin/sfcbstage -r "$reg" "$mofs"
+ /usr/bin/sfcbstage ${reg:+-r} $reg $mofs
/usr/bin/sfcbrepos -f
/usr/bin/systemctl reload-or-try-restart sblim-sfcb.service
fi
@@ -49,19 +61,23 @@ function register()
fi
$CIMMOF -uc $mofs
- 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
+ if [ $JUST_MOFS = 0 ]; then
+ 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
fi
}
function unregister()
{
- reg=$1
- shift
+ if [ $JUST_MOFS -eq 0 ]; then
+ reg=$1
+ shift
+ fi
# convert mofs to `basename mof`
declare -a mofs=("$@")
for ((i=0; i<${#mofs[@]}; i++)); do
@@ -70,12 +86,12 @@ function unregister()
if [ $HAS_SFCBD -eq 1 ];
then
- /usr/bin/sfcbunstage -r $(basename "$reg") ${mofs[@]}
+ /usr/bin/sfcbunstage ${reg:+-r} $(basename "$reg") ${mofs[@]}
/usr/bin/sfcbrepos -f
/usr/bin/systemctl reload-or-try-restart sblim-sfcb.service
fi
- if [ $HAS_PEGASUS -eq 1 ];
+ if [ -n "$reg" -a $HAS_PEGASUS -eq 1 ];
then
for provider in $(sed -n 's/ *location: *//p' "$reg" | sort | uniq);
do
@@ -106,6 +122,12 @@ fi
# TODO: check if at least one server is installed
+if [ "$1" = "--just-mofs" ]; then
+ JUST_MOFS=1
+ shift
+else
+ JUST_MOFS=0
+fi
CMD=$1
shift