static int type;
static int stream;
static int prog_name_msg = 0;
+static char *VolumeName = NULL;
static char *wbuf; /* write buffer address */
static uint32_t wsize; /* write size */
static void usage()
{
fprintf(stderr,
-"\nVersion: " VERSION " (" DATE ")\n\n"
+"\nVersion: " VERSION " (" BDATE ")\n\n"
"Usage: bextract [-d debug_level] <bacula-archive> <directory-to-store-files>\n"
" -b <file> specify a bootstrap file\n"
" -c <file> specify a configuration file\n"
" -dnn set debug level to nn\n"
" -e <file> exclude list\n"
" -i <file> include list\n"
+" -V specify Volume names (separated by |)\n"
" -? print this message\n\n");
exit(1);
}
got_inc = TRUE;
break;
+ case 'V': /* Volume name */
+ VolumeName = optarg;
+ break;
+
case '?':
default:
usage();
static void do_extract(char *devname)
{
- jcr = setup_jcr("bextract", devname, bsr);
+ jcr = setup_jcr("bextract", devname, bsr, VolumeName);
dev = setup_to_access_device(jcr, 1); /* acquire for read */
if (!dev) {
exit(1);
*/
static void record_cb(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec)
{
+ int stat;
if (rec->FileIndex < 0) {
return; /* we don't want labels */
if (file_is_included(ff, fname) && !file_is_excluded(ff, fname)) {
+ uint32_t LinkFI;
- decode_stat(ap, &statp);
+ decode_stat(ap, &statp, &LinkFI);
/*
* Prepend the where directory so that the
* files are put where the user wants.
/* Pmsg1(000, "Restoring: %s\n", ofile); */
- extract = create_file(jcr, fname, ofile, lname, type, stream,
- &statp, attribsEx, &ofd, REPLACE_ALWAYS);
- num_files++;
-
- if (extract) {
- print_ls_output(ofile, lname, type, &statp);
- fileAddr = 0;
- }
+ extract = FALSE;
+ stat = create_file(jcr, fname, ofile, lname, type, stream,
+ &statp, attribsEx, &ofd, REPLACE_ALWAYS);
+ switch (stat) {
+ case CF_ERROR:
+ case CF_SKIP:
+ break;
+ case CF_EXTRACT:
+ extract = TRUE;
+ /* Fall-through wanted */
+ case CF_CREATED:
+ print_ls_output(ofile, lname, type, &statp);
+ num_files++;
+ fileAddr = 0;
+ break;
+ }
}
/* Data stream and extracting */
Pmsg0(000, "Got Program Name or Data Stream. Ignored.\n");
prog_name_msg = 1;
}
- } else if (rec->Stream != STREAM_MD5_SIGNATURE) {
+ } else if (!(rec->Stream == STREAM_MD5_SIGNATURE ||
+ rec->Stream == STREAM_SHA1_SIGNATURE)) {
Pmsg2(0, "None of above!!! stream=%d data=%s\n", rec->Stream, rec->data);
}
}