diff options
-rwxr-xr-x | openlmi-mof-register | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/openlmi-mof-register b/openlmi-mof-register index 50e4bc5..67f1d61 100755 --- a/openlmi-mof-register +++ b/openlmi-mof-register @@ -22,6 +22,26 @@ pegasus_repository="/var/lib/Pegasus/" default_namespace="root/cimv2" +function start_pegasus() +{ + # Start Pegasus CIMOM in restricted mode, listening only on its unix socket + /usr/sbin/cimserver daemon=true \ + enableHttpConnection=false \ + enableHttpsConnection=false \ + enableRemotePrivilegedUserAccess=false \ + slp=false + + if [ "$?" != "0" ]; then + echo "Cannot start Pegasus" >&2 + exit 1 + fi +} + +function stop_pegasus() +{ + /usr/sbin/cimserver -s +} + function usage() { printf "Usage: $0 [ --just-mofs ] [ -n namespace ] [ -c cimom ] @@ -101,6 +121,11 @@ function unregister() if [ $HAS_PEGASUS -eq 1 ] && echo $cimom | grep -q 'all\|tog-pegasus'; then + # Pegasus must be running when removing MOF files and providers + if ! /usr/sbin/cimserver --status &>/dev/null; then + CUSTOM_PEGASUS=1 + start_pegasus + fi if [ -n "$reg" ]; then for provider in $(sed -n 's/ *group: *//p' "$reg" | sort | uniq); @@ -109,6 +134,9 @@ function unregister() done fi mofcomp -n $namespace -r ${mofs[@]} + if [ -n "$CUSTOM_PEGASUS" ]; then + stop_pegasus + fi fi } |