summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/backup/backuprestore.cpp51
-rw-r--r--share/backup/device_table-minimal.txt20
2 files changed, 55 insertions, 16 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()
void BackupAndRestore::backupRootFs()
{
-//#define MDEBUG
-#ifndef MDEBUG
- QMessageBox::critical( this, "Opie-Backup", "<qt>This feature is not yet implemented.</qt>", "Bummer!" );
- return;
-#endif
+ if ( ( ODevice::inst()->model() != Model_Zaurus_SL5000 ) && ( ODevice::inst()->model() != Model_Zaurus_SL5500 ) )
+ {
+ QMessageBox::critical( this, "Not yet implemented!", "<qt>Sorry, support for this model is not yet done.</qt>", "Ok" );
+ return;
+ }
+
+ if ( !QFile::exists( "/usr/bin/mkfs.jffs2" ) && !QFile::exists( "/usr/sbin/mkfs.jffs2" ) )
+ {
+ QMessageBox::critical( this, "Can't find utility!", "<qt>Can't find mkfs.jffs2 - Install mtd-utils.</qt>", "Ok" );
+ return;
+ }
+
// call 'mount' and parse its output to gather the device on which the root partition is mounted
FILE* mountp = popen( "mount", "r" );
QString device;
@@ -300,19 +307,17 @@ void BackupAndRestore::backupRootFs()
mounto >> device >> on >> mountpoint >> type >> filesystem >> options;
if ( mountpoint == "/" ) break;
}
- odebug << device << " is formatted w/ " << filesystem << " and mounted on " << mountpoint << oendl;
+ odebug << device << " is formatted w/ '" << filesystem << "' and mounted on '" << mountpoint << "'" << oendl;
- if ( !mountpoint.startsWith( "/dev/mtdblock" ) )
+ if ( !device.startsWith( "/dev/mtdblock" ) )
{
- QMessageBox::critical( this, "Can't backup!", QString( "<qt>unsupported rootfs %1 - needs to be /dev/mtdblockN</qt>").arg( device ), "Ok" );
-#ifndef MDEBUG
+ QMessageBox::critical( this, "Can't backup!", QString( "<qt>unsupported root device '%1' - needs to be /dev/mtdblockN</qt>").arg( device ), "Ok" );
return;
-#endif
}
} // at this point, the QTextStream has been destroy and we can close the FILE*
pclose( mountp );
-#ifndef MDEBUG
+#if 1
int rootmtd = device.right( 1 ).toInt();
#else
int rootmtd = 0;
@@ -324,6 +329,7 @@ void BackupAndRestore::backupRootFs()
if ( !procmtdf.open( IO_ReadOnly ) )
{
QMessageBox::critical( this, "Can't backup!", "<qt>Can't open /proc/mtd</qt>", "Ok" );
+ return;
}
QTextStream procmtd( &procmtdf );
@@ -356,15 +362,28 @@ void BackupAndRestore::backupRootFs()
outputFile += "/initrd.bin-" + dateString;
// call mkfs.jffs2 to create the backup
- QString cmdline = QString( "mkfs.jffs2 --root=/ %1 --little-endian %2 %3 -n" ).arg( outputFile ).arg( pad ).arg( eraseblock );
+ QString cmdline = QString( "mkfs.jffs2 --faketime --root=/ %1 --little-endian %2 %3 -n" ).arg( outputFile ).arg( pad ).arg( eraseblock );
+ cmdline.append( " --ignore=/tmp --ignore=/mnt --ignore=/var --ignore=/proc" );
owarn << "Calling '" << cmdline << "'" << oendl;
-#ifndef MDEBUG
- ::system( cmdline );
-#endif
+ OWait *owait = new OWait();
+ Global::statusMessage( tr( "Backing up..." ) );
+ owait->show();
+ qApp->processEvents();
- // FIXME: Add image postprocessing for C7x0 and C8x0, for Beagle, for SIMpad
+ int r = ::system( cmdline );
+
+ owait->hide();
+ delete owait;
+
+ if ( r != 0 )
+ {
+ perror("Error: ");
+ QString errorMsg = QString( tr( "<qt>%1</qt>" ).arg( strerror( errno ) ) );
+ QMessageBox::critical(this, tr( "Backup Failed!" ), errorMsg, QString( tr( "Ok" ) ) );
+ }
+ // FIXME: Add image postprocessing for C7x0 and C8x0, for Beagle, for SIMpad
}
void 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 @@
+/dev/initctl p 600 0 0 - - - -
+/dev/apm_bios c 660 0 46 10 134 - - -
+/dev/fb0 c 600 0 0 29 0 - - -
+/dev/hda b 660 0 6 3 0 - - -
+/dev/hda b 660 0 6 3 1 1 1 20
+/dev/kmem c 640 0 15 1 2 - - -
+/dev/mem c 640 0 15 1 1 - - -
+/dev/null c 666 0 0 1 3 - - -
+/dev/ram b 640 0 0 1 0 0 1 4
+/dev/tty c 662 0 5 5 0 - - -
+/dev/tty c 666 0 5 4 0 0 1 9
+/dev/ttyS c 640 0 5 4 64 0 1 1
+/dev/ttySA c 640 0 5 204 5 0 1 1
+/dev/zero c 644 0 0 1 5 - -
+/dev/mtd c 660 0 6 90 0 0 2 8
+/dev/mtdblock b 640 0 0 31 0 0 1 8
+/dev/console c 662 0 5 5 1 - -
+/bin/tinylogin f 4755 0 0 - - - -
+/bin/mount f 4755 0 0 - - - -
+/bin/umount f 4755 0 0 - - - -