- add --enable-pkg-management configure switch; default=no

Conflicts:
	src/gui/Makefile.am
	src/gui/update_settings.cpp
	src/neutrino.cpp

Signed-off-by: Thilo Graf <dbt@novatux.de>

Added vanhofens flash update check.
Reason: build was broken and makes maintenance easier.
This commit is contained in:
svenhoefer
2021-04-11 00:13:36 +02:00
committed by Thilo Graf
parent 64e74ea306
commit 03bc0b96a0
10 changed files with 210 additions and 18 deletions

View File

@@ -251,6 +251,11 @@ AC_ARG_ENABLE(extupdate,
AC_DEFINE(ENABLE_EXTUPDATE, 1, [enable extended update routine])) AC_DEFINE(ENABLE_EXTUPDATE, 1, [enable extended update routine]))
AM_CONDITIONAL(ENABLE_EXTUPDATE, test "$enable_extupdate" = "yes") AM_CONDITIONAL(ENABLE_EXTUPDATE, test "$enable_extupdate" = "yes")
AC_ARG_ENABLE(pkg-management,
AS_HELP_STRING([--enable-pkg-management], [enable package management @<:@default=no@:>@]),
AC_DEFINE(ENABLE_PKG_MANAGEMENT, 1, [enable package management]))
AM_CONDITIONAL(ENABLE_PKG_MANAGEMENT, test "$enable_pkg_management" = "yes")
AC_ARG_ENABLE(lua, AC_ARG_ENABLE(lua,
AS_HELP_STRING([--enable-lua], [enable Lua support @<:@default=yes@:>@]), AS_HELP_STRING([--enable-lua], [enable Lua support @<:@default=yes@:>@]),
[enable_lua="$enableval"], [enable_lua="$enableval"],

View File

@@ -74,7 +74,6 @@ libneutrino_gui_a_SOURCES = \
network_service.cpp \ network_service.cpp \
network_setup.cpp \ network_setup.cpp \
nfs.cpp \ nfs.cpp \
opkg_manager.cpp \
osd_helpers.cpp \ osd_helpers.cpp \
osd_progressbar_setup.cpp \ osd_progressbar_setup.cpp \
osd_setup.cpp \ osd_setup.cpp \
@@ -102,7 +101,7 @@ libneutrino_gui_a_SOURCES = \
themes.cpp \ themes.cpp \
timeosd.cpp \ timeosd.cpp \
update.cpp \ update.cpp \
update_check_packages.cpp \ update_check.cpp \
update_menue.cpp \ update_menue.cpp \
update_settings.cpp \ update_settings.cpp \
user_menue.cpp \ user_menue.cpp \
@@ -115,6 +114,12 @@ libneutrino_gui_a_SOURCES = \
xmltv_setup.cpp \ xmltv_setup.cpp \
zapit_setup.cpp zapit_setup.cpp
if ENABLE_PKG_MANAGEMENT
libneutrino_gui_a_SOURCES += \
opkg_manager.cpp \
update_check_packages.cpp
endif
if ENABLE_LCD4LINUX if ENABLE_LCD4LINUX
libneutrino_gui_a_SOURCES += \ libneutrino_gui_a_SOURCES += \
lcd4l_setup.cpp lcd4l_setup.cpp

View File

@@ -48,7 +48,9 @@
#include "scan_setup.h" #include "scan_setup.h"
#include "settings_manager.h" #include "settings_manager.h"
#include "videosettings.h" #include "videosettings.h"
#if ENABLE_PKG_MANAGEMENT
#include "opkg_manager.h" #include "opkg_manager.h"
#endif
#include <zapit/zapit.h> #include <zapit/zapit.h>
#include <system/helpers.h> #include <system/helpers.h>
@@ -135,6 +137,7 @@ int CStartUpWizard::exec(CMenuTarget* parent, const string & /*actionKey*/)
CNetworkSetup::getInstance()->setWizardMode(SNeutrinoSettings::WIZARD_OFF); CNetworkSetup::getInstance()->setWizardMode(SNeutrinoSettings::WIZARD_OFF);
} }
#if ENABLE_PKG_MANAGEMENT
//package update check //package update check
if(advanced && res != menu_return::RETURN_EXIT_ALL) if(advanced && res != menu_return::RETURN_EXIT_ALL)
{ {
@@ -149,6 +152,7 @@ int CStartUpWizard::exec(CMenuTarget* parent, const string & /*actionKey*/)
g_settings.softupdate_autocheck_packages = true; g_settings.softupdate_autocheck_packages = true;
} }
} }
#endif
bool init_settings = false; bool init_settings = false;
if (CFEManager::getInstance()->haveSat()) if (CFEManager::getInstance()->haveSat())

