#!/bin/bash

################################################################################
# Linux Management Providers (LMP), System Memory provider package
# Copyright (C) 2008 Guillaume BOTTEX, ETRI <guillaumebottex@etri.re.kr, guillaumebottex@gmail.com>
# 
# This program is being developed under the "OpenDRIM" project.
# The "OpenDRIM" project web page: http://opendrim.sourceforge.net
# The "OpenDRIM" project mailing list: opendrim@googlegroups.com
# 
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; version 2
# of the License.
# 
# This program 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 General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
#################################################################################

#################################################################################
# To contributors, please leave your contact information in this section
# AND comment your changes in the source code.
# 
# Modified by <Author(s)>, <Affiliation>, <Year>
################################################################################

if test "$3" = pegasus
then
	
	cimmof -aE -n $1 $6/mof/OpenDRIM_MemoryCapabilities.mof

	OUTFILE=./TEMP_REGISTRATION
	
cat >> $OUTFILE << EOFC
instance of PG_ProviderModule {
Caption = "OpenDRIM_MemoryCapabilities provider module";
Name = "SystemMemory_OpenDRIM_MemoryCapabilitiesModule";
Location = "cmpiSystemMemory_OpenDRIM_MemoryCapabilitiesProvider";
Vendor = "$2";
Version = "$5";
InterfaceType = "CMPI";
InterfaceVersion = "2.0.0";
};

instance of PG_Provider {
Caption = "OpenDRIM_MemoryCapabilities provider";
Name = "SystemMemory_OpenDRIM_MemoryCapabilitiesProvider";
ProviderModuleName = "SystemMemory_OpenDRIM_MemoryCapabilitiesModule";
};

instance of PG_ProviderCapabilities {
Caption = "OpenDRIM_MemoryCapabilities provider capabilities";
ProviderModuleName = "SystemMemory_OpenDRIM_MemoryCapabilitiesModule";
ProviderName = "SystemMemory_OpenDRIM_MemoryCapabilitiesProvider";
ClassName = "OpenDRIM_MemoryCapabilities";
ProviderType = {2, 3};
Namespaces = {"$1"};
SupportedProperties = {"ManagedElement", "Capabilities", "Characteristics"};
CapabilityID = "SystemMemory_OpenDRIM_MemoryCapabilities";
};

EOFC
	
	cimmof -n root/PG_InterOp $OUTFILE
	
	rm -f $OUTFILE
	
fi

if test "$3" = sfcb
then
	
	OUTFILE=./OpenDRIM_MemoryCapabilities.reg
	
cat >> $OUTFILE <<EOFC
[OpenDRIM_MemoryCapabilities]   
   provider: SystemMemory_OpenDRIM_MemoryCapabilitiesProvider
   location: cmpiSystemMemory_OpenDRIM_MemoryCapabilitiesProvider
   type: instance association
   namespace: $1
#
EOFC
	
	sfcbstage -r $OUTFILE -n $1 $6/mof/OpenDRIM_MemoryCapabilities.mof
	
	rm -f $OUTFILE
	
	sfcbrepos -f
	
fi

if test "$3" = openwbem
then
	
	OUTFILE=./OpenDRIM_MemoryCapabilities-reg.mof
	rm -f $OUTFILE
	sed "s/Provider *( *\"cmpi:/Provider(\"cmpi::/g" < $6/mof/OpenDRIM_MemoryCapabilities.mof >> $OUTFILE
	owmofc -u http://localhost/$1 $OUTFILE
	
	rm -f $OUTFILE
	
fi
