00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef SCPM_H
00019 #define SCPM_H
00020
00021 using namespace std;
00022
00023 #include <string>
00024 #include <vector>
00025 #include <scpm_types.h>
00026 #include <scdb.h>
00027
00028 class SCPM
00029 {
00030 public:
00031
00032 SCPM( int options=0, ostream &info_out=cout, ostream &hash_out=cout, string root="" );
00033 ~SCPM();
00034
00035 bool Enable( bool force=false );
00036 bool Disable( );
00037
00038 bool Active( string &profile );
00039 bool List( vector<string> &profiles );
00040
00041 bool Add( string profile, bool auto_switch=true );
00042 bool Copy( string source_profile, string profile );
00043 bool Create( string profile, string source_profile );
00044 bool Delete( string profile );
00045 bool Rename( string profile, string newprofile );
00046 bool Reload( );
00047 bool PrepareSwitch( string profile, switch_info_t &switch_info );
00048 bool Switch( switch_info_t &switch_info );
00049 bool Save( switch_info_t &switch_info );
00050 bool Modify( string profile, string action );
00051 bool Set( string command, string argument, string profile="" );
00052 bool Get( string command, string &result, string profile="" );
00053 bool Status( scpm_status_t &status );
00054
00055 bool ShowChanges( ostream &output, string resource_type, string resource_name );
00056
00057 bool SetResourceSet( string set );
00058 bool GetResourceSet( string &set );
00059 bool ListResourceSets( vector<string> &predefined, vector<string> &individual );
00060 bool CopyResourceSet( string set, string newset );
00061 bool DeleteResourceSet( string set );
00062
00063 bool ListResourceGroups( vector<resource_group_t> &groups );
00064 bool GetResourceGroup( const string &name, vector<resource_entry_t> &group );
00065 bool GetResourceGroup( const string &name, vector<resource_entry_t> &group,
00066 string &description );
00067 bool SetResourceGroup( const string &name, const vector<resource_entry_t> &group,
00068 const string &description );
00069 bool DeleteResourceGroup( const string &group );
00070 bool RenameResourceGroup( const string &group, const string &newgroup );
00071 bool SetActiveResourceGroups( const vector<string> &groups );
00072 bool GetActiveResourceGroups( vector<string> &groups );
00073 bool ActivateResourceGroup( const string &group, bool auto_add=false );
00074 bool DeactivateResourceGroup( const string &group, bool auto_remove=false );
00075 bool ResetResourceGroup( const string &group );
00076 bool ResetAllGroups( );
00077
00078 bool RebuildDB( );
00079
00080 bool SetConfigOption( const string &option, const string &value );
00081 bool GetConfigOption( const string &option, string &value );
00082
00083
00084 bool Update( const string &scriptname, vector<pair<string, string> > resources );
00085 bool UpdateResources( );
00086 bool Backup( const string &command, const vector<pair<string,string> > &resources,
00087 const string &profile, vector<backup_info_t> *reslist=NULL );
00088
00089 };
00090
00091
00092 #endif