COPKGManager: add optional parameter force_configure to installPackage()

This commit is contained in:
2015-02-05 12:26:29 +01:00
parent aad5db705f
commit 0f1a6e7588
2 changed files with 9 additions and 4 deletions

View File

@@ -75,6 +75,7 @@ enum
OM_INFO, OM_INFO,
OM_INSTALL, OM_INSTALL,
OM_STATUS, OM_STATUS,
OM_CONFIGURE,
OM_MAX OM_MAX
}; };
@@ -89,6 +90,7 @@ static const string pkg_types[OM_MAX] =
OPKG_CL " info ", OPKG_CL " info ",
OPKG_CL OPKG_CL_CONFIG_OPTIONS " install ", OPKG_CL OPKG_CL_CONFIG_OPTIONS " install ",
OPKG_CL " status ", OPKG_CL " status ",
OPKG_CL " configure "
}; };
COPKGManager::COPKGManager(): opkg_conf('\t') COPKGManager::COPKGManager(): opkg_conf('\t')
@@ -724,7 +726,7 @@ void COPKGManager::showError(const char* local_msg, char* err_message, const str
DisplayErrorMessage(msg.c_str()); DisplayErrorMessage(msg.c_str());
} }
bool COPKGManager::installPackage(const string& pkg_name, string options) bool COPKGManager::installPackage(const string& pkg_name, string options, bool force_configure)
{ {
//check package size...cancel installation if size check failed //check package size...cancel installation if size check failed
if (!checkSize(pkg_name)){ if (!checkSize(pkg_name)){
@@ -734,10 +736,13 @@ bool COPKGManager::installPackage(const string& pkg_name, string options)
string opts = " " + options + " "; string opts = " " + options + " ";
int r = execCmd(pkg_types[OM_INSTALL] + opts + pkg_name, true, true); int r = execCmd(pkg_types[OM_INSTALL] + opts + pkg_name, true, true);
if (r) if (r){
showError(g_Locale->getText(LOCALE_OPKG_FAILURE_INSTALL), strerror(errno), pkg_types[OM_INSTALL] + opts + pkg_name); showError(g_Locale->getText(LOCALE_OPKG_FAILURE_INSTALL), strerror(errno), pkg_types[OM_INSTALL] + opts + pkg_name);
else }else{
if (force_configure)
execCmd(pkg_types[OM_CONFIGURE] + pkg_name, false, false);
installed = true; installed = true;
}
} }
return true; return true;

View File

@@ -118,7 +118,7 @@ class COPKGManager : public CMenuTarget
int exec(CMenuTarget* parent, const std::string & actionKey); int exec(CMenuTarget* parent, const std::string & actionKey);
static bool hasOpkgSupport(); static bool hasOpkgSupport();
bool checkUpdates(const std::string & package_name = std::string(), bool show_progress = true); bool checkUpdates(const std::string & package_name = std::string(), bool show_progress = true);
bool installPackage(const std::string& pkg_name, std::string options = std::string()); bool installPackage(const std::string& pkg_name, std::string options = std::string(), bool force_configure = false);
bool checkSize(const std::string& pkg_name); bool checkSize(const std::string& pkg_name);
}; };
#endif #endif