@@ -133,6 +133,7 @@ int nandroid_backup(const char* backup_path)
133
133
sprintf (tmp , "mkdir -p %s" , backup_path );
134
134
__system (tmp );
135
135
136
+ #ifndef BOARD_RECOVERY_IGNORE_BOOTABLES
136
137
ui_print ("Backing up boot...\n" );
137
138
sprintf (tmp , "%s/%s" , backup_path , "boot.img" );
138
139
ret = dump_image ("boot" , tmp , NULL );
@@ -143,7 +144,8 @@ int nandroid_backup(const char* backup_path)
143
144
sprintf (tmp , "%s/%s" , backup_path , "recovery.img" );
144
145
ret = dump_image ("recovery" , tmp , NULL );
145
146
if (0 != ret )
146
- return print_and_error ("Error while dumping boot image!\n" );
147
+ return print_and_error ("Error while dumping recovery image!\n" );
148
+ #endif
147
149
148
150
if (0 != (ret = nandroid_backup_partition (backup_path , "SYSTEM:" )))
149
151
return ret ;
@@ -198,13 +200,28 @@ int nandroid_backup(const char* backup_path)
198
200
199
201
typedef int (* format_function )(char * root );
200
202
203
+ static void ensure_directory (const char * dir ) {
204
+ char tmp [PATH_MAX ];
205
+ sprintf (tmp , "mkdir -p %s" , dir );
206
+ __system (tmp );
207
+ }
208
+
201
209
int nandroid_restore_partition_extended (const char * backup_path , const char * root , int umount_when_finished ) {
202
210
int ret = 0 ;
203
211
char mount_point [PATH_MAX ];
204
212
translate_root_path (root , mount_point , PATH_MAX );
205
213
char * name = basename (mount_point );
206
214
215
+ char tmp [PATH_MAX ];
216
+ sprintf (tmp , "%s/%s.img" , backup_path , name );
207
217
struct stat file_info ;
218
+ if (0 != (ret = statfs (tmp , & file_info ))) {
219
+ ui_print ("%s.img not found. Skipping restore of /sd-ext." , name );
220
+ return 0 ;
221
+ }
222
+
223
+ ensure_directory (mount_point );
224
+
208
225
unyaffs_callback callback = NULL ;
209
226
if (0 != stat ("/sdcard/clockworkmod/.hidenandroidprogress" , & file_info )) {
210
227
callback = yaffs_callback ;
@@ -225,8 +242,6 @@ int nandroid_restore_partition_extended(const char* backup_path, const char* roo
225
242
return ret ;
226
243
}
227
244
228
- char tmp [PATH_MAX ];
229
- sprintf (tmp , "%s/%s.img" , backup_path , name );
230
245
if (0 != (ret = unyaffs (tmp , mount_point , callback ))) {
231
246
ui_print ("Error while restoring %s!\n" , mount_point );
232
247
return ret ;
@@ -260,6 +275,7 @@ int nandroid_restore(const char* backup_path, int restore_boot, int restore_syst
260
275
return print_and_error ("MD5 mismatch!\n" );
261
276
262
277
int ret ;
278
+ #ifndef BOARD_RECOVERY_IGNORE_BOOTABLES
263
279
if (restore_boot )
264
280
{
265
281
ui_print ("Erasing boot before restore...\n" );
@@ -272,6 +288,7 @@ int nandroid_restore(const char* backup_path, int restore_boot, int restore_syst
272
288
return ret ;
273
289
}
274
290
}
291
+ #endif
275
292
276
293
if (restore_system && 0 != (ret = nandroid_restore_partition (backup_path , "SYSTEM:" )))
277
294
return ret ;
@@ -284,34 +301,14 @@ int nandroid_restore(const char* backup_path, int restore_boot, int restore_syst
284
301
return ret ;
285
302
#endif
286
303
287
- if (restore_data )
288
- {
289
- struct statfs s ;
290
- sprintf (tmp , "%s/.android_secure.img" , backup_path );
291
- if (0 != (ret = statfs (tmp , & s )))
292
- {
293
- ui_print (".android_secure.img not found. Skipping restore of applications on external storage." );
294
- }
295
- else
296
- {
297
- __system ("mkdir -p /sdcard/.android_secure" );
298
- if (0 != (ret = nandroid_restore_partition_extended (backup_path , "SDCARD:/.android_secure" , 0 )))
299
- return ret ;
300
- }
301
- }
304
+ if (restore_data && 0 != (ret = nandroid_restore_partition_extended (backup_path , "SDCARD:/.android_secure" , 0 )))
305
+ return ret ;
302
306
303
307
if (restore_cache && 0 != (ret = nandroid_restore_partition_extended (backup_path , "CACHE:" , 0 )))
304
308
return ret ;
305
309
306
- if (restore_sdext )
307
- {
308
- struct statfs s ;
309
- sprintf (tmp , "%s/sd-ext.img" , backup_path );
310
- if (0 != (ret = statfs (tmp , & s )))
311
- ui_print ("sd-ext.img not found. Skipping restore of /sd-ext." );
312
- else if (0 != (ret = nandroid_restore_partition (backup_path , "SDEXT:" )))
313
- return ret ;
314
- }
310
+ if (restore_sdext && 0 != (ret = nandroid_restore_partition (backup_path , "SDEXT:" )))
311
+ return ret ;
315
312
316
313
sync ();
317
314
ui_set_background (BACKGROUND_ICON_NONE );
0 commit comments