@@ -52,7 +52,6 @@ typedef enum {
52
52
STATUS_NO_SD_CARD ,
53
53
STATUS_SD_CARD_WRONG_FS ,
54
54
STATUS_SD_CARD_WRONG_PERMISSION ,
55
- STATUS_SD_CARD_MIGRATION_FAILED ,
56
55
STATUS_CODE_COUNT ,
57
56
} status_code_t ;
58
57
@@ -64,8 +63,7 @@ static const char* const status_code_strs[STATUS_CODE_COUNT] = {"-1 NOT STARTED"
64
63
"4 NO SOCKET" ,
65
64
"5 NO SD CARD" ,
66
65
"6 SD CARD WRONG FS" ,
67
- "7 SD CARD WRONG PERMISSION" ,
68
- "8 SD CARD MIGRATION FAILED" };
66
+ "7 SD CARD WRONG PERMISSION" };
69
67
70
68
struct settings {
71
69
char * data_root ;
@@ -258,57 +256,6 @@ static char* get_parameter_value(AXParameter* param_handle, const char* paramete
258
256
return parameter_value ;
259
257
}
260
258
261
- /**
262
- * @brief Migrate the contents of the data directory from the old setup on the
263
- * SD card to 'new_dir' The new directory must be created and empty. If the
264
- * operation is successful, the old setup directory will be removed.
265
- *
266
- * @return True if operation was successful, false otherwise.
267
- */
268
- static bool migrate_from_old_sdcard_setup (const char * new_dir ) {
269
- const char * old_top_dir = "/var/spool/storage/SD_DISK/dockerd" ;
270
- struct stat directory_stat ;
271
- int stat_result = stat (old_top_dir , & directory_stat );
272
- if (stat (old_top_dir , & directory_stat ) != 0 ) {
273
- // No files to move
274
- return true;
275
- }
276
-
277
- // The new directory must be created and empty.
278
- GDir * dir = g_dir_open (new_dir , 0 , NULL );
279
- if (dir == NULL ) {
280
- log_error ("Failed to open %s" , new_dir );
281
- return false;
282
- }
283
- // Get name to first entry in directory, NULL if empty, . and .. are omitted
284
- const char * dir_entry = g_dir_read_name (dir );
285
- bool directory_not_empty = dir_entry != NULL ;
286
- g_dir_close (dir );
287
-
288
- if (directory_not_empty ) {
289
- log_error ("Target directory %s is not empty. Will not move files." , new_dir );
290
- return false;
291
- }
292
-
293
- // Move data from the old directory
294
- const char * move_command = g_strdup_printf ("mv %s/data/* %s/." , old_top_dir , new_dir );
295
- log_info ("Run move cmd: \"%s\"" , move_command );
296
- int res = system (move_command );
297
- if (res != 0 ) {
298
- log_error ("Failed to move %s to %s, error: %d" , old_top_dir , new_dir , res );
299
- return false;
300
- }
301
-
302
- // Remove the directory
303
- const char * remove_command = g_strdup_printf ("rm -rf %s" , old_top_dir );
304
- res = system (remove_command );
305
- if (res != 0 ) {
306
- log_error ("Failed to remove %s, error: %d" , old_top_dir , res );
307
- }
308
-
309
- return res == 0 ;
310
- }
311
-
312
259
/**
313
260
* @brief Retrieve the file system type of the device containing this path.
314
261
*
@@ -394,12 +341,6 @@ static bool setup_sdcard(AXParameter* param_handle, const char* data_root) {
394
341
return false;
395
342
}
396
343
397
- if (!migrate_from_old_sdcard_setup (data_root )) {
398
- log_error ("Failed to migrate data from old data-root" );
399
- set_status_parameter (param_handle , STATUS_SD_CARD_MIGRATION_FAILED );
400
- return false;
401
- }
402
-
403
344
return true;
404
345
}
405
346
0 commit comments