mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-27 23:42:58 +02:00
* Software Update with apply the settings (Part9)
- Functions now available for internet & local update. - Rename writemtdExt() to applySettings()
This commit is contained in:
@@ -436,6 +436,7 @@ filesystem.is.utf8 Dateisystem
|
|||||||
filesystem.is.utf8.option.iso8859.1 ISO-8859-1
|
filesystem.is.utf8.option.iso8859.1 ISO-8859-1
|
||||||
filesystem.is.utf8.option.utf8 UTF-8
|
filesystem.is.utf8.option.utf8 UTF-8
|
||||||
flashupdate.actionreadflash lese Flash
|
flashupdate.actionreadflash lese Flash
|
||||||
|
flashupdate.apply_settings Sollen die aktuellen Einstellungen in das neue Image übernommen werden?
|
||||||
flashupdate.cantopenfile kann Datei nicht öffnen
|
flashupdate.cantopenfile kann Datei nicht öffnen
|
||||||
flashupdate.cantopenmtd kann MTD nicht öffnen
|
flashupdate.cantopenmtd kann MTD nicht öffnen
|
||||||
flashupdate.checkupdate_internet Online nach Updates suchen
|
flashupdate.checkupdate_internet Online nach Updates suchen
|
||||||
|
@@ -436,6 +436,7 @@ filesystem.is.utf8 file system
|
|||||||
filesystem.is.utf8.option.iso8859.1 ISO-8859-1
|
filesystem.is.utf8.option.iso8859.1 ISO-8859-1
|
||||||
filesystem.is.utf8.option.utf8 UTF-8
|
filesystem.is.utf8.option.utf8 UTF-8
|
||||||
flashupdate.actionreadflash reading
|
flashupdate.actionreadflash reading
|
||||||
|
flashupdate.apply_settings Import current settings into new image?
|
||||||
flashupdate.cantopenfile can't open file
|
flashupdate.cantopenfile can't open file
|
||||||
flashupdate.cantopenmtd can't open MTD
|
flashupdate.cantopenmtd can't open MTD
|
||||||
flashupdate.checkupdate_internet Check for online updates
|
flashupdate.checkupdate_internet Check for online updates
|
||||||
|
@@ -121,30 +121,38 @@ bool CExtUpdate::ErrorReset(bool modus, const std::string & msg1, const std::str
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CExtUpdate::writemtdExt(const std::string & filename)
|
bool CExtUpdate::applySettings(const std::string & filename, int mode)
|
||||||
{
|
{
|
||||||
if(!FileHelpers)
|
if(!FileHelpers)
|
||||||
FileHelpers = new CFileHelpers();
|
FileHelpers = new CFileHelpers();
|
||||||
imgFilename = (std::string)g_settings.update_dir + "/" + FILESYSTEM_ENCODING_TO_UTF8_STRING(filename);
|
|
||||||
|
if (mode == MODE_EXPERT)
|
||||||
|
imgFilename = (std::string)g_settings.update_dir + "/" + FILESYSTEM_ENCODING_TO_UTF8_STRING(filename);
|
||||||
|
else
|
||||||
|
imgFilename = FILESYSTEM_ENCODING_TO_UTF8_STRING(filename);
|
||||||
|
|
||||||
DBG_TIMER_START()
|
DBG_TIMER_START()
|
||||||
bool ret = writemtdExt();
|
bool ret = applySettings();
|
||||||
DBG_TIMER_STOP("Image editing")
|
DBG_TIMER_STOP("Image editing")
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
if (mtdRamError != "")
|
if (mtdRamError != "")
|
||||||
DisplayErrorMessage(mtdRamError.c_str());
|
DisplayErrorMessage(mtdRamError.c_str());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ((mtdNumber < 3) || (mtdNumber > 4)) {
|
if (mode == MODE_EXPERT) {
|
||||||
const char *err = "invalid mtdNumber\n";
|
if ((mtdNumber < 3) || (mtdNumber > 4)) {
|
||||||
printf(err);
|
const char *err = "invalid mtdNumber\n";
|
||||||
DisplayErrorMessage(err);
|
printf(err);
|
||||||
WRITE_UPDATE_LOG("ERROR: %s", err);
|
DisplayErrorMessage(err);
|
||||||
return false;
|
WRITE_UPDATE_LOG("ERROR: %s", err);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ShowMsgUTF(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_FLASHUPDATE_UPDATE_WITH_SETTINGS_SUCCESSFULLY), CMessageBox::mbrOk, CMessageBox::mbOk, NEUTRINO_ICON_INFO);
|
ShowMsgUTF(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_FLASHUPDATE_UPDATE_WITH_SETTINGS_SUCCESSFULLY), CMessageBox::mbrOk, CMessageBox::mbOk, NEUTRINO_ICON_INFO);
|
||||||
WRITE_UPDATE_LOG("\n");
|
WRITE_UPDATE_LOG("\n");
|
||||||
WRITE_UPDATE_LOG("##### Settings taken. #####\n");
|
WRITE_UPDATE_LOG("##### Settings taken. #####\n");
|
||||||
CFlashExpert::getInstance()->writemtd(filename, mtdNumber);
|
if (mode == MODE_EXPERT)
|
||||||
|
CFlashExpert::getInstance()->writemtd(filename, mtdNumber);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -166,7 +174,7 @@ bool CExtUpdate::isMtdramLoad()
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CExtUpdate::writemtdExt()
|
bool CExtUpdate::applySettings()
|
||||||
{
|
{
|
||||||
if(!hintBox)
|
if(!hintBox)
|
||||||
hintBox = new CHintBox(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_FLASHUPDATE_UPDATE_WITH_SETTINGS_PROCESSED));
|
hintBox = new CHintBox(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_FLASHUPDATE_UPDATE_WITH_SETTINGS_PROCESSED));
|
||||||
|
@@ -55,7 +55,7 @@ class CExtUpdate
|
|||||||
std::string mountPkt;
|
std::string mountPkt;
|
||||||
CFileHelpers* FileHelpers;
|
CFileHelpers* FileHelpers;
|
||||||
|
|
||||||
bool writemtdExt(void);
|
bool applySettings(void);
|
||||||
bool readBackupList(const std::string & dstPath);
|
bool readBackupList(const std::string & dstPath);
|
||||||
bool copyFileList(const std::string & fileList, const std::string & dstPath);
|
bool copyFileList(const std::string & fileList, const std::string & dstPath);
|
||||||
bool readConfig(const std::string & Config);
|
bool readConfig(const std::string & Config);
|
||||||
@@ -69,11 +69,16 @@ class CExtUpdate
|
|||||||
void updateLog(const char *buf);
|
void updateLog(const char *buf);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
MODE_EXPERT = 0,
|
||||||
|
MODE_SOFTUPDATE = 1
|
||||||
|
};
|
||||||
CExtUpdate();
|
CExtUpdate();
|
||||||
~CExtUpdate();
|
~CExtUpdate();
|
||||||
static CExtUpdate* getInstance();
|
static CExtUpdate* getInstance();
|
||||||
|
|
||||||
bool writemtdExt(const std::string & filename);
|
bool applySettings(const std::string & filename, int mode);
|
||||||
bool ErrorReset(bool modus, const std::string & msg1="", const std::string & msg2="");
|
bool ErrorReset(bool modus, const std::string & msg1="", const std::string & msg2="");
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@@ -451,16 +451,20 @@ int CFlashUpdate::exec(CMenuTarget* parent, const std::string &)
|
|||||||
CNeutrinoApp::getInstance()->exec(NULL, "savesettings");
|
CNeutrinoApp::getInstance()->exec(NULL, "savesettings");
|
||||||
sleep(2);
|
sleep(2);
|
||||||
//flash it...
|
//flash it...
|
||||||
#ifdef DEBUG1
|
|
||||||
if(1)
|
if (ShowMsgUTF(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_FLASHUPDATE_APPLY_SETTINGS), CMessageBox::mbrYes, CMessageBox::mbYes | CMessageBox::mbNo, NEUTRINO_ICON_UPDATE) == CMessageBox::mbrYes)
|
||||||
#else
|
if (!CExtUpdate::getInstance()->applySettings(filename, CExtUpdate::MODE_SOFTUPDATE))
|
||||||
if(!ft.program(filename, 80, 100))
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
hide();
|
|
||||||
ShowHintUTF(LOCALE_MESSAGEBOX_ERROR, ft.getErrorMessage().c_str()); // UTF-8
|
|
||||||
return menu_return::RETURN_REPAINT;
|
return menu_return::RETURN_REPAINT;
|
||||||
}
|
|
||||||
|
#ifdef DEBUG1
|
||||||
|
if(1) {
|
||||||
|
#else
|
||||||
|
if(!ft.program(filename, 80, 100)) {
|
||||||
|
#endif
|
||||||
|
hide();
|
||||||
|
ShowHintUTF(LOCALE_MESSAGEBOX_ERROR, ft.getErrorMessage().c_str()); // UTF-8
|
||||||
|
return menu_return::RETURN_REPAINT;
|
||||||
|
}
|
||||||
|
|
||||||
//status anzeigen
|
//status anzeigen
|
||||||
showGlobalStatus(100);
|
showGlobalStatus(100);
|
||||||
@@ -690,7 +694,7 @@ int CFlashExpert::exec(CMenuTarget* parent, const std::string & actionKey)
|
|||||||
showFileSelector("");
|
showFileSelector("");
|
||||||
} else {
|
} else {
|
||||||
if(selectedMTD == 10) {
|
if(selectedMTD == 10) {
|
||||||
CExtUpdate::getInstance()->writemtdExt(actionKey);
|
CExtUpdate::getInstance()->applySettings(actionKey, CExtUpdate::MODE_EXPERT);
|
||||||
}
|
}
|
||||||
else if(selectedMTD==-1) {
|
else if(selectedMTD==-1) {
|
||||||
writemtd(actionKey, MTD_OF_WHOLE_IMAGE);
|
writemtd(actionKey, MTD_OF_WHOLE_IMAGE);
|
||||||
|
@@ -463,6 +463,7 @@ typedef enum
|
|||||||
LOCALE_FILESYSTEM_IS_UTF8_OPTION_ISO8859_1,
|
LOCALE_FILESYSTEM_IS_UTF8_OPTION_ISO8859_1,
|
||||||
LOCALE_FILESYSTEM_IS_UTF8_OPTION_UTF8,
|
LOCALE_FILESYSTEM_IS_UTF8_OPTION_UTF8,
|
||||||
LOCALE_FLASHUPDATE_ACTIONREADFLASH,
|
LOCALE_FLASHUPDATE_ACTIONREADFLASH,
|
||||||
|
LOCALE_FLASHUPDATE_APPLY_SETTINGS,
|
||||||
LOCALE_FLASHUPDATE_CANTOPENFILE,
|
LOCALE_FLASHUPDATE_CANTOPENFILE,
|
||||||
LOCALE_FLASHUPDATE_CANTOPENMTD,
|
LOCALE_FLASHUPDATE_CANTOPENMTD,
|
||||||
LOCALE_FLASHUPDATE_CHECKUPDATE_INTERNET,
|
LOCALE_FLASHUPDATE_CHECKUPDATE_INTERNET,
|
||||||
|
@@ -463,6 +463,7 @@ const char * locale_real_names[] =
|
|||||||
"filesystem.is.utf8.option.iso8859.1",
|
"filesystem.is.utf8.option.iso8859.1",
|
||||||
"filesystem.is.utf8.option.utf8",
|
"filesystem.is.utf8.option.utf8",
|
||||||
"flashupdate.actionreadflash",
|
"flashupdate.actionreadflash",
|
||||||
|
"flashupdate.apply_settings",
|
||||||
"flashupdate.cantopenfile",
|
"flashupdate.cantopenfile",
|
||||||
"flashupdate.cantopenmtd",
|
"flashupdate.cantopenmtd",
|
||||||
"flashupdate.checkupdate_internet",
|
"flashupdate.checkupdate_internet",
|
||||||
|
Reference in New Issue
Block a user