mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-27 15:32:52 +02:00
update: allow online-update for AX/Mutant; add some beautiful ifdef's
Signed-off-by: Thilo Graf <dbt@novatux.de>
#ifdefs not really beautiful but sometimes inevitable
Origin commit data
------------------
Branch: ni/coolstream
Commit: ba126c3a2c
Author: vanhofen <vanhofen@gmx.de>
Date: 2017-10-23 (Mon, 23 Oct 2017)
Origin message was:
------------------
- update: allow online-update for AX/Mutant; add some beautiful ifdef's
Signed-off-by: Thilo Graf <dbt@novatux.de>
#ifdefs not really beautiful but sometimes inevitable
------------------
This commit was generated by Migit
This commit is contained in:
@@ -328,6 +328,13 @@ bool CFlashUpdate::selectHttpImage(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#if HAVE_ARM_HARDWARE
|
||||||
|
if ((fileType <= '2') && (filename.substr(filename.find_last_of(".") + 1) == "tgz"))
|
||||||
|
{
|
||||||
|
// manipulate fileType for tgz-packages
|
||||||
|
fileType = 'Z';
|
||||||
|
}
|
||||||
|
#endif
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("[update] filename %s type %c newVersion %s md5 %s\n", filename.c_str(), fileType, newVersion.c_str(), file_md5.c_str());
|
printf("[update] filename %s type %c newVersion %s md5 %s\n", filename.c_str(), fileType, newVersion.c_str(), file_md5.c_str());
|
||||||
#endif
|
#endif
|
||||||
@@ -411,10 +418,14 @@ bool CFlashUpdate::checkVersion4Update()
|
|||||||
if (allow_flash)
|
if (allow_flash)
|
||||||
UpdatesFilter.addFilter(FILEBROWSER_UPDATE_FILTER);
|
UpdatesFilter.addFilter(FILEBROWSER_UPDATE_FILTER);
|
||||||
|
|
||||||
std::string filters[] = {"bin", "txt", "opk", "ipk", "tgz"};
|
std::string filters[] = {"bin", "txt", "opk", "ipk"};
|
||||||
for(size_t i=0; i<sizeof(filters)/sizeof(filters[0]) ;i++)
|
for(size_t i=0; i<sizeof(filters)/sizeof(filters[0]) ;i++)
|
||||||
UpdatesFilter.addFilter(filters[i]);
|
UpdatesFilter.addFilter(filters[i]);
|
||||||
|
|
||||||
|
#if HAVE_ARM_HARDWARE
|
||||||
|
UpdatesFilter.addFilter("tgz");
|
||||||
|
#endif
|
||||||
|
|
||||||
UpdatesBrowser.Filter = &UpdatesFilter;
|
UpdatesBrowser.Filter = &UpdatesFilter;
|
||||||
|
|
||||||
CFile * file_selected = NULL;
|
CFile * file_selected = NULL;
|
||||||
@@ -456,13 +467,14 @@ bool CFlashUpdate::checkVersion4Update()
|
|||||||
//!always leave here!
|
//!always leave here!
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
#if HAVE_ARM_HARDWARE
|
||||||
//tgz package install:
|
//tgz package install:
|
||||||
else if (file_selected->getType() == CFile::FILE_TGZ_PACKAGE){
|
else if (file_selected->getType() == CFile::FILE_TGZ_PACKAGE){
|
||||||
fileType = 'Z';
|
fileType = 'Z';
|
||||||
printf("[update] auto file type: %d (%d) %c\n", file_selected->getType(), CFile::FILE_TGZ_PACKAGE, fileType);
|
|
||||||
//!always leave here!
|
//!always leave here!
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
//set internal filetype
|
//set internal filetype
|
||||||
char const * ptr = rindex(filename.c_str(), '.');
|
char const * ptr = rindex(filename.c_str(), '.');
|
||||||
if(ptr) {
|
if(ptr) {
|
||||||
@@ -604,6 +616,7 @@ int CFlashUpdate::exec(CMenuTarget* parent, const std::string &actionKey)
|
|||||||
free(buffer);
|
free(buffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#if HAVE_ARM_HARDWARE
|
||||||
else if (fileType == 'Z')
|
else if (fileType == 'Z')
|
||||||
{
|
{
|
||||||
showGlobalStatus(100);
|
showGlobalStatus(100);
|
||||||
@@ -616,6 +629,7 @@ int CFlashUpdate::exec(CMenuTarget* parent, const std::string &actionKey)
|
|||||||
my_system(3, ofgwrite_tgz, g_settings.update_dir.c_str(), filename.c_str());
|
my_system(3, ofgwrite_tgz, g_settings.update_dir.c_str(), filename.c_str());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
else // not image, install
|
else // not image, install
|
||||||
{
|
{
|
||||||
const char install_sh[] = "/bin/install.sh";
|
const char install_sh[] = "/bin/install.sh";
|
||||||
|
Reference in New Issue
Block a user