mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-29 08:21:12 +02:00
COPKGManager: outsource methode for install any package
Required for external usage.
This commit is contained in:
@@ -153,13 +153,10 @@ int COPKGManager::exec(CMenuTarget* parent, const string &actionKey)
|
||||
|
||||
if (fileBrowser.exec((*local_dir).c_str()))
|
||||
{
|
||||
string pgk_name = fileBrowser.getSelectedFile()->Name;
|
||||
int r = execCmd(pkg_types[OM_INSTALL] + pgk_name, true, true);
|
||||
string pkg_name = fileBrowser.getSelectedFile()->Name;
|
||||
installPackage(pkg_name);
|
||||
|
||||
*local_dir = fileBrowser.getCurrentDir();
|
||||
if (r) {
|
||||
showError(g_Locale->getText(LOCALE_OPKG_FAILURE_INSTALL), strerror(errno), pgk_name);
|
||||
} else
|
||||
installed = true;
|
||||
refreshMenu();
|
||||
}
|
||||
return res;
|
||||
@@ -670,3 +667,17 @@ void COPKGManager::showError(const char* local_msg, char* err_message, const str
|
||||
msg += command;
|
||||
DisplayErrorMessage(msg.c_str());
|
||||
}
|
||||
|
||||
bool COPKGManager::installPackage(const std::string& pkg_name)
|
||||
{
|
||||
int r = execCmd(pkg_types[OM_INSTALL] + pkg_name, true, true);
|
||||
|
||||
if (r){
|
||||
showError(g_Locale->getText(LOCALE_OPKG_FAILURE_INSTALL), strerror(errno), pkg_name);
|
||||
return false;
|
||||
}
|
||||
else
|
||||
installed = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@@ -96,5 +96,6 @@ 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);
|
||||
};
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user