From 6565f1261bf5ec326e780a2b2becbb8200c63b7c Mon Sep 17 00:00:00 2001 From: Michal Minar Date: Fri, 22 Mar 2013 10:30:35 +0100 Subject: support the registration of mof files only 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") --- openlmi-mof-register | 48 +++++++++++++++++++++++++++++++++++------------- 1 file changed, 35 insertions(+), 13 deletions(-) (limited to 'openlmi-mof-register') 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] [...] \n" + printf "Usage: $0 [ --just-mofs ] CMD [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] [...] + usage without: + $0 CMD [mof] [...] \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 -- cgit