- update: allow to flash zipped archives

Conflicts:
	src/gui/update.cpp

Signed-off-by: Thilo Graf <dbt@novatux.de>
This commit is contained in:
svenhoefer
2019-05-28 20:56:00 +02:00
committed by Thilo Graf
parent c65cacaa2e
commit 6f8e829b97
3 changed files with 14 additions and 7 deletions

View File

@@ -84,7 +84,8 @@ static const file_ext_s file_ext[] =
{ "url", CFile::STREAM_AUDIO },
{ "vob", CFile::FILE_VOB },
{ "wav", CFile::FILE_WAV },
{ "xml", CFile::FILE_XML }
{ "xml", CFile::FILE_XML },
{ "zip", CFile::FILE_ZIP_PACKAGE }
};
int mycasecmp(const void * a, const void * b)

View File

@@ -78,6 +78,7 @@ class CFile
FILE_VOB,
FILE_WAV,
FILE_XML,
FILE_ZIP_PACKAGE,
STREAM_AUDIO,
STREAM_PICTURE
};

View File

@@ -360,9 +360,9 @@ bool CFlashUpdate::selectHttpImage(void)
#endif
#if HAVE_ARM_HARDWARE || HAVE_MIPS_HARDWARE
if (gotImage && (filename.substr(filename.find_last_of(".") + 1) == "tgz"))
if (gotImage && (filename.substr(filename.find_last_of(".") + 1) == "tgz" || filename.substr(filename.find_last_of(".") + 1) == "zip"))
{
// manipulate fileType for tgz-packages
// manipulate fileType for tgz- or zip-packages
fileType = 'Z';
}
#endif
@@ -441,7 +441,12 @@ bool CFlashUpdate::checkVersion4Update()
CFileFilter UpdatesFilter;
if (allow_flash)
{
UpdatesFilter.addFilter(FILEBROWSER_UPDATE_FILTER);
#if HAVE_ARM_HARDWARE || HAVE_MIPS_HARDWARE
UpdatesFilter.addFilter("zip");
#endif
}
std::string filters[] = {"bin", "txt", "opk", "ipk"};
for(size_t i=0; i<sizeof(filters)/sizeof(filters[0]) ;i++)
@@ -735,18 +740,18 @@ int CFlashUpdate::exec(CMenuTarget* parent, const std::string &actionKey)
ShowHint(LOCALE_MESSAGEBOX_INFO, LOCALE_FLASHUPDATE_START_OFGWRITE);
hide();
const char ofgwrite_tgz[] = "/bin/ofgwrite_tgz";
dprintf(DEBUG_NORMAL, "[update] calling %s %s %s %s\n", ofgwrite_tgz, g_settings.update_dir.c_str(), filename.c_str(), ofgwrite_options.c_str());
const char ofgwrite_caller[] = "/usr/bin/ofgwrite_caller";
dprintf(DEBUG_NORMAL, "[update] calling %s %s %s %s\n", ofgwrite_caller, g_settings.update_dir.c_str(), filename.c_str(), ofgwrite_options.c_str());
#ifndef DRYRUN
if (flashing)
my_system(4, ofgwrite_tgz, g_settings.update_dir.c_str(), filename.c_str(), ofgwrite_options.c_str());
my_system(4, ofgwrite_caller, g_settings.update_dir.c_str(), filename.c_str(), ofgwrite_options.c_str());
/*
TODO: fix osd-flickering
Neutrino is clearing framebuffer, so ofgwrite's gui is cleared too.
*/
dprintf(DEBUG_NORMAL, "[update] %s done\n", ofgwrite_tgz);
dprintf(DEBUG_NORMAL, "[update] %s done\n", ofgwrite_caller);
if (restart == CMsgBox::mbrYes)
CNeutrinoApp::getInstance()->exec(NULL, "reboot");