From f3cee6b1ca62752134c6c3520c3739a193753768 Mon Sep 17 00:00:00 2001 From: Jan Safranek Date: Mon, 15 Jul 2013 15:40:22 +0200 Subject: Added -v option to openlmi-mof-register. --- openlmi-mof-register | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/openlmi-mof-register b/openlmi-mof-register index d327a1e..efc9df3 100755 --- a/openlmi-mof-register +++ b/openlmi-mof-register @@ -17,6 +17,7 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # # Authors: Radek Novacek +# Jan Safranek # pegasus_repository="/var/lib/Pegasus/" @@ -44,12 +45,15 @@ function stop_pegasus() function usage() { - printf "Usage: $0 [ --just-mofs ] [ -n namespace ] [ -c cimom ] + printf "Usage: $0 [ --just-mofs ] [ -n namespace ] [ -c cimom ] [-v version] CMD [mof] [...] [reg] CMD is one of [ register, unregister ] Default namespace is $default_namespace, which can be changed with '-n' option. + If a registration file is provided, '-v' parameter is mandatory and specifies + version of the provider API. + Supported cimoms are sfcbd and tog-pegasus. Without \"-c\" argument, the operation is processed for any cimom present on system (all of them). @@ -57,9 +61,9 @@ function usage() treated as mof files - no registration file is expected. usage with --just-mofs: - $0 CMD [mof] [...] + $0 --just-mofs CMD [mof] [...] usage without: - $0 CMD [mof] [...] \n" + $0 -v CMD [mof] [...] \n" } @@ -91,9 +95,9 @@ function register() if [ $JUST_MOFS -eq 0 ]; then if [ -x $(dirname $0)/openlmi-register-pegasus ]; then - cat "$reg" | $(dirname $0)/openlmi-register-pegasus | $CIMMOF -uc -n root/PG_Interop + cat "$reg" | $(dirname $0)/openlmi-register-pegasus -v "$version" | $CIMMOF -uc -n root/PG_Interop else - cat "$reg" | /usr/libexec/openlmi-register-pegasus | $CIMMOF -uc -n root/PG_Interop + cat "$reg" | /usr/libexec/openlmi-register-pegasus -v "$version" | $CIMMOF -uc -n root/PG_Interop fi fi fi @@ -141,7 +145,7 @@ function unregister() } JUST_MOFS=0 -optspec=":hn:c:-:" +optspec=":hn:c:v:-:" while getopts "$optspec" optchar; do case "$optchar" in @@ -176,6 +180,9 @@ while getopts "$optspec" optchar; do usage; exit 0; ;; + v) + version="$OPTARG" + ;; *) if [ "$OPTERR" != 1 ] || [ "${optspec:0:1}" = ":" ]; then echo "Non-option argument: '-${OPTARG}'" >&2 @@ -185,10 +192,17 @@ while getopts "$optspec" optchar; do esac done + shift $(($OPTIND - 1)) namespace=${namespace:-$default_namespace} cimom=${cimom:-all} +if [ "$JUST_MOFS" -eq 0 -a -z "$version" ]; then + echo "Missing -v option" + usage + exit 1 +fi + if [ $# -lt 2 ]; then usage -- cgit