mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-27 23:42:58 +02:00
Merge remote-tracking branch 'check/next-cc'
needs buildfixing... Conflicts: src/eitd/sectionsd.cpp src/gui/audioplayer.cpp src/gui/bedit/bouqueteditor_channels.cpp src/gui/infoclock.cpp src/gui/infoviewer.cpp src/gui/motorcontrol.cpp src/gui/osd_setup.cpp src/gui/scan.cpp src/gui/scan_setup.cpp src/gui/streaminfo2.cpp src/gui/update.cpp src/gui/widget/progresswindow.cpp src/gui/widget/textbox.cpp src/neutrino.cpp src/zapit/include/zapit/femanager.h
This commit is contained in:
@@ -55,6 +55,8 @@
|
||||
#include <system/httptool.h>
|
||||
#include <system/helpers.h>
|
||||
|
||||
#include <lib/libnet/libnet.h>
|
||||
|
||||
#define SQUASHFS
|
||||
|
||||
#include <curl/curl.h>
|
||||
@@ -260,6 +262,15 @@ bool CFlashUpdate::selectHttpImage(void)
|
||||
newVersion = versions[selected];
|
||||
file_md5 = md5s[selected];
|
||||
fileType = fileTypes[selected];
|
||||
#ifdef BOXMODEL_APOLLO
|
||||
if(fileType < '3') {
|
||||
int esize = CMTDInfo::getInstance()->getMTDEraseSize(sysfs);
|
||||
printf("[update] erase size is %x\n", esize);
|
||||
if (esize == 0x40000) {
|
||||
filename += ".256k";
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifdef DEBUG
|
||||
printf("[update] filename %s type %c newVersion %s md5 %s\n", filename.c_str(), fileType, newVersion.c_str(), file_md5.c_str());
|
||||
#endif
|
||||
@@ -464,6 +475,7 @@ int CFlashUpdate::exec(CMenuTarget* parent, const std::string &actionKey)
|
||||
if(fileType < '3') {
|
||||
//flash it...
|
||||
#if ENABLE_EXTUPDATE
|
||||
#ifndef BOXMODEL_APOLLO
|
||||
if (g_settings.apply_settings) {
|
||||
if (ShowMsgUTF(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_FLASHUPDATE_APPLY_SETTINGS), CMessageBox::mbrYes, CMessageBox::mbYes | CMessageBox::mbNo, NEUTRINO_ICON_UPDATE) == CMessageBox::mbrYes)
|
||||
if (!CExtUpdate::getInstance()->applySettings(filename, CExtUpdate::MODE_SOFTUPDATE)) {
|
||||
@@ -472,6 +484,7 @@ int CFlashUpdate::exec(CMenuTarget* parent, const std::string &actionKey)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG1
|
||||
if(1) {
|
||||
@@ -541,20 +554,61 @@ CFlashExpert* CFlashExpert::getInstance()
|
||||
return FlashExpert;
|
||||
}
|
||||
|
||||
bool CFlashExpert::checkSize(int mtd, std::string &backupFile)
|
||||
{
|
||||
char errMsg[1024] = {0};
|
||||
std::string path = getPathName(backupFile);
|
||||
if (!file_exists(path.c_str())) {
|
||||
snprintf(errMsg, sizeof(errMsg)-1, g_Locale->getText(LOCALE_FLASHUPDATE_READ_DIRECTORY_NOT_EXIST), path.c_str());
|
||||
ShowHintUTF(LOCALE_MESSAGEBOX_ERROR, errMsg);
|
||||
return false;
|
||||
}
|
||||
|
||||
int mtdSize = CMTDInfo::getInstance()->getMTDSize(mtd) / 1024;
|
||||
|
||||
long btotal = 0, bused = 0, bsize = 0;
|
||||
if (!get_fs_usage(path.c_str(), btotal, bused, &bsize)) {
|
||||
snprintf(errMsg, sizeof(errMsg)-1, g_Locale->getText(LOCALE_FLASHUPDATE_READ_VOLUME_ERROR), path.c_str());
|
||||
ShowHintUTF(LOCALE_MESSAGEBOX_ERROR, errMsg);
|
||||
return false;
|
||||
}
|
||||
int backupMaxSize = (int)((btotal - bused) * bsize);
|
||||
int res = 10; // Reserved 10% of available space
|
||||
backupMaxSize = (backupMaxSize - ((backupMaxSize * res) / 100)) / 1024;
|
||||
if (backupMaxSize < mtdSize) {
|
||||
snprintf(errMsg, sizeof(errMsg)-1, g_Locale->getText(LOCALE_FLASHUPDATE_READ_NO_AVAILABLE_SPACE), path.c_str(), backupMaxSize, mtdSize);
|
||||
ShowHintUTF(LOCALE_MESSAGEBOX_ERROR, errMsg);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CFlashExpert::readmtd(int preadmtd)
|
||||
{
|
||||
char tmpStr[256];
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
strftime(tmpStr, sizeof(tmpStr), "_%Y%m%d_%H%M.img", localtime(&tv.tv_sec));
|
||||
CMTDInfo* mtdInfo = CMTDInfo::getInstance();
|
||||
std::string filename = (std::string)g_settings.update_dir + "/" + mtdInfo->getMTDName(preadmtd);
|
||||
filename += tmpStr;
|
||||
std::string filename;
|
||||
CMTDInfo* mtdInfo = CMTDInfo::getInstance();
|
||||
std::string hostName = netGetHostname();
|
||||
std::string timeStr = getNowTimeStr("_%Y%m%d_%H%M");
|
||||
|
||||
if (g_settings.softupdate_name_mode_backup == CExtUpdate::SOFTUPDATE_NAME_HOSTNAME_TIME)
|
||||
filename = (std::string)g_settings.update_dir + "/" + mtdInfo->getMTDName(preadmtd) + timeStr + "_" + hostName + ".img";
|
||||
else
|
||||
filename = (std::string)g_settings.update_dir + "/" + mtdInfo->getMTDName(preadmtd) + timeStr + ".img";
|
||||
|
||||
if (preadmtd == -1) {
|
||||
filename = (std::string)g_settings.update_dir + "/flashimage.img"; // US-ASCII (subset of UTF-8 and ISO8859-1)
|
||||
preadmtd = MTD_OF_WHOLE_IMAGE;
|
||||
}
|
||||
|
||||
bool skipCheck = false;
|
||||
#ifndef BOXMODEL_APOLLO
|
||||
if ((std::string)g_settings.update_dir == "/tmp")
|
||||
skipCheck = true;
|
||||
#endif
|
||||
if ((!skipCheck) && (!checkSize(preadmtd, filename)))
|
||||
return;
|
||||
|
||||
setTitle(LOCALE_FLASHUPDATE_TITLEREADFLASH);
|
||||
paint();
|
||||
showGlobalStatus(0);
|
||||
@@ -643,8 +697,10 @@ void CFlashExpert::showMTDSelector(const std::string & actionkey)
|
||||
mtdselector->addItem(new CMenuForwarderNonLocalized(mtdInfo->getMTDName(lx).c_str(), enabled, NULL, this, sActionKey, CRCInput::convertDigitToKey(shortcut++)));
|
||||
}
|
||||
#if ENABLE_EXTUPDATE
|
||||
#ifndef BOXMODEL_APOLLO
|
||||
if (actionkey == "writemtd")
|
||||
mtdselector->addItem(new CMenuForwarderNonLocalized("systemFS with settings", true, NULL, this, "writemtd10", CRCInput::convertDigitToKey(shortcut++)));
|
||||
#endif
|
||||
#endif
|
||||
mtdselector->exec(NULL,"");
|
||||
delete mtdselector;
|
||||
@@ -713,7 +769,8 @@ int CFlashExpert::exec(CMenuTarget* parent, const std::string & actionKey)
|
||||
} else {
|
||||
#if ENABLE_EXTUPDATE
|
||||
if(selectedMTD == 10) {
|
||||
CExtUpdate::getInstance()->applySettings(actionKey, CExtUpdate::MODE_EXPERT);
|
||||
std::string aK = actionKey;
|
||||
CExtUpdate::getInstance()->applySettings(aK, CExtUpdate::MODE_EXPERT);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user