mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-27 07:23:09 +02:00
* Software Update with apply the settings (Part14)
- Add warning/error if not enough space - THX Striper for translation into English of the locale
This commit is contained in:
@@ -487,9 +487,11 @@ flashupdate.squashfs.noversion Bei Updates werden Versionsüberprüfungen derzei
|
|||||||
flashupdate.titlereadflash Flash auslesen
|
flashupdate.titlereadflash Flash auslesen
|
||||||
flashupdate.titlewriteflash Flash schreiben
|
flashupdate.titlewriteflash Flash schreiben
|
||||||
flashupdate.update_with_settings_del_skipped Ordner [%s] kann nicht gelöscht werden. Eintrag wird übersprungen.
|
flashupdate.update_with_settings_del_skipped Ordner [%s] kann nicht gelöscht werden. Eintrag wird übersprungen.
|
||||||
|
flashupdate.update_with_settings_error Error Flashspeicher!\n \nIm neuen Image sind nur noch %ld KB (von %ld KB) frei,\ndas ist zu wenig, um einen sicheren Betrieb zu gewährleisten.\n \nDer Vorgang wird abgebrochen!
|
||||||
flashupdate.update_with_settings_processed Image wird bearbeitet...
|
flashupdate.update_with_settings_processed Image wird bearbeitet...
|
||||||
flashupdate.update_with_settings_skipped Ordner [%s] kann nicht gesichert werden. Eintrag wird übersprungen.
|
flashupdate.update_with_settings_skipped Ordner [%s] kann nicht gesichert werden. Eintrag wird übersprungen.
|
||||||
flashupdate.update_with_settings_successfully Settingsübernahme erfolgreich.\nDas Image kann jetzt geflasht werden.
|
flashupdate.update_with_settings_successfully Settingsübernahme erfolgreich.\nDas Image kann jetzt geflasht werden.
|
||||||
|
flashupdate.update_with_settings_warning Warnung Flashspeicher!\n \nIm neuen Image sind nur noch %ld KB (von %ld KB) frei,\ndas ist möglicherweise zu wenig, um einen sicheren Betrieb zu gewährleisten.\n \nSoll der Vorgang trotzdem fortgesetzt werden?
|
||||||
flashupdate.updatemode Updatemodus
|
flashupdate.updatemode Updatemodus
|
||||||
flashupdate.updatemode_internet Internet
|
flashupdate.updatemode_internet Internet
|
||||||
flashupdate.updatemode_manual von lokalem Update-Verzeichnis
|
flashupdate.updatemode_manual von lokalem Update-Verzeichnis
|
||||||
|
@@ -487,9 +487,11 @@ flashupdate.squashfs.noversion SquashFS version checks are currently only suppor
|
|||||||
flashupdate.titlereadflash Reading Flash
|
flashupdate.titlereadflash Reading Flash
|
||||||
flashupdate.titlewriteflash Writing Flash
|
flashupdate.titlewriteflash Writing Flash
|
||||||
flashupdate.update_with_settings_del_skipped Folder [%s] can not be deleted. Entry is skipped.
|
flashupdate.update_with_settings_del_skipped Folder [%s] can not be deleted. Entry is skipped.
|
||||||
|
flashupdate.update_with_settings_error Flash Error!\n \nNew Image only has %ld KB (out of %ld KB) left. Not\nenough space to complete this operation.\n \nCanceling operation!
|
||||||
flashupdate.update_with_settings_processed Image is being processed...
|
flashupdate.update_with_settings_processed Image is being processed...
|
||||||
flashupdate.update_with_settings_skipped Folder [%s] can not be saved. Entry is skipped.
|
flashupdate.update_with_settings_skipped Folder [%s] can not be saved. Entry is skipped.
|
||||||
flashupdate.update_with_settings_successfully Setting takeover successfully.\nThe image can now be flashed.
|
flashupdate.update_with_settings_successfully Setting takeover successfully.\nThe image can now be flashed.
|
||||||
|
flashupdate.update_with_settings_warning Flash Warning!\n \nNew Image only has %ld KB (out of %ld KB) left. Probably not\nenough space to complete this operation...\n \nDo you really want to proceed?
|
||||||
flashupdate.updatemode Updatemode
|
flashupdate.updatemode Updatemode
|
||||||
flashupdate.updatemode_internet internet
|
flashupdate.updatemode_internet internet
|
||||||
flashupdate.updatemode_manual from local update directory
|
flashupdate.updatemode_manual from local update directory
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
and some other guys
|
and some other guys
|
||||||
Homepage: http://dbox.cyberphoria.org/
|
Homepage: http://dbox.cyberphoria.org/
|
||||||
|
|
||||||
Copyright (C) 2012 M. Liebmann (micha-bbg)
|
Copyright (C) 2012-2013 M. Liebmann (micha-bbg)
|
||||||
|
|
||||||
License: GPL
|
License: GPL
|
||||||
|
|
||||||
@@ -73,6 +73,10 @@ CExtUpdate::CExtUpdate()
|
|||||||
fLogfile = "/tmp/update.log";
|
fLogfile = "/tmp/update.log";
|
||||||
mountPkt = "/tmp/image_mount";
|
mountPkt = "/tmp/image_mount";
|
||||||
FileHelpers = NULL;
|
FileHelpers = NULL;
|
||||||
|
flashErrorFlag = false;
|
||||||
|
total = bsize = used = 0;
|
||||||
|
free1 = free2 = free3 = 0;
|
||||||
|
|
||||||
copyList.clear();
|
copyList.clear();
|
||||||
blackList.clear();
|
blackList.clear();
|
||||||
deleteList.clear();
|
deleteList.clear();
|
||||||
@@ -147,7 +151,7 @@ bool CExtUpdate::applySettings(const std::string & filename, int mode)
|
|||||||
bool ret = applySettings();
|
bool ret = applySettings();
|
||||||
DBG_TIMER_STOP("Image editing")
|
DBG_TIMER_STOP("Image editing")
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
if (mtdRamError != "")
|
if ((mtdRamError != "") && (!flashErrorFlag))
|
||||||
DisplayErrorMessage(mtdRamError.c_str());
|
DisplayErrorMessage(mtdRamError.c_str());
|
||||||
|
|
||||||
// error, restore original file
|
// error, restore original file
|
||||||
@@ -309,8 +313,14 @@ bool CExtUpdate::applySettings()
|
|||||||
if (res)
|
if (res)
|
||||||
return ErrorReset(RESET_UNLOAD, "mount error");
|
return ErrorReset(RESET_UNLOAD, "mount error");
|
||||||
|
|
||||||
if (!readBackupList(mountPkt))
|
if (get_fs_usage(mountPkt.c_str(), total, used, &bsize))
|
||||||
|
free1 = (total * bsize) / 1024 - (used * bsize) / 1024;
|
||||||
|
|
||||||
|
if (!readBackupList(mountPkt)) {
|
||||||
|
if (flashErrorFlag)
|
||||||
|
return false;
|
||||||
return ErrorReset(0, "error readBackupList");
|
return ErrorReset(0, "error readBackupList");
|
||||||
|
}
|
||||||
|
|
||||||
res = umount(mountPkt.c_str());
|
res = umount(mountPkt.c_str());
|
||||||
if (res)
|
if (res)
|
||||||
@@ -606,6 +616,9 @@ bool CExtUpdate::readBackupList(const std::string & dstPath)
|
|||||||
}
|
}
|
||||||
sync();
|
sync();
|
||||||
|
|
||||||
|
if (get_fs_usage(mountPkt.c_str(), total, used, &bsize))
|
||||||
|
free2 = (total * bsize) / 1024 - (used * bsize) / 1024;
|
||||||
|
|
||||||
// read copyList
|
// read copyList
|
||||||
for(it = copyList.begin(); it != copyList.end(); ++it) {
|
for(it = copyList.begin(); it != copyList.end(); ++it) {
|
||||||
line = *it;
|
line = *it;
|
||||||
@@ -652,6 +665,29 @@ bool CExtUpdate::readBackupList(const std::string & dstPath)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
sync();
|
sync();
|
||||||
|
|
||||||
|
if (get_fs_usage(mountPkt.c_str(), total, used, &bsize)) {
|
||||||
|
long flashWarning = 1000; // 1MB
|
||||||
|
long flashError = 600; // 600KB
|
||||||
|
char buf1[1024];
|
||||||
|
total = (total * bsize) / 1024;
|
||||||
|
free3 = total - (used * bsize) / 1024;
|
||||||
|
printf("##### [%s] %ld KB free org, %ld KB free after delete, %ld KB free now\n", __FUNCTION__, free1, free2, free3);
|
||||||
|
memset(buf1, '\0', sizeof(buf1));
|
||||||
|
if (free3 <= flashError) {
|
||||||
|
snprintf(buf1, sizeof(buf1)-1, g_Locale->getText(LOCALE_FLASHUPDATE_UPDATE_WITH_SETTINGS_ERROR), free3, total);
|
||||||
|
ShowMsgUTF(LOCALE_MESSAGEBOX_ERROR, buf1, CMessageBox::mbrOk, CMessageBox::mbOk, NEUTRINO_ICON_ERROR);
|
||||||
|
flashErrorFlag = true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else if (free3 <= flashWarning) {
|
||||||
|
snprintf(buf1, sizeof(buf1)-1, g_Locale->getText(LOCALE_FLASHUPDATE_UPDATE_WITH_SETTINGS_WARNING), free3, total);
|
||||||
|
if (ShowMsgUTF(LOCALE_MESSAGEBOX_INFO, buf1, CMessageBox::mbrNo, CMessageBox::mbYes | CMessageBox::mbNo, NEUTRINO_ICON_INFO) != CMessageBox::mbrYes) {
|
||||||
|
flashErrorFlag = true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
and some other guys
|
and some other guys
|
||||||
Homepage: http://dbox.cyberphoria.org/
|
Homepage: http://dbox.cyberphoria.org/
|
||||||
|
|
||||||
Copyright (C) 2012 M. Liebmann (micha-bbg)
|
Copyright (C) 2012-2013 M. Liebmann (micha-bbg)
|
||||||
|
|
||||||
License: GPL
|
License: GPL
|
||||||
|
|
||||||
@@ -56,6 +56,10 @@ class CExtUpdate
|
|||||||
CFileHelpers* FileHelpers;
|
CFileHelpers* FileHelpers;
|
||||||
std::vector<std::string> copyList, blackList, deleteList;
|
std::vector<std::string> copyList, blackList, deleteList;
|
||||||
|
|
||||||
|
bool flashErrorFlag;
|
||||||
|
long total, bsize, used;
|
||||||
|
long free1, free2, free3;
|
||||||
|
|
||||||
bool applySettings(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);
|
||||||
|
@@ -514,9 +514,11 @@ typedef enum
|
|||||||
LOCALE_FLASHUPDATE_TITLEREADFLASH,
|
LOCALE_FLASHUPDATE_TITLEREADFLASH,
|
||||||
LOCALE_FLASHUPDATE_TITLEWRITEFLASH,
|
LOCALE_FLASHUPDATE_TITLEWRITEFLASH,
|
||||||
LOCALE_FLASHUPDATE_UPDATE_WITH_SETTINGS_DEL_SKIPPED,
|
LOCALE_FLASHUPDATE_UPDATE_WITH_SETTINGS_DEL_SKIPPED,
|
||||||
|
LOCALE_FLASHUPDATE_UPDATE_WITH_SETTINGS_ERROR,
|
||||||
LOCALE_FLASHUPDATE_UPDATE_WITH_SETTINGS_PROCESSED,
|
LOCALE_FLASHUPDATE_UPDATE_WITH_SETTINGS_PROCESSED,
|
||||||
LOCALE_FLASHUPDATE_UPDATE_WITH_SETTINGS_SKIPPED,
|
LOCALE_FLASHUPDATE_UPDATE_WITH_SETTINGS_SKIPPED,
|
||||||
LOCALE_FLASHUPDATE_UPDATE_WITH_SETTINGS_SUCCESSFULLY,
|
LOCALE_FLASHUPDATE_UPDATE_WITH_SETTINGS_SUCCESSFULLY,
|
||||||
|
LOCALE_FLASHUPDATE_UPDATE_WITH_SETTINGS_WARNING,
|
||||||
LOCALE_FLASHUPDATE_UPDATEMODE,
|
LOCALE_FLASHUPDATE_UPDATEMODE,
|
||||||
LOCALE_FLASHUPDATE_UPDATEMODE_INTERNET,
|
LOCALE_FLASHUPDATE_UPDATEMODE_INTERNET,
|
||||||
LOCALE_FLASHUPDATE_UPDATEMODE_MANUAL,
|
LOCALE_FLASHUPDATE_UPDATEMODE_MANUAL,
|
||||||
|
@@ -514,9 +514,11 @@ const char * locale_real_names[] =
|
|||||||
"flashupdate.titlereadflash",
|
"flashupdate.titlereadflash",
|
||||||
"flashupdate.titlewriteflash",
|
"flashupdate.titlewriteflash",
|
||||||
"flashupdate.update_with_settings_del_skipped",
|
"flashupdate.update_with_settings_del_skipped",
|
||||||
|
"flashupdate.update_with_settings_error",
|
||||||
"flashupdate.update_with_settings_processed",
|
"flashupdate.update_with_settings_processed",
|
||||||
"flashupdate.update_with_settings_skipped",
|
"flashupdate.update_with_settings_skipped",
|
||||||
"flashupdate.update_with_settings_successfully",
|
"flashupdate.update_with_settings_successfully",
|
||||||
|
"flashupdate.update_with_settings_warning",
|
||||||
"flashupdate.updatemode",
|
"flashupdate.updatemode",
|
||||||
"flashupdate.updatemode_internet",
|
"flashupdate.updatemode_internet",
|
||||||
"flashupdate.updatemode_manual",
|
"flashupdate.updatemode_manual",
|
||||||
|
Reference in New Issue
Block a user