diff --git a/data/neutrino-scripts/flash.start b/data/neutrino-scripts/flash.start index 15d666d6a..253e06d70 100755 --- a/data/neutrino-scripts/flash.start +++ b/data/neutrino-scripts/flash.start @@ -15,14 +15,3 @@ if [ -e /var/etc/.djmount ]; then echo "Kill djmount" fusermount -u /media/00upnp fi - -## remount rootfs readonly ################# -mount -no remount,ro / -RET=$? -echo -n "remount rootfs readonly " -if [ "$RET" = "0" ]; then - echo "successful." -else - echo "failed." -fi -############################################ diff --git a/src/gui/update.cpp b/src/gui/update.cpp index 165cc9ba3..692a21111 100644 --- a/src/gui/update.cpp +++ b/src/gui/update.cpp @@ -47,7 +47,6 @@ #include #include -#include #include #include @@ -483,16 +482,9 @@ int CFlashUpdate::exec(CMenuTarget* parent, const std::string &actionKey) //status anzeigen showGlobalStatus(100); showStatusMessageUTF(g_Locale->getText(LOCALE_FLASHUPDATE_READY)); // UTF-8 - 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 sleep(2); - //my_system("/etc/init.d/rcK"); ft.reboot(); } else if(fileType == 'T') // display file contents diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 8d01f4e0b..2aea90f2f 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -3579,6 +3579,7 @@ void stop_daemons(bool stopall, bool for_flash) CVFD::getInstance()->Clear(); CVFD::getInstance()->setMode(CVFD::MODE_TVRADIO); CVFD::getInstance()->ShowText("Stop daemons..."); + my_system(NEUTRINO_ENTER_FLASH_SCRIPT); } dvbsub_close(); @@ -3596,7 +3597,7 @@ void stop_daemons(bool stopall, bool for_flash) } printf("httpd shutdown done\n"); CStreamManager::getInstance()->Stop(); - if(stopall && !for_flash) { + if(stopall || for_flash) { printf("timerd shutdown\n"); if (g_Timerd) g_Timerd->shutdown(); @@ -3641,7 +3642,8 @@ void stop_daemons(bool stopall, bool for_flash) if (for_flash) { delete CRecordManager::getInstance(); 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); } } diff --git a/src/system/flashtool.cpp b/src/system/flashtool.cpp index 2b5c9d136..2d380bdf0 100644 --- a/src/system/flashtool.cpp +++ b/src/system/flashtool.cpp @@ -25,11 +25,14 @@ #include #include +#include +#include #include #include #include #include +#include #include #include #include @@ -165,7 +168,32 @@ bool CFlashTool::program( const std::string & filename, int globalProgressEndEra 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); return false; } @@ -211,7 +239,7 @@ bool CFlashTool::program( const std::string & filename, int globalProgressEndEra unsigned char buf[meminfo.writesize]; unsigned mtdoffset = 0; 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) { unsigned block = meminfo.writesize; if (block > fsize) @@ -219,7 +247,7 @@ bool CFlashTool::program( const std::string & filename, int globalProgressEndEra unsigned res = read(fd1, buf, 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 (block < (unsigned) meminfo.writesize) {