From 4c12cc943948f723ebf8734947b461a9d20327fe Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Wed, 12 Jan 2011 15:13:16 +0100 Subject: [PATCH] Add replace=xxx on restore command line --- bacula/src/dird/ua.h | 1 + bacula/src/dird/ua_restore.c | 14 +++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/bacula/src/dird/ua.h b/bacula/src/dird/ua.h index a9e3f5b600..b8f01b94be 100644 --- a/bacula/src/dird/ua.h +++ b/bacula/src/dird/ua.h @@ -116,6 +116,7 @@ struct RESTORE_CTX { char *comment; char *where; char *RegexWhere; + char *replace; RBSR *bsr; POOLMEM *fname; /* filename only */ POOLMEM *path; /* path only */ diff --git a/bacula/src/dird/ua_restore.c b/bacula/src/dird/ua_restore.c index 1df4960b17..b6e3912a6d 100644 --- a/bacula/src/dird/ua_restore.c +++ b/bacula/src/dird/ua_restore.c @@ -108,6 +108,12 @@ int restore_cmd(UAContext *ua, const char *cmd) rx.where = ua->argv[i]; } + i = find_arg_with_value(ua, "replace"); + if (i >= 0) { + rx.replace = ua->argv[i]; + } + + i = find_arg_with_value(ua, "strip_prefix"); if (i >= 0) { strip_prefix = ua->argv[i]; @@ -257,6 +263,11 @@ int restore_cmd(UAContext *ua, const char *cmd) } pm_strcat(ua->cmd, buf); + if (rx.replace) { + Mmsg(buf, " replace=%s", rx.replace); + pm_strcat(ua->cmd, buf); + } + if (rx.comment) { Mmsg(buf, " comment=\"%s\"", rx.comment); pm_strcat(ua->cmd, buf); @@ -458,7 +469,8 @@ static int user_select_jobids_or_files(UAContext *ua, RESTORE_CTX *rx) "restoreclient", /* 19 */ "copies", /* 20 */ "comment", /* 21 */ - "restore_job", /* 22 */ + "restorejob", /* 22 */ + "replace", /* 23 */ NULL }; -- 2.39.5