From 0f1a6e7588a6368159c737af8f7f647873e0f0ce Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 5 Feb 2015 12:26:29 +0100 Subject: [PATCH] COPKGManager: add optional parameter force_configure to installPackage() --- src/gui/opkg_manager.cpp | 11 ++++++++--- src/gui/opkg_manager.h | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/gui/opkg_manager.cpp b/src/gui/opkg_manager.cpp index 71b6ef3cb..629b3f021 100644 --- a/src/gui/opkg_manager.cpp +++ b/src/gui/opkg_manager.cpp @@ -75,6 +75,7 @@ enum OM_INFO, OM_INSTALL, OM_STATUS, + OM_CONFIGURE, OM_MAX }; @@ -89,6 +90,7 @@ static const string pkg_types[OM_MAX] = OPKG_CL " info ", OPKG_CL OPKG_CL_CONFIG_OPTIONS " install ", OPKG_CL " status ", + OPKG_CL " configure " }; 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()); } -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 if (!checkSize(pkg_name)){ @@ -734,10 +736,13 @@ bool COPKGManager::installPackage(const string& pkg_name, string options) string opts = " " + options + " "; 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); - else + }else{ + if (force_configure) + execCmd(pkg_types[OM_CONFIGURE] + pkg_name, false, false); installed = true; + } } return true; diff --git a/src/gui/opkg_manager.h b/src/gui/opkg_manager.h index 338a3d160..97b736d90 100644 --- a/src/gui/opkg_manager.h +++ b/src/gui/opkg_manager.h @@ -118,7 +118,7 @@ class COPKGManager : public CMenuTarget int exec(CMenuTarget* parent, const std::string & actionKey); static bool hasOpkgSupport(); 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); }; #endif