- update: allow tgz-tarballs for update via ofgwrite

Signed-off-by: Thilo Graf <dbt@novatux.de>
This commit is contained in:
svenhoefer
2017-10-21 16:29:48 +02:00
committed by Thilo Graf
parent 81670c3a6b
commit 7e974bc716
3 changed files with 22 additions and 1 deletions

View File

@@ -411,7 +411,7 @@ bool CFlashUpdate::checkVersion4Update()
if (allow_flash)
UpdatesFilter.addFilter(FILEBROWSER_UPDATE_FILTER);
std::string filters[] = {"bin", "txt", "opk", "ipk"};
std::string filters[] = {"bin", "txt", "opk", "ipk", "tgz"};
for(size_t i=0; i<sizeof(filters)/sizeof(filters[0]) ;i++)
UpdatesFilter.addFilter(filters[i]);
@@ -456,6 +456,13 @@ bool CFlashUpdate::checkVersion4Update()
//!always leave here!
return false;
}
//tgz package install:
else if (file_selected->getType() == CFile::FILE_TGZ_PACKAGE){
fileType = 'Z';
printf("[update] auto file type: %d (%d) %c\n", file_selected->getType(), CFile::FILE_TGZ_PACKAGE, fileType);
//!always leave here!
return true;
}
//set internal filetype
char const * ptr = rindex(filename.c_str(), '.');
if(ptr) {
@@ -597,6 +604,18 @@ int CFlashUpdate::exec(CMenuTarget* parent, const std::string &actionKey)
free(buffer);
}
}
else if (fileType == 'Z')
{
showGlobalStatus(100);
ShowHint(LOCALE_MESSAGEBOX_INFO, "Start ofgwrite");
hide();
const char ofgwrite_tgz[] = "/bin/ofgwrite_tgz";
printf("[update] calling %s %s %s\n", ofgwrite_tgz, g_settings.update_dir.c_str(), filename.c_str() );
#ifndef DRYRUN
my_system(3, ofgwrite_tgz, g_settings.update_dir.c_str(), filename.c_str());
#endif
}
else // not image, install
{
const char install_sh[] = "/bin/install.sh";