X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=bacula%2Fsrc%2Fdird%2Fua_restore.c;h=0f20e3a51264fdbab9ba6e01f3b18d3acb5bdf76;hb=7ebf8f564b27ca8448a9a7365ba73b130ae69c21;hp=14764bbbfaca8093500cc41ec4275a3139e33da1;hpb=d485013315833870ae3cb4fa750ad8c2a7fb6a75;p=bacula%2Fbacula diff --git a/bacula/src/dird/ua_restore.c b/bacula/src/dird/ua_restore.c index 14764bbbfa..0f20e3a512 100644 --- a/bacula/src/dird/ua_restore.c +++ b/bacula/src/dird/ua_restore.c @@ -80,6 +80,7 @@ struct RESTORE_CTX { int fnl; /* filename length */ int pnl; /* path length */ bool found; + bool all; /* mark all as default */ NAME_LIST name_list; }; @@ -176,7 +177,9 @@ int restore_cmd(UAContext *ua, char *cmd) bsendmsg(ua, _("Unable to construct a valid BSR. Cannot continue.\n")); goto bail_out; } - write_bsr_file(ua, rx.bsr); + if (!write_bsr_file(ua, rx.bsr)) { + goto bail_out; + } bsendmsg(ua, _("\n%u file%s selected to be restored.\n\n"), rx.selected_files, rx.selected_files==1?"":"s"); } else { @@ -305,11 +308,13 @@ static int user_select_jobids_or_files(UAContext *ua, RESTORE_CTX *rx) "file", /* 3 */ "select", /* 4 */ "pool", /* 5 */ - "client", /* 6 */ - "storage", /* 7 */ - "where", /* 8 */ - "all", /* 9 */ - "yes", /* 10 */ + "all", /* 6 */ + "client", /* 7 */ + "storage", /* 8 */ + "fileset", /* 9 */ + "where", /* 10 */ + "yes", /* 11 */ + "done", /* 12 */ NULL }; @@ -384,8 +389,11 @@ static int user_select_jobids_or_files(UAContext *ua, RESTORE_CTX *rx) return 0; } break; + case 6: /* all specified */ + rx->all = true; + break; /* - * All keywords 6 or greater are ignored or handled by a select prompt + * All keywords 7 or greater are ignored or handled by a select prompt */ default: break; @@ -702,6 +710,7 @@ static bool build_directory_tree(UAContext *ua, RESTORE_CTX *rx) tree.root = new_tree(rx->TotalFiles); tree.root->fname = nofname; tree.ua = ua; + tree.all = rx->all; last_JobId = 0; /* * For display purposes, the same JobId, with different volumes may @@ -731,13 +740,13 @@ static bool build_directory_tree(UAContext *ua, RESTORE_CTX *rx) bsendmsg(ua, "%s", db_strerror(ua->db)); } } - bsendmsg(ua, "%d Job%s inserted into the tree and marked for extraction.\n", - items, items==1?"":"s"); + bsendmsg(ua, "%d Job%s inserted into the tree%s.\n", + items, items==1?"":"s", tree.all?" and marked for extraction":""); /* Check MediaType and select storage that corresponds */ get_storage_from_mediatype(ua, &rx->name_list, rx); - if (find_arg(ua, _("all")) < 0) { + if (find_arg(ua, _("done")) < 0) { /* Let the user interact in selecting which files to restore */ OK = user_select_files_from_tree(&tree); }