From f9349898cb7e4eeba6404d8bf10c8c136c7a665f Mon Sep 17 00:00:00 2001 From: vanhofen Date: Sat, 21 Oct 2017 16:29:48 +0200 Subject: [PATCH] update: allow tgz-tarballs for update via ofgwrite Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/9088a9431d5489f3aab8cc0d356d1fd790f64d88 Author: vanhofen Date: 2017-10-21 (Sat, 21 Oct 2017) Origin message was: ------------------ - update: allow tgz-tarballs for update via ofgwrite --- src/driver/file.cpp | 1 + src/driver/file.h | 1 + src/gui/update.cpp | 21 ++++++++++++++++++++- 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/driver/file.cpp b/src/driver/file.cpp index 7e02bdf10..3886ca194 100644 --- a/src/driver/file.cpp +++ b/src/driver/file.cpp @@ -78,6 +78,7 @@ static const file_ext_s file_ext[] = { "pls", CFile::FILE_PLAYLIST }, { "png", CFile::FILE_PICTURE }, { "sh", CFile::FILE_TEXT }, + { "tgz", CFile::FILE_TGZ_PACKAGE }, { "ts", CFile::FILE_TS }, { "txt", CFile::FILE_TEXT }, { "url", CFile::STREAM_AUDIO }, diff --git a/src/driver/file.h b/src/driver/file.h index 0f1e3e473..2a8fcf487 100644 --- a/src/driver/file.h +++ b/src/driver/file.h @@ -73,6 +73,7 @@ class CFile FILE_PKG_PACKAGE, FILE_PLAYLIST, FILE_TEXT, + FILE_TGZ_PACKAGE, FILE_TS, FILE_VOB, FILE_WAV, diff --git a/src/gui/update.cpp b/src/gui/update.cpp index 2120bf6d1..ed8139330 100644 --- a/src/gui/update.cpp +++ b/src/gui/update.cpp @@ -452,7 +452,7 @@ bool CFlashUpdate::checkVersion4Update() #endif } - std::string filters[] = {"bin", "txt", "opk", "ipk"}; + std::string filters[] = {"bin", "txt", "opk", "ipk", "tgz"}; for(size_t i=0; igetType() == 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) { @@ -638,6 +645,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";