Confdump Agent  1.4.0
InitScript.cpp
Go to the documentation of this file.
00001 /* 
00002  * Confdump-Agent - Dump static and runtime system configuration
00003  * Copyright (C) 2009-2012  Straton IT, SAS
00004  * 
00005  * This program is free software: you can redistribute it and/or modify
00006  * it under the terms of the GNU General Public License version 3 as
00007  * published by the Free Software Foundation.
00008  * 
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  * 
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00016  */
00017 
00018 #include "QDir"
00019 #include "boost/foreach.hpp"
00020 #include "Confdump/System/LinuxDumper.hpp"
00021 #include "Confdump/System/Linux/InitScript.hpp"
00022 
00023 using boost::shared_ptr;
00024 
00025 namespace Confdump
00026 {
00027 
00028 namespace System
00029 {
00030 
00031 namespace Linux
00032 {
00033 
00034 InitScript::InitScript( QString name )
00035  : name_( name )
00036 {
00037 }
00038 
00039 InitScript::~InitScript()
00040 {
00041 }
00042 
00043 QString InitScript::name() const
00044 {
00045     return name_;
00046 }
00047 
00048 /* FIXME: use SystemContext
00049  *
00050  * FIXME: use boost::fs and a custom status to get full stat(2) information, error checking, etc
00051  *
00052  * FIXME: integrate this in some directory listing table
00053  */
00054 Result InitScript::allInitScripts( boost::shared_ptr<LinuxDumper> driver )
00055 {
00056     QDir initd( "/etc/init.d", "", QDir::Name, QDir::Files | QDir::Executable );
00057     QStringList scripts = initd.entryList();
00058 
00059     Result result;
00060     BOOST_FOREACH( QString name, scripts )
00061     {
00062         result.push_back( shared_ptr<InitScript>( new InitScript( name ) ) );
00063     }
00064 
00065     return result;
00066 }
00067 
00068 } // ns Linux
00069 } // ns System
00070 } // ns Confdump
00071 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends