From: Kern Sibbald Date: Tue, 30 Mar 2004 09:45:29 +0000 (+0000) Subject: Add -p option to SD => forge on + fix Makefile for gnome files X-Git-Tag: Release-1.34.0~21 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=46cafc85001144b3c57f4d0231e016f3d4bc1a8a;p=bacula%2Fbacula Add -p option to SD => forge on + fix Makefile for gnome files git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@1163 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/Makefile.in b/bacula/Makefile.in index 8fec14f804..d43c04318f 100755 --- a/bacula/Makefile.in +++ b/bacula/Makefile.in @@ -85,30 +85,31 @@ installdirs: $(MKDIR) $(DESTDIR)$(scriptdir) $(MKDIR) $(DESTDIR)$(working_dir) # $(MKDIR) $(DESTDIR)$(mandir) + +gnomedirs: $(MKDIR) $(DESTDIR)/usr/share/pixmaps $(MKDIR) $(DESTDIR)/usr/share/gnome/apps/System $(MKDIR) $(DESTDIR)/usr/share/applications $(MKDIR) $(DESTDIR)/etc/security/console.apps $(MKDIR) $(DESTDIR)/etc/pam.d - $(MKDIR) $(DESTDIR)/usr/bin -install-menu: installdirs +install-menu: installdirs gnomedirs ${INSTALL_DATA} scripts/bacula.png $(DESTDIR)/usr/share/pixmaps/bacula.png ${INSTALL_DATA} scripts/bacula.desktop.gnome1 $(DESTDIR)/usr/share/gnome/apps/System/bacula.desktop ${INSTALL_DATA} scripts/bacula.desktop.gnome2 $(DESTDIR)/usr/share/applications/bacula.desktop -install-menu-xsu: installdirs +install-menu-xsu: installdirs gnomedirs ${INSTALL_DATA} scripts/bacula.png $(DESTDIR)/usr/share/pixmaps/bacula.png ${INSTALL_DATA} scripts/bacula.desktop.gnome1.xsu $(DESTDIR)/usr/share/gnome/apps/System/bacula.desktop ${INSTALL_DATA} scripts/bacula.desktop.gnome2.xsu $(DESTDIR)/usr/share/applications/bacula.desktop -install-menu-consolehelper: installdirs +install-menu-consolehelper: installdirs gnomedirs ${INSTALL_DATA} scripts/bacula.png $(DESTDIR)/usr/share/pixmaps/bacula.png ${INSTALL_DATA} scripts/bacula.desktop.gnome1.consolehelper $(DESTDIR)/usr/share/gnome/apps/System/bacula.desktop ${INSTALL_DATA} scripts/bacula.desktop.gnome2.consolehelper $(DESTDIR)/usr/share/applications/bacula.desktop ${INSTALL_DATA} scripts/gnome-console.console_apps $(DESTDIR)/etc/security/console.apps/gnome-console ${INSTALL_DATA} scripts/gnome-console.pamd $(DESTDIR)/etc/pam.d/gnome-console - ln -s /usr/bin/consolehelper $(DESTDIR)/usr/bin/gnome-console + ln -s $(DESTDIR)$(sbindir)/consolehelper $(DESTDIR)$(sbindir)/gnome-console install: installdirs @for I in $(all_subdirs); do (cd $$I; $(MAKE) DESTDIR=$(DESTDIR) $@ || exit 1); done diff --git a/bacula/src/stored/bcopy.c b/bacula/src/stored/bcopy.c index 98732aa2c3..7f26e79d6d 100644 --- a/bacula/src/stored/bcopy.c +++ b/bacula/src/stored/bcopy.c @@ -48,6 +48,7 @@ static DEV_BLOCK *out_block; #define CONFIG_FILE "bacula-sd.conf" char *configfile; +bool forge_on = true; static void usage() @@ -106,6 +107,7 @@ int main (int argc, char *argv[]) case 'p': ignore_label_errors = true; + forge_on = true; break; case 'v': diff --git a/bacula/src/stored/bextract.c b/bacula/src/stored/bextract.c index dac87a7880..3bd4adb74b 100644 --- a/bacula/src/stored/bextract.c +++ b/bacula/src/stored/bextract.c @@ -64,7 +64,7 @@ static uint64_t fileAddr = 0; /* file write address */ #define CONFIG_FILE "bacula-sd.conf" char *configfile; - +bool forge_on = false; static void usage() { @@ -76,6 +76,7 @@ static void usage() " -d set debug level to nn\n" " -e exclude list\n" " -i include list\n" +" -p proceed inspite of I/O errors\n" " -V specify Volume names (separated by |)\n" " -? print this message\n\n"); exit(1); @@ -97,7 +98,7 @@ int main (int argc, char *argv[]) init_include_exclude_files(ff); binit(&bfd); - while ((ch = getopt(argc, argv, "b:c:d:e:i:V:?")) != -1) { + while ((ch = getopt(argc, argv, "b:c:d:e:i:pV:?")) != -1) { switch (ch) { case 'b': /* bootstrap file */ bsr = parse_bsr(NULL, optarg); @@ -146,6 +147,10 @@ int main (int argc, char *argv[]) got_inc = TRUE; break; + case 'p': + forge_on = true; + break; + case 'V': /* Volume name */ VolumeName = optarg; break; diff --git a/bacula/src/stored/block.c b/bacula/src/stored/block.c index 218c655e91..b2b20d7630 100644 --- a/bacula/src/stored/block.c +++ b/bacula/src/stored/block.c @@ -239,7 +239,9 @@ static int unser_block_header(JCR *jcr, DEVICE *dev, DEV_BLOCK *block) Jmsg(jcr, M_ERROR, 0, "%s", dev->errmsg); } block->read_errors++; - return 0; + if (!forge_on) { + return 0; + } } } else if (Id[3] == '2') { unser_uint32(block->VolSessionId); @@ -255,7 +257,9 @@ static int unser_block_header(JCR *jcr, DEVICE *dev, DEV_BLOCK *block) Jmsg(jcr, M_ERROR, 0, "%s", dev->errmsg); } block->read_errors++; - return 0; + if (!forge_on) { + return 0; + } } } else { dev->dev_errno = EIO; @@ -264,7 +268,14 @@ static int unser_block_header(JCR *jcr, DEVICE *dev, DEV_BLOCK *block) Jmsg(jcr, M_ERROR, 0, "%s", dev->errmsg); } block->read_errors++; - return 0; + if (!forge_on) { + return 0; + } + unser_uint32(block->VolSessionId); + unser_uint32(block->VolSessionTime); + bhl = BLKHDR2_LENGTH; + block->BlockVer = 2; + block->bufp = block->buf + bhl; } /* Sanity check */ @@ -276,7 +287,9 @@ static int unser_block_header(JCR *jcr, DEVICE *dev, DEV_BLOCK *block) Jmsg(jcr, M_ERROR, 0, "%s", dev->errmsg); } block->read_errors++; - return 0; + if (!forge_on) { + return 0; + } } Dmsg1(190, "unser_block_header block_len=%d\n", block_len); @@ -302,7 +315,9 @@ static int unser_block_header(JCR *jcr, DEVICE *dev, DEV_BLOCK *block) Jmsg(jcr, M_ERROR, 0, "%s", dev->errmsg); } block->read_errors++; - return 0; + if (!forge_on) { + return 0; + } } } return 1; @@ -486,7 +501,9 @@ int write_block_to_dev(DCR *dcr, DEV_BLOCK *block) dev->dev_errno = EIO; Jmsg(jcr, M_ERROR, 0, _("Could not create JobMedia record for Volume=\"%s\" Job=%s\n"), dcr->VolCatInfo.VolCatName, jcr->Job); - return 0; + if (!forge_on) { + return 0; + } } dev->file_size = 0; /* reset file size */ /* diff --git a/bacula/src/stored/bls.c b/bacula/src/stored/bls.c index 29f96f0ee3..5096907bca 100644 --- a/bacula/src/stored/bls.c +++ b/bacula/src/stored/bls.c @@ -54,6 +54,7 @@ static ATTR *attr; #define CONFIG_FILE "bacula-sd.conf" char *configfile; +bool forge_on = false; static FF_PKT ff; @@ -159,6 +160,7 @@ int main (int argc, char *argv[]) case 'p': ignore_label_errors = true; + forge_on = true; break; case 'v': diff --git a/bacula/src/stored/bscan.c b/bacula/src/stored/bscan.c index 840aad4772..0988a292e7 100644 --- a/bacula/src/stored/bscan.c +++ b/bacula/src/stored/bscan.c @@ -92,7 +92,7 @@ static int ignored_msgs = 0; #define CONFIG_FILE "bacula-sd.conf" char *configfile; - +bool forge_on = false; static void usage() @@ -106,8 +106,9 @@ static void usage() " -m update media info in database\n" " -n specify the database name (default bacula)\n" " -u specify database user name (default bacula)\n" -" -p specify database host (default NULL)\n" +" -p proceed inspite of I/O errors\n" " -r list records\n" " -s synchronize or store in database\n" " -v verbose\n" @@ -127,7 +128,7 @@ int main (int argc, char *argv[]) init_msg(NULL, NULL); - while ((ch = getopt(argc, argv, "b:c:d:h:mn:p:rsu:vV:w:?")) != -1) { + while ((ch = getopt(argc, argv, "b:c:d:h:mn:pP:rsu:vV:w:?")) != -1) { switch (ch) { case 'b': bsr = parse_bsr(NULL, optarg); @@ -162,10 +163,14 @@ int main (int argc, char *argv[]) db_user = optarg; break; - case 'p': + case 'P': db_password = optarg; break; + case 'p': + forge_on = true; + break; + case 'r': list_records = 1; break; diff --git a/bacula/src/stored/btape.c b/bacula/src/stored/btape.c index edb6eef3bc..c4984a6081 100644 --- a/bacula/src/stored/btape.c +++ b/bacula/src/stored/btape.c @@ -45,6 +45,7 @@ int quit = 0; char buf[100000]; int bsize = TAPE_BSIZE; char VolName[MAX_NAME_LENGTH]; +bool forge_on = false; /* * If you change the format of the state file, @@ -162,7 +163,7 @@ int main(int margc, char *margv[]) my_name_is(margc, margv, "btape"); init_msg(NULL, NULL); - while ((ch = getopt(margc, margv, "b:c:d:sv?")) != -1) { + while ((ch = getopt(margc, margv, "b:c:d:psv?")) != -1) { switch (ch) { case 'b': /* bootstrap file */ bsr = parse_bsr(NULL, optarg); @@ -183,6 +184,10 @@ int main(int margc, char *margv[]) } break; + case 'p': + forge_on = true; + break; + case 's': signals = FALSE; break; @@ -2446,6 +2451,7 @@ static void usage() " -b specify bootstrap file\n" " -c set configuration file to file\n" " -d set debug level to nn\n" +" -p proceed inspite of I/O errors\n" " -s turn off signals\n" " -v be verbose\n" " -? print this message.\n" diff --git a/bacula/src/stored/label.c b/bacula/src/stored/label.c index be0fe16231..db0ce23518 100644 --- a/bacula/src/stored/label.c +++ b/bacula/src/stored/label.c @@ -111,7 +111,7 @@ because:\n %s"), dev_name(dev), strerror_dev(dev)); } if (!ok) { free_record(record); - if (jcr->ignore_label_errors) { + if (forge_on || jcr->ignore_label_errors) { dev->state |= ST_LABEL; /* set has Bacula label */ Jmsg(jcr, M_ERROR, 0, "%s", jcr->errmsg); return jcr->label_status = VOL_OK; @@ -190,7 +190,9 @@ int unser_volume_label(DEVICE *dev, DEV_RECORD *rec) FI_to_ascii(rec->FileIndex), stream_to_ascii(rec->Stream, rec->FileIndex), rec->data_len); - return 0; + if (!forge_on) { + return 0; + } } dev->VolHdr.LabelType = rec->FileIndex; @@ -385,7 +387,9 @@ int write_volume_label_to_dev(JCR *jcr, DEVRES *device, char *VolName, char *Poo if (!rewind_dev(dev)) { memset(&dev->VolHdr, 0, sizeof(dev->VolHdr)); Dmsg2(30, "Bad status on %s from rewind. ERR=%s\n", dev_name(dev), strerror_dev(dev)); - return 0; + if (!forge_on) { + return 0; + } } block = new_block(dev); diff --git a/bacula/src/stored/read_record.c b/bacula/src/stored/read_record.c index 2421ac480b..ce41ba8ed1 100644 --- a/bacula/src/stored/read_record.c +++ b/bacula/src/stored/read_record.c @@ -110,7 +110,7 @@ int read_records(JCR *jcr, DEVICE *dev, } else { /* I/O error or strange end of tape */ display_tape_error_status(jcr, dev); - if (jcr->ignore_label_errors) { + if (forge_on || jcr->ignore_label_errors) { fsr_dev(dev, 1); /* try skipping bad record */ Dmsg0(000, "Did fsr\n"); continue; /* try to continue */ diff --git a/bacula/src/stored/stored.c b/bacula/src/stored/stored.c index 366be796c5..865d6bb511 100644 --- a/bacula/src/stored/stored.c +++ b/bacula/src/stored/stored.c @@ -46,7 +46,8 @@ static void *device_allocation(void *arg); /* Global variables exported */ char OK_msg[] = "3000 OK\n"; char TERM_msg[] = "3999 Terminate\n"; -STORES *me; /* our Global resource */ +STORES *me = NULL; /* our Global resource */ +bool forge_on = false; /* proceed inspite of I/O errors */ static uint32_t VolSessionId = 0; uint32_t VolSessionTime; @@ -57,18 +58,20 @@ static int foreground = 0; static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; static workq_t dird_workq; /* queue for processing connections */ + static void usage() { fprintf(stderr, _( "\nVersion: " VERSION " (" BDATE ")\n\n" -"Usage: stored [-s -f ] [-c config_file] [-d debug_level] [config_file]\n" +"Usage: stored [options] [-c config_file] [config_file]\n" " -c use as configuration file\n" " -dnn set debug level to nn\n" " -f run in foreground (for debugging)\n" -" -g groupid\n" +" -g set groupid to group\n" +" -p proceed despite I/O errors\n" " -s no signals (for debugging)\n" " -t test - read config and exit\n" -" -u userid\n" +" -u userid to \n" " -v verbose user messages\n" " -? print this message.\n" "\n")); @@ -104,7 +107,7 @@ int main (int argc, char *argv[]) Emsg1(M_ABORT, 0, "Tape block size (%d) is not a power of 2\n", TAPE_BSIZE); } - while ((ch = getopt(argc, argv, "c:d:fg:stu:v?")) != -1) { + while ((ch = getopt(argc, argv, "c:d:fg:pstu:v?")) != -1) { switch (ch) { case 'c': /* configuration file */ if (configfile != NULL) { @@ -128,6 +131,10 @@ int main (int argc, char *argv[]) gid = optarg; break; + case 'p': /* proceed in spite of I/O errors */ + forge_on = true; + break; + case 's': /* no signals */ no_signals = TRUE; break; diff --git a/bacula/src/stored/stored.h b/bacula/src/stored/stored.h index a74db4da16..21fbc6bee8 100644 --- a/bacula/src/stored/stored.h +++ b/bacula/src/stored/stored.h @@ -42,14 +42,13 @@ #include "jcr.h" #include "protos.h" #ifdef HAVE_LIBZ -#include /* compression headers */ +#include /* compression headers */ #else #define uLongf uint32_t #endif -extern char errmsg[]; /* general error message */ - extern STORES *me; /* "Global" daemon resource */ +extern bool forge_on; /* proceed inspite of I/O errors */ #ifdef debug_tracing extern int _rewind_dev(char *file, int line, DEVICE *dev); diff --git a/bacula/src/version.h b/bacula/src/version.h index 45169f0c1d..dda5cf07fc 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -2,8 +2,8 @@ #undef VERSION #define VERSION "1.33.6" #define VSTRING "1" -#define BDATE "28 Mar 2004" -#define LSMDATE "28Mar04" +#define BDATE "30 Mar 2004" +#define LSMDATE "30Mar04" /* Debug flags */ #undef DEBUG