summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/settings/backup/backuprestore.cpp49
-rw-r--r--share/backup/device_table-minimal.txt20
2 files changed, 54 insertions, 15 deletions
diff --git a/noncore/settings/backup/backuprestore.cpp b/noncore/settings/backup/backuprestore.cpp
index 869c1b8..d028379 100644
--- a/noncore/settings/backup/backuprestore.cpp
+++ b/noncore/settings/backup/backuprestore.cpp
@@ -280,11 +280,18 @@ void BackupAndRestore::backup()
280 280
281void BackupAndRestore::backupRootFs() 281void BackupAndRestore::backupRootFs()
282{ 282{
283//#define MDEBUG 283 if ( ( ODevice::inst()->model() != Model_Zaurus_SL5000 ) && ( ODevice::inst()->model() != Model_Zaurus_SL5500 ) )
284#ifndef MDEBUG 284 {
285 QMessageBox::critical( this, "Opie-Backup", "<qt>This feature is not yet implemented.</qt>", "Bummer!" ); 285 QMessageBox::critical( this, "Not yet implemented!", "<qt>Sorry, support for this model is not yet done.</qt>", "Ok" );
286 return; 286 return;
287#endif 287 }
288
289 if ( !QFile::exists( "/usr/bin/mkfs.jffs2" ) && !QFile::exists( "/usr/sbin/mkfs.jffs2" ) )
290 {
291 QMessageBox::critical( this, "Can't find utility!", "<qt>Can't find mkfs.jffs2 - Install mtd-utils.</qt>", "Ok" );
292 return;
293 }
294
288 // call 'mount' and parse its output to gather the device on which the root partition is mounted 295 // call 'mount' and parse its output to gather the device on which the root partition is mounted
289 FILE* mountp = popen( "mount", "r" ); 296 FILE* mountp = popen( "mount", "r" );
290 QString device; 297 QString device;
@@ -300,19 +307,17 @@ void BackupAndRestore::backupRootFs()
300 mounto >> device >> on >> mountpoint >> type >> filesystem >> options; 307 mounto >> device >> on >> mountpoint >> type >> filesystem >> options;
301 if ( mountpoint == "/" ) break; 308 if ( mountpoint == "/" ) break;
302 } 309 }
303 odebug << device << " is formatted w/ " << filesystem << " and mounted on " << mountpoint << oendl; 310 odebug << device << " is formatted w/ '" << filesystem << "' and mounted on '" << mountpoint << "'" << oendl;
304 311
305 if ( !mountpoint.startsWith( "/dev/mtdblock" ) ) 312 if ( !device.startsWith( "/dev/mtdblock" ) )
306 { 313 {
307 QMessageBox::critical( this, "Can't backup!", QString( "<qt>unsupported rootfs %1 - needs to be /dev/mtdblockN</qt>").arg( device ), "Ok" ); 314 QMessageBox::critical( this, "Can't backup!", QString( "<qt>unsupported root device '%1' - needs to be /dev/mtdblockN</qt>").arg( device ), "Ok" );
308#ifndef MDEBUG
309 return; 315 return;
310#endif
311 } 316 }
312 } // at this point, the QTextStream has been destroy and we can close the FILE* 317 } // at this point, the QTextStream has been destroy and we can close the FILE*
313 pclose( mountp ); 318 pclose( mountp );
314 319
315#ifndef MDEBUG 320#if 1
316 int rootmtd = device.right( 1 ).toInt(); 321 int rootmtd = device.right( 1 ).toInt();
317#else 322#else
318 int rootmtd = 0; 323 int rootmtd = 0;
@@ -324,6 +329,7 @@ void BackupAndRestore::backupRootFs()
324 if ( !procmtdf.open( IO_ReadOnly ) ) 329 if ( !procmtdf.open( IO_ReadOnly ) )
325 { 330 {
326 QMessageBox::critical( this, "Can't backup!", "<qt>Can't open /proc/mtd</qt>", "Ok" ); 331 QMessageBox::critical( this, "Can't backup!", "<qt>Can't open /proc/mtd</qt>", "Ok" );
332 return;
327 } 333 }
328 334
329 QTextStream procmtd( &procmtdf ); 335 QTextStream procmtd( &procmtdf );
@@ -356,15 +362,28 @@ void BackupAndRestore::backupRootFs()
356 outputFile += "/initrd.bin-" + dateString; 362 outputFile += "/initrd.bin-" + dateString;
357 363
358 // call mkfs.jffs2 to create the backup 364 // call mkfs.jffs2 to create the backup
359 QString cmdline = QString( "mkfs.jffs2 --root=/ %1 --little-endian %2 %3 -n" ).arg( outputFile ).arg( pad ).arg( eraseblock ); 365 QString cmdline = QString( "mkfs.jffs2 --faketime --root=/ %1 --little-endian %2 %3 -n" ).arg( outputFile ).arg( pad ).arg( eraseblock );
366 cmdline.append( " --ignore=/tmp --ignore=/mnt --ignore=/var --ignore=/proc" );
360 owarn << "Calling '" << cmdline << "'" << oendl; 367 owarn << "Calling '" << cmdline << "'" << oendl;
361 368
362#ifndef MDEBUG 369 OWait *owait = new OWait();
363 ::system( cmdline ); 370 Global::statusMessage( tr( "Backing up..." ) );
364#endif 371 owait->show();
372 qApp->processEvents();
365 373
366 // FIXME: Add image postprocessing for C7x0 and C8x0, for Beagle, for SIMpad 374 int r = ::system( cmdline );
375
376 owait->hide();
377 delete owait;
367 378
379 if ( r != 0 )
380 {
381 perror("Error: ");
382 QString errorMsg = QString( tr( "<qt>%1</qt>" ).arg( strerror( errno ) ) );
383 QMessageBox::critical(this, tr( "Backup Failed!" ), errorMsg, QString( tr( "Ok" ) ) );
384 }
385
386 // FIXME: Add image postprocessing for C7x0 and C8x0, for Beagle, for SIMpad
368} 387}
369 388
370void BackupAndRestore::backupUserData() 389void BackupAndRestore::backupUserData()
diff --git a/share/backup/device_table-minimal.txt b/share/backup/device_table-minimal.txt
new file mode 100644
index 0000000..66cafae
--- a/dev/null
+++ b/share/backup/device_table-minimal.txt
@@ -0,0 +1,20 @@
1 /dev/initctl p 600 0 0 - - --
2 /dev/apm_bios c 660 0 46 10 134 - --
3 /dev/fb0 c 600 0 0 29 0 - --
4 /dev/hda b 660 0 6 3 0 - --
5 /dev/hda b 660 0 6 3 1 1 120
6 /dev/kmem c 640 0 15 1 2 - --
7 /dev/mem c 640 0 15 1 1 - --
8 /dev/null c 666 0 0 1 3 - --
9 /dev/ram b 640 0 0 1 0 0 14
10 /dev/tty c 662 0 5 5 0 - --
11 /dev/tty c 666 0 5 4 0 0 19
12 /dev/ttyS c 640 0 5 4 64 0 11
13 /dev/ttySA c 640 0 5 204 5 0 11
14 /dev/zero c 644 0 0 1 5 --
15 /dev/mtd c 660 0 6 90 0 0 28
16 /dev/mtdblock b 640 0 0 31 0 0 18
17 /dev/console c 662 0 5 5 1 --
18 /bin/tinylogin f 4755 0 0 - - --
19 /bin/mount f 4755 0 0 - - --
20 /bin/umount f 4755 0 0 - - --