mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-29 08:21:12 +02:00
COPKGManager: use installPackage() for install from package list too
installPackage() has also a new parameter for options, in this case is --force-reinstall in use.
This commit is contained in:
@@ -5,7 +5,7 @@
|
|||||||
OPKG-Manager Class for Neutrino-GUI
|
OPKG-Manager Class for Neutrino-GUI
|
||||||
|
|
||||||
Implementation:
|
Implementation:
|
||||||
Copyright (C) 2012-2014 T. Graf 'dbt'
|
Copyright (C) 2012-2015 T. Graf 'dbt'
|
||||||
www.dbox2-tuning.net
|
www.dbox2-tuning.net
|
||||||
|
|
||||||
Adaptions:
|
Adaptions:
|
||||||
@@ -189,17 +189,8 @@ int COPKGManager::exec(CMenuTarget* parent, const string &actionKey)
|
|||||||
force = "--force-reinstall ";
|
force = "--force-reinstall ";
|
||||||
}
|
}
|
||||||
|
|
||||||
//check package size...cancel installation if size check failed
|
//install package with size check ...cancel installation if check failed
|
||||||
if (!checkSize(actionKey)){
|
installPackage(actionKey, force);
|
||||||
DisplayErrorMessage(g_Locale->getText(LOCALE_OPKG_MESSAGEBOX_SIZE_ERROR));
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
int r = execCmd(pkg_types[OM_INSTALL] + force + actionKey, true, true);
|
|
||||||
if (r)
|
|
||||||
showError(g_Locale->getText(LOCALE_OPKG_FAILURE_INSTALL), strerror(errno), pkg_types[OM_INSTALL] + force + actionKey);
|
|
||||||
else
|
|
||||||
installed = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
refreshMenu();
|
refreshMenu();
|
||||||
}
|
}
|
||||||
@@ -709,17 +700,21 @@ void COPKGManager::showError(const char* local_msg, char* err_message, const str
|
|||||||
DisplayErrorMessage(msg.c_str());
|
DisplayErrorMessage(msg.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool COPKGManager::installPackage(const std::string& pkg_name)
|
bool COPKGManager::installPackage(const string& pkg_name, string options)
|
||||||
{
|
{
|
||||||
int r = execCmd(pkg_types[OM_INSTALL] + pkg_name, true, true);
|
//check package size...cancel installation if size check failed
|
||||||
|
if (!checkSize(pkg_name)){
|
||||||
if (r){
|
DisplayErrorMessage(g_Locale->getText(LOCALE_OPKG_MESSAGEBOX_SIZE_ERROR));
|
||||||
dprintf(DEBUG_NORMAL, "[COPKGManager] [%s - %d] error[%d]: %s\n", __func__, __LINE__, errno, strerror(errno));
|
}
|
||||||
// showError(g_Locale->getText(LOCALE_OPKG_FAILURE_INSTALL), strerror(errno), pkg_name);
|
else{
|
||||||
return false;
|
string opts = " " + options + " ";
|
||||||
|
|
||||||
|
int r = execCmd(pkg_types[OM_INSTALL] + opts + pkg_name, true, true);
|
||||||
|
if (r)
|
||||||
|
showError(g_Locale->getText(LOCALE_OPKG_FAILURE_INSTALL), strerror(errno), pkg_types[OM_INSTALL] + opts + pkg_name);
|
||||||
|
else
|
||||||
|
installed = true;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
installed = true;
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@@ -109,7 +109,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);
|
bool installPackage(const std::string& pkg_name, std::string options = std::string());
|
||||||
bool checkSize(const std::string& pkg_name);
|
bool checkSize(const std::string& pkg_name);
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user