mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-27 15:32:59 +02:00
Software update: Copy flashimage to /tmp if it is not present in this directory
- unmount mounted network folders before flashing - kill timerd before flashing
This commit is contained in:
@@ -15,14 +15,3 @@ if [ -e /var/etc/.djmount ]; then
|
|||||||
echo "Kill djmount"
|
echo "Kill djmount"
|
||||||
fusermount -u /media/00upnp
|
fusermount -u /media/00upnp
|
||||||
fi
|
fi
|
||||||
|
|
||||||
## remount rootfs readonly #################
|
|
||||||
mount -no remount,ro /
|
|
||||||
RET=$?
|
|
||||||
echo -n "remount rootfs readonly "
|
|
||||||
if [ "$RET" = "0" ]; then
|
|
||||||
echo "successful."
|
|
||||||
else
|
|
||||||
echo "failed."
|
|
||||||
fi
|
|
||||||
############################################
|
|
||||||
|
@@ -47,7 +47,6 @@
|
|||||||
|
|
||||||
#include <gui/color.h>
|
#include <gui/color.h>
|
||||||
#include <gui/filebrowser.h>
|
#include <gui/filebrowser.h>
|
||||||
#include <system/fsmounter.h>
|
|
||||||
|
|
||||||
#include <gui/widget/messagebox.h>
|
#include <gui/widget/messagebox.h>
|
||||||
#include <gui/widget/hintbox.h>
|
#include <gui/widget/hintbox.h>
|
||||||
@@ -483,16 +482,9 @@ int CFlashUpdate::exec(CMenuTarget* parent, const std::string &actionKey)
|
|||||||
//status anzeigen
|
//status anzeigen
|
||||||
showGlobalStatus(100);
|
showGlobalStatus(100);
|
||||||
showStatusMessageUTF(g_Locale->getText(LOCALE_FLASHUPDATE_READY)); // UTF-8
|
showStatusMessageUTF(g_Locale->getText(LOCALE_FLASHUPDATE_READY)); // UTF-8
|
||||||
|
|
||||||
hide();
|
hide();
|
||||||
|
|
||||||
// Unmount all NFS & CIFS volumes
|
|
||||||
nfs_mounted_once = false; /* needed by update.cpp to prevent removal of modules after flashing a new cramfs, since rmmod (busybox) might no longer be available */
|
|
||||||
CFSMounter::umount();
|
|
||||||
|
|
||||||
ShowHintUTF(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_FLASHUPDATE_FLASHREADYREBOOT)); // UTF-8
|
ShowHintUTF(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_FLASHUPDATE_FLASHREADYREBOOT)); // UTF-8
|
||||||
sleep(2);
|
sleep(2);
|
||||||
//my_system("/etc/init.d/rcK");
|
|
||||||
ft.reboot();
|
ft.reboot();
|
||||||
}
|
}
|
||||||
else if(fileType == 'T') // display file contents
|
else if(fileType == 'T') // display file contents
|
||||||
|
@@ -3579,6 +3579,7 @@ void stop_daemons(bool stopall, bool for_flash)
|
|||||||
CVFD::getInstance()->Clear();
|
CVFD::getInstance()->Clear();
|
||||||
CVFD::getInstance()->setMode(CVFD::MODE_TVRADIO);
|
CVFD::getInstance()->setMode(CVFD::MODE_TVRADIO);
|
||||||
CVFD::getInstance()->ShowText("Stop daemons...");
|
CVFD::getInstance()->ShowText("Stop daemons...");
|
||||||
|
my_system(NEUTRINO_ENTER_FLASH_SCRIPT);
|
||||||
}
|
}
|
||||||
|
|
||||||
dvbsub_close();
|
dvbsub_close();
|
||||||
@@ -3596,7 +3597,7 @@ void stop_daemons(bool stopall, bool for_flash)
|
|||||||
}
|
}
|
||||||
printf("httpd shutdown done\n");
|
printf("httpd shutdown done\n");
|
||||||
CStreamManager::getInstance()->Stop();
|
CStreamManager::getInstance()->Stop();
|
||||||
if(stopall && !for_flash) {
|
if(stopall || for_flash) {
|
||||||
printf("timerd shutdown\n");
|
printf("timerd shutdown\n");
|
||||||
if (g_Timerd)
|
if (g_Timerd)
|
||||||
g_Timerd->shutdown();
|
g_Timerd->shutdown();
|
||||||
@@ -3641,7 +3642,8 @@ void stop_daemons(bool stopall, bool for_flash)
|
|||||||
if (for_flash) {
|
if (for_flash) {
|
||||||
delete CRecordManager::getInstance();
|
delete CRecordManager::getInstance();
|
||||||
delete videoDemux;
|
delete videoDemux;
|
||||||
my_system(NEUTRINO_ENTER_FLASH_SCRIPT);
|
int ret = my_system(4, "mount", "-no", "remount,ro", "/");
|
||||||
|
printf("remount rootfs readonly %s.\n", (ret == 0)?"successful":"failed"); fflush(stdout);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -25,11 +25,14 @@
|
|||||||
|
|
||||||
#include <libmd5sum.h>
|
#include <libmd5sum.h>
|
||||||
#include <system/flashtool.h>
|
#include <system/flashtool.h>
|
||||||
|
#include <system/fsmounter.h>
|
||||||
|
#include <system/helpers.h>
|
||||||
#include <eitd/sectionsd.h>
|
#include <eitd/sectionsd.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <libgen.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <sys/mount.h>
|
#include <sys/mount.h>
|
||||||
@@ -165,7 +168,32 @@ bool CFlashTool::program( const std::string & filename, int globalProgressEndEra
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( (fd1 = open( filename.c_str(), O_RDONLY )) < 0 ) {
|
char buf1[1024];
|
||||||
|
memset(buf1, 0, sizeof(buf1));
|
||||||
|
strncpy(buf1, filename.c_str(), sizeof(buf1)-1);
|
||||||
|
char* dn = dirname(buf1);
|
||||||
|
std::string flashfile;
|
||||||
|
if (strcmp(dn, "/tmp") != 0) {
|
||||||
|
memset(buf1, 0, sizeof(buf1));
|
||||||
|
strncpy(buf1, filename.c_str(), sizeof(buf1)-1);
|
||||||
|
flashfile = (std::string)"/tmp/" + basename(buf1);
|
||||||
|
CFileHelpers fh;
|
||||||
|
printf("##### [CFlashTool::program] copy flashfile to %s\n", flashfile.c_str());
|
||||||
|
if(statusViewer)
|
||||||
|
statusViewer->showStatusMessageUTF("Copy Image");
|
||||||
|
fh.copyFile(filename.c_str(), flashfile.c_str(), 0644);
|
||||||
|
sync();
|
||||||
|
if(statusViewer)
|
||||||
|
statusViewer->showGlobalStatus(statusViewer->getGlobalStatus()+5);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
flashfile = filename;
|
||||||
|
|
||||||
|
// Unmount all NFS & CIFS volumes
|
||||||
|
nfs_mounted_once = false;
|
||||||
|
CFSMounter::umount();
|
||||||
|
|
||||||
|
if( (fd1 = open( flashfile.c_str(), O_RDONLY )) < 0 ) {
|
||||||
ErrorMessage = g_Locale->getText(LOCALE_FLASHUPDATE_CANTOPENFILE);
|
ErrorMessage = g_Locale->getText(LOCALE_FLASHUPDATE_CANTOPENFILE);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -211,7 +239,7 @@ bool CFlashTool::program( const std::string & filename, int globalProgressEndEra
|
|||||||
unsigned char buf[meminfo.writesize];
|
unsigned char buf[meminfo.writesize];
|
||||||
unsigned mtdoffset = 0;
|
unsigned mtdoffset = 0;
|
||||||
unsigned fsize = filesize;
|
unsigned fsize = filesize;
|
||||||
printf("CFlashTool::program: file %s write size %d, erase size %d\n", filename.c_str(), meminfo.writesize, meminfo.erasesize);
|
printf("CFlashTool::program: file %s write size %d, erase size %d\n", flashfile.c_str(), meminfo.writesize, meminfo.erasesize);
|
||||||
while(fsize > 0) {
|
while(fsize > 0) {
|
||||||
unsigned block = meminfo.writesize;
|
unsigned block = meminfo.writesize;
|
||||||
if (block > fsize)
|
if (block > fsize)
|
||||||
@@ -219,7 +247,7 @@ bool CFlashTool::program( const std::string & filename, int globalProgressEndEra
|
|||||||
|
|
||||||
unsigned res = read(fd1, buf, block);
|
unsigned res = read(fd1, buf, block);
|
||||||
if (res != block) {
|
if (res != block) {
|
||||||
printf("CFlashTool::program: read from %s failed: %d from %d\n", filename.c_str(), res, block);
|
printf("CFlashTool::program: read from %s failed: %d from %d\n", flashfile.c_str(), res, block);
|
||||||
}
|
}
|
||||||
if (isnand) {
|
if (isnand) {
|
||||||
if (block < (unsigned) meminfo.writesize) {
|
if (block < (unsigned) meminfo.writesize) {
|
||||||
|
Reference in New Issue
Block a user