View File

@@ -49,7 +49,9 @@
#include <gui/color.h> #include <gui/color.h>
#include <gui/filebrowser.h> #include <gui/filebrowser.h>
#if ENABLE_PKG_MANAGEMENT
#include <gui/opkg_manager.h> #include <gui/opkg_manager.h>
#endif
#include <gui/widget/msgbox.h> #include <gui/widget/msgbox.h>
#include <gui/widget/hintbox.h> #include <gui/widget/hintbox.h>
@@ -495,6 +497,7 @@ bool CFlashUpdate::checkVersion4Update()
} }
hide(); hide();
#if ENABLE_PKG_MANAGEMENT
//package install: //package install:
if (file_selected->getType() == CFile::FILE_PKG_PACKAGE){ if (file_selected->getType() == CFile::FILE_PKG_PACKAGE){
COPKGManager opkg; COPKGManager opkg;
@@ -510,6 +513,7 @@ bool CFlashUpdate::checkVersion4Update()
//!always leave here! //!always leave here!
return false; return false;
} }
#endif
//set internal filetype //set internal filetype
char const * ptr = rindex(filename.c_str(), '.'); char const * ptr = rindex(filename.c_str(), '.');

115
src/gui/update_check.cpp Normal file
View File

@@ -0,0 +1,115 @@
/*
update-check
Copyright (C) 2017 'vanhofen'
Homepage: http://www.neutrino-images.de/
License: GPL
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <pthread.h>
#include <unistd.h>
#include <global.h>
#include <neutrino.h>
#include <system/set_threadname.h>
#include <gui/update.h>
#include "update_check.h"
#define C4U_SLEEP (6 * 60 * 60) // 6 hours
#define C4U_FLAGFILE FLAGDIR "/.update"
/* ----------------------------------------------------------------- */
CFlashUpdateCheck::CFlashUpdateCheck()
{
c4u_thread = 0;
}
CFlashUpdateCheck::~CFlashUpdateCheck()
{
stopThread();
}
CFlashUpdateCheck* CFlashUpdateCheck::getInstance()
{
static CFlashUpdateCheck * c4u = NULL;
if (!c4u)
c4u = new CFlashUpdateCheck();
return c4u;
}
void CFlashUpdateCheck::startThread()
{
if (!c4u_thread)
{
printf("[CFlashUpdateCheck]: starting thread\n");
pthread_create(&c4u_thread, NULL, c4u_proc, (void*) NULL);
pthread_detach(c4u_thread);
}
}
void CFlashUpdateCheck::stopThread()
{
if (c4u_thread)
{
printf("[CFlashUpdateCheck]: stopping thread\n");
pthread_cancel(c4u_thread);
}
c4u_thread = 0;
if (access(C4U_FLAGFILE, F_OK) == 0)
unlink(C4U_FLAGFILE);
}
void* CFlashUpdateCheck::c4u_proc(void*)
{
set_threadname("n:flashupdatecheck");
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, 0);
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, 0);
CFlashUpdate flashupdate;
//printf("[CFlashUpdateCheck] %s: starting loop\n", __FUNCTION__);
while(1)
{
//printf("[CFlashUpdateCheck]: check for updates\n");
if (flashupdate.checkOnlineVersion())
{
//printf("[CFlashUpdateCheck]: update available\n");
if (FILE *f = fopen(C4U_FLAGFILE, "w"))
fclose(f);
}
else
{
if (access(C4U_FLAGFILE, F_OK) == 0)
unlink(C4U_FLAGFILE);
}
sleep(C4U_SLEEP);
}
return 0;
}

44
src/gui/update_check.h Normal file
View File

@@ -0,0 +1,44 @@
/*
update-check
Copyright (C) 2017 'vanhofen'
Homepage: http://www.neutrino-images.de/
License: GPL
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __update_check__
#define __update_check__
class CFlashUpdateCheck
{
public:
CFlashUpdateCheck();
~CFlashUpdateCheck();
static CFlashUpdateCheck* getInstance();
void startThread();
void stopThread();
private:
pthread_t c4u_thread;
static void* c4u_proc(void *arg);
};
#endif // __update_check__

View File

@@ -41,7 +41,9 @@
#include "update_menue.h" #include "update_menue.h"
#include "update_settings.h" #include "update_settings.h"
#if ENABLE_PKG_MANAGEMENT
#include "gui/opkg_manager.h" #include "gui/opkg_manager.h"
#endif
#include <gui/widget/icons.h> #include <gui/widget/icons.h>
#include <driver/screen_max.h> #include <driver/screen_max.h>
#include <system/debug.h> #include <system/debug.h>
@@ -80,6 +82,7 @@ int CSoftwareUpdate::showSoftwareUpdate()
softUpdate.addIntroItems(LOCALE_SERVICEMENU_UPDATE); softUpdate.addIntroItems(LOCALE_SERVICEMENU_UPDATE);
unsigned int inetkey = CRCInput::RC_red; unsigned int inetkey = CRCInput::RC_red;
#if ENABLE_PKG_MANAGEMENT
if (COPKGManager::hasOpkgSupport()) { if (COPKGManager::hasOpkgSupport()) {
//firmware update via opkg //firmware update via opkg
mf = new CMenuDForwarder(LOCALE_OPKG_TITLE, true, NULL, new COPKGManager(), NULL, CRCInput::RC_red); mf = new CMenuDForwarder(LOCALE_OPKG_TITLE, true, NULL, new COPKGManager(), NULL, CRCInput::RC_red);
@@ -87,6 +90,7 @@ int CSoftwareUpdate::showSoftwareUpdate()
softUpdate.addItem(mf); softUpdate.addItem(mf);
inetkey = CRCInput::convertDigitToKey(1); inetkey = CRCInput::convertDigitToKey(1);
} }
#endif
bool allow_update = true;//!CRecordManager::getInstance()->RecordingStatus() || CRecordManager::getInstance()->TimeshiftOnly(); bool allow_update = true;//!CRecordManager::getInstance()->RecordingStatus() || CRecordManager::getInstance()->TimeshiftOnly();

View File

@@ -38,8 +38,11 @@
#include <mymenu.h> #include <mymenu.h>
#include <neutrino_menue.h> #include <neutrino_menue.h>
#include <gui/filebrowser.h> #include <gui/filebrowser.h>
#include <gui/update_check.h>
#if ENABLE_PKG_MANAGEMENT
#include <gui/opkg_manager.h> #include <gui/opkg_manager.h>
#include <gui/update_check_packages.h> #include <gui/update_check_packages.h>
#endif
#include <gui/update_ext.h> #include <gui/update_ext.h>
#include <gui/update_settings.h> #include <gui/update_settings.h>
#include <gui/widget/icons.h> #include <gui/widget/icons.h>
@@ -160,20 +163,18 @@ int CUpdateSettings::initMenu()
#endif #endif
CMenuOptionChooser *autocheck = NULL; CMenuOptionChooser *autocheck = NULL;
#if 0
autocheck = new CMenuOptionChooser(LOCALE_FLASHUPDATE_AUTOCHECK, &g_settings.softupdate_autocheck, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, this); autocheck = new CMenuOptionChooser(LOCALE_FLASHUPDATE_AUTOCHECK, &g_settings.softupdate_autocheck, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, this);
autocheck->setHint("", LOCALE_MENU_HINT_AUTO_UPDATE_CHECK); autocheck->setHint("", LOCALE_MENU_HINT_AUTO_UPDATE_CHECK);
#endif
#if ENABLE_PKG_MANAGEMENT
CMenuOptionChooser *package_autocheck = NULL; CMenuOptionChooser *package_autocheck = NULL;
if (COPKGManager::hasOpkgSupport()){ if (COPKGManager::hasOpkgSupport()){
package_autocheck = new CMenuOptionChooser(LOCALE_FLASHUPDATE_AUTOCHECK_PACKAGES, &g_settings.softupdate_autocheck_packages, AUTOUPDATE_CHECK_OPTIONS, auto_update_options_count, true, this); package_autocheck = new CMenuOptionChooser(LOCALE_FLASHUPDATE_AUTOCHECK_PACKAGES, &g_settings.softupdate_autocheck_packages, AUTOUPDATE_CHECK_OPTIONS, auto_update_options_count, true, this);
package_autocheck->setHint("", LOCALE_MENU_HINT_AUTO_UPDATE_CHECK); package_autocheck->setHint("", LOCALE_MENU_HINT_AUTO_UPDATE_CHECK);
} }
#endif
w_upsettings.addItem(fw_update_dir); w_upsettings.addItem(fw_update_dir);
if (fw_url) w_upsettings.addItem(fw_url);
w_upsettings.addItem(fw_url);
#if ENABLE_EXTUPDATE #if ENABLE_EXTUPDATE
w_upsettings.addItem(name_backup); w_upsettings.addItem(name_backup);
#ifndef BOXMODEL_CST_HD2 #ifndef BOXMODEL_CST_HD2
@@ -184,8 +185,10 @@ int CUpdateSettings::initMenu()
#endif #endif
if (autocheck) if (autocheck)
w_upsettings.addItem(autocheck); w_upsettings.addItem(autocheck);
#if ENABLE_PKG_MANAGEMENT
if (package_autocheck) if (package_autocheck)
w_upsettings.addItem(package_autocheck); w_upsettings.addItem(package_autocheck);
#endif
#if 0 #if 0
w_upsettings.addItem(apply_kernel); w_upsettings.addItem(apply_kernel);
#endif #endif
@@ -200,14 +203,14 @@ bool CUpdateSettings::changeNotify(const neutrino_locale_t OptionName, void * /*
{ {
if (ARE_LOCALES_EQUAL(OptionName, LOCALE_FLASHUPDATE_AUTOCHECK) || ARE_LOCALES_EQUAL(OptionName, LOCALE_FLASHUPDATE_AUTOCHECK_PACKAGES)) if (ARE_LOCALES_EQUAL(OptionName, LOCALE_FLASHUPDATE_AUTOCHECK) || ARE_LOCALES_EQUAL(OptionName, LOCALE_FLASHUPDATE_AUTOCHECK_PACKAGES))
{ {
#if 0 CFlashUpdateCheck::getInstance()->stopThread();
CUpdateCheck::getInstance()->stopTimer();
if (g_settings.softupdate_autocheck) if (g_settings.softupdate_autocheck)
CUpdateCheck::getInstance()->startThread(); CFlashUpdateCheck::getInstance()->startThread();
#endif #if ENABLE_PKG_MANAGEMENT
CUpdateCheckPackages::getInstance()->stopTimer(); CUpdateCheckPackages::getInstance()->stopThread();
if (g_settings.softupdate_autocheck_packages) if (g_settings.softupdate_autocheck_packages)
CUpdateCheckPackages::getInstance()->startThread(); CUpdateCheckPackages::getInstance()->startThread();
#endif
} }
return false; return false;

View File

@@ -97,8 +97,10 @@
#include "gui/start_wizard.h" #include "gui/start_wizard.h"
#include "gui/update_ext.h" #include "gui/update_ext.h"
#include "gui/update.h" #include "gui/update.h"
//#include "gui/update_check.h" #include "gui/update_check.h"
#if ENABLE_PKG_MANAGEMENT
#include "gui/update_check_packages.h" #include "gui/update_check_packages.h"
#endif
#include "gui/videosettings.h" #include "gui/videosettings.h"
#include "gui/audio_select.h" #include "gui/audio_select.h"
#include "gui/weather.h" #include "gui/weather.h"
@@ -398,7 +400,9 @@ int CNeutrinoApp::loadSetup(const char * fname)
g_settings.softupdate_autocheck = configfile.getBool("softupdate_autocheck" , false); g_settings.softupdate_autocheck = configfile.getBool("softupdate_autocheck" , false);
#if ENABLE_PKG_MANAGEMENT
g_settings.softupdate_autocheck_packages = configfile.getInt32("softupdate_autocheck_packages" , false); g_settings.softupdate_autocheck_packages = configfile.getInt32("softupdate_autocheck_packages" , false);
#endif
// video // video
int vid_Mode_default = VIDEO_STD_720P50; int vid_Mode_default = VIDEO_STD_720P50;
@@ -1879,7 +1883,9 @@ void CNeutrinoApp::saveSetup(const char * fname)
configfile.setInt32 ("softupdate_name_mode_apply", g_settings.softupdate_name_mode_apply); configfile.setInt32 ("softupdate_name_mode_apply", g_settings.softupdate_name_mode_apply);
configfile.setInt32 ("softupdate_name_mode_backup", g_settings.softupdate_name_mode_backup); configfile.setInt32 ("softupdate_name_mode_backup", g_settings.softupdate_name_mode_backup);
configfile.setBool("softupdate_autocheck", g_settings.softupdate_autocheck); configfile.setBool("softupdate_autocheck", g_settings.softupdate_autocheck);
#if ENABLE_PKG_MANAGEMENT
configfile.setInt32("softupdate_autocheck_packages", g_settings.softupdate_autocheck_packages); configfile.setInt32("softupdate_autocheck_packages", g_settings.softupdate_autocheck_packages);
#endif
configfile.setInt32("flashupdate_createimage_add_var", g_settings.flashupdate_createimage_add_var); configfile.setInt32("flashupdate_createimage_add_var", g_settings.flashupdate_createimage_add_var);
configfile.setInt32("flashupdate_createimage_add_root1", g_settings.flashupdate_createimage_add_root1); configfile.setInt32("flashupdate_createimage_add_root1", g_settings.flashupdate_createimage_add_root1);
@@ -3062,9 +3068,8 @@ TIMER_START();
#endif #endif
TIMER_STOP("################################## after all ##################################"); TIMER_STOP("################################## after all ##################################");
#if 0
if (g_settings.softupdate_autocheck) { if (g_settings.softupdate_autocheck) {
#if 0
hintBox = new CHintBox(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_FLASHUPDATE_CHECKUPDATE_INTERNET)); hintBox = new CHintBox(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_FLASHUPDATE_CHECKUPDATE_INTERNET));
hintBox->paint(); hintBox->paint();
CFlashUpdate flash; CFlashUpdate flash;
@@ -3075,12 +3080,13 @@ TIMER_STOP("################################## after all #######################
} }
hintBox->hide(); hintBox->hide();
delete hintBox; delete hintBox;
CUpdateCheck::getInstance()->startThread();
}
#endif #endif
CFlashUpdateCheck::getInstance()->startThread();
}
#if ENABLE_PKG_MANAGEMENT
if (g_settings.softupdate_autocheck_packages) if (g_settings.softupdate_autocheck_packages)
CUpdateCheckPackages::getInstance()->startThread(); CUpdateCheckPackages::getInstance()->startThread();
#endif
for (std::list<std::string>::iterator it = g_settings.xmltv_xml.begin(); it != g_settings.xmltv_xml.end(); it++) for (std::list<std::string>::iterator it = g_settings.xmltv_xml.begin(); it != g_settings.xmltv_xml.end(); it++)
g_Sectionsd->readSIfromXMLTV((*it).c_str()); g_Sectionsd->readSIfromXMLTV((*it).c_str());

View File

@@ -829,7 +829,9 @@ struct SNeutrinoSettings
std::string softupdate_proxyusername; std::string softupdate_proxyusername;
std::string softupdate_proxypassword; std::string softupdate_proxypassword;
int softupdate_autocheck; int softupdate_autocheck;
#if ENABLE_PKG_MANAGEMENT
int softupdate_autocheck_packages; int softupdate_autocheck_packages;
#endif
int softupdate_name_mode_apply; int softupdate_name_mode_apply;
int softupdate_name_mode_backup; int softupdate_name_mode_backup;
int apply_settings; int apply_settings;