+ /* Build the restore command */
+
+ if (jcr->replace != 0) {
+ replace = jcr->replace;
+ } else if (jcr->job->replace != 0) {
+ replace = jcr->job->replace;
+ } else {
+ replace = REPLACE_ALWAYS; /* always replace */
+ }
+
+ if (jcr->RegexWhere) {
+ where = jcr->RegexWhere; /* override */
+ cmd = restorecmdR;
+ } else if (jcr->job->RegexWhere) {
+ where = jcr->job->RegexWhere; /* no override take from job */
+ cmd = restorecmdR;
+
+ } else if (jcr->where) {
+ where = jcr->where; /* override */
+ cmd = restorecmd;
+ } else if (jcr->job->RestoreWhere) {
+ where = jcr->job->RestoreWhere; /* no override take from job */
+ cmd = restorecmd;
+
+ } else { /* nothing was specified */
+ where = ∅ /* use default */
+ cmd = restorecmd;
+ }
+
+ jcr->prefix_links = jcr->job->PrefixLinks;
+
+ bash_spaces(where);
+ if (jcr->FDVersion < 7) {
+ Mmsg(ret, cmd, "", replace, jcr->prefix_links, where);
+ } else {
+ snprintf(files, sizeof(files), "files=%d ", jcr->ExpectedFiles);
+ Mmsg(ret, cmd, files, replace, jcr->prefix_links, where);
+ }
+ unbash_spaces(where);
+}
+
+struct bootstrap_info
+{
+ FILE *bs;
+ UAContext *ua;
+ char storage[MAX_NAME_LENGTH+1];
+};
+
+#define UA_CMD_SIZE 1000
+
+/**
+ * Open the bootstrap file and find the first Storage=
+ * Returns ok if able to open
+ * It fills the storage name (should be the first line)
+ * and the file descriptor to the bootstrap file,
+ * it should be used for next operations, and need to be closed
+ * at the end.