COPKGManager: optimize handling after installation

Show a success message only if restart/reboot is required and user
should decide what to do or not.
NOTE: marker file should be generated by opkg package itself
(eg. with preinstall scripts), so it's controlled by the package maintainer!
This commit is contained in:
2014-12-19 23:33:05 +01:00
parent 7acdf65e65
commit 10debbbfa0
5 changed files with 33 additions and 6 deletions

View File

@@ -422,9 +422,36 @@ int COPKGManager::showMenu()
menu->hide ();
if (!has_err && installed)
DisplayInfoMessage(g_Locale->getText(LOCALE_OPKG_SUCCESS_INSTALL));
//handling after successful installation
string exit_action = "";
if (!has_err && installed){
/*!
Show a success message only if restart/reboot is required and user should decide what to do or not.
NOTE: marker file should be generated by opkg package itself (eg. with preinstall scripts),
so it's controlled by the package maintainer!
*/
//restart neutrino: user decision
if(!access( "/tmp/.restart", F_OK)){
int msg = ShowMsg(LOCALE_OPKG_TITLE, g_Locale->getText(LOCALE_OPKG_SUCCESS_INSTALL), CMsgBox::mbrNo,
CMsgBox::mbYesNo,
NEUTRINO_ICON_QUESTION,
width);
if (msg == CMsgBox::mbrYes)
exit_action = "restart";
}
//restart neutrino: forced
if (!access( "/tmp/.force_restart", F_OK))
exit_action = "restart";
//reboot stb: forced
if (!access( "/tmp/.reboot", F_OK))
exit_action = "reboot";
}
delete menu;
if (!exit_action.empty())
CNeutrinoApp::getInstance()->exec(NULL, exit_action);
return res;
}