From 0f4c2cde7d80797a1d2ff10ead4bfb0bb12bed1c Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Fri, 8 Sep 2006 12:19:52 +0000 Subject: [PATCH] kes Make two separate Win32 menu links for starting bconsole and wx-console in winbacula.nsi kes Apply DVD part_spooled patch from Richard Mortimer richm@oldelvet.org.uk git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@3438 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/stored/dev.c | 12 +++++++++--- bacula/src/stored/dev.h | 3 ++- bacula/src/stored/dvd.c | 9 ++++++--- bacula/src/win32/installer/winbacula.nsi | 3 ++- bacula/technotes-1.39 | 4 ++++ 5 files changed, 23 insertions(+), 8 deletions(-) diff --git a/bacula/src/stored/dev.c b/bacula/src/stored/dev.c index b52f92353b..a4dc847733 100644 --- a/bacula/src/stored/dev.c +++ b/bacula/src/stored/dev.c @@ -582,9 +582,11 @@ void DEVICE::open_dvd_device(DCR *dcr, int omode) if (part <= num_dvd_parts) { omode = OPEN_READ_ONLY; make_mounted_dvd_filename(this, archive_name); + set_part_spooled(false); } else { omode = OPEN_READ_WRITE; make_spooled_dvd_filename(this, archive_name); + set_part_spooled(true); } set_mode(omode); @@ -1778,7 +1780,7 @@ void DEVICE::close() /* Remove the last part file if it is empty */ if (num_dvd_parts > 0) { struct stat statp; - int part_save = part; + uint32_t part_save = part; POOL_MEM archive_name(PM_FNAME); int status; @@ -1791,9 +1793,13 @@ void DEVICE::close() part, num_dvd_parts, VolCatInfo.VolCatName); Dmsg1(100, "unlink(%s)\n", archive_name.c_str()); unlink(archive_name.c_str()); - set_part_spooled(false); /* no spooled part left */ + if (part_save == part) { + set_part_spooled(false); /* no spooled part left */ + } } else if (status < 0) { - set_part_spooled(false); /* spool doesn't exit */ + if (part_save == part) { + set_part_spooled(false); /* spool doesn't exit */ + } } part = part_save; /* restore part number */ } diff --git a/bacula/src/stored/dev.h b/bacula/src/stored/dev.h index 3781e7c63b..a7b775a3ad 100644 --- a/bacula/src/stored/dev.h +++ b/bacula/src/stored/dev.h @@ -324,7 +324,8 @@ public: void set_short_block() { state |= ST_SHORT; }; void set_freespace_ok() { state |= ST_FREESPACE_OK; } void set_part_spooled(int val) { if (val) state |= ST_PART_SPOOLED; \ - else state &= ~ST_PART_SPOOLED; }; + else state &= ~ST_PART_SPOOLED; + }; void set_mounted(int val) { if (val) state |= ST_MOUNTED; \ else state &= ~ST_MOUNTED; }; void clear_append() { state &= ~ST_APPEND; }; diff --git a/bacula/src/stored/dvd.c b/bacula/src/stored/dvd.c index bcd360c6c9..3178758b57 100644 --- a/bacula/src/stored/dvd.c +++ b/bacula/src/stored/dvd.c @@ -36,7 +36,6 @@ void make_mounted_dvd_filename(DEVICE *dev, POOL_MEM &archive_name) { pm_strcpy(archive_name, dev->device->mount_point); add_file_and_part_name(dev, archive_name); - dev->set_part_spooled(false); } void make_spooled_dvd_filename(DEVICE *dev, POOL_MEM &archive_name) @@ -48,7 +47,6 @@ void make_spooled_dvd_filename(DEVICE *dev, POOL_MEM &archive_name) pm_strcpy(archive_name, working_directory); } add_file_and_part_name(dev, archive_name); - dev->set_part_spooled(true); } static void add_file_and_part_name(DEVICE *dev, POOL_MEM &archive_name) @@ -65,7 +63,8 @@ static void add_file_and_part_name(DEVICE *dev, POOL_MEM &archive_name) bsnprintf(partnumber, sizeof(partnumber), "%d", dev->part); pm_strcat(archive_name, partnumber); } - Dmsg1(400, "Exit add_file_part_name: arch=%s\n", archive_name.c_str()); + Dmsg2(400, "Exit add_file_part_name: arch=%s, part=%d\n", + archive_name.c_str(), dev->part); } /* Mount the device. @@ -380,6 +379,7 @@ bool dvd_write_part(DCR *dcr) /* Delete spool file */ make_spooled_dvd_filename(dev, archive_name); unlink(archive_name.c_str()); + dev->set_part_spooled(false); Dmsg1(29, "unlink(%s)\n", archive_name.c_str()); sm_check(__FILE__, __LINE__, false); return true; @@ -449,6 +449,7 @@ bool dvd_write_part(DCR *dcr) /* Delete spool file */ make_spooled_dvd_filename(dev, archive_name); unlink(archive_name.c_str()); + dev->set_part_spooled(false); Dmsg1(29, "unlink(%s)\n", archive_name.c_str()); sm_check(__FILE__, __LINE__, false); @@ -520,6 +521,7 @@ int dvd_open_next_part(DCR *dcr) Dmsg1(100, "Check if part on DVD: %s\n", archive_name.c_str()); if (stat(archive_name.c_str(), &buf) == 0) { /* bad news bail out */ + dev->set_part_spooled(false); Mmsg1(&dev->errmsg, _("Next Volume part already exists on DVD. Cannot continue: %s\n"), archive_name.c_str()); return -1; @@ -537,6 +539,7 @@ int dvd_open_next_part(DCR *dcr) /* Then try to unlink it */ if (unlink(archive_name.c_str()) < 0) { berrno be; + dev->set_part_spooled(false); dev->dev_errno = errno; Mmsg2(dev->errmsg, _("open_next_part can't unlink existing part %s, ERR=%s\n"), archive_name.c_str(), be.strerror()); diff --git a/bacula/src/win32/installer/winbacula.nsi b/bacula/src/win32/installer/winbacula.nsi index e561663cca..a6dd0e0c14 100644 --- a/bacula/src/win32/installer/winbacula.nsi +++ b/bacula/src/win32/installer/winbacula.nsi @@ -712,6 +712,7 @@ Section "Command Console" SecConsole nsExec::ExecToLog 'cmd.exe /C echo Y|cacls "$R1" /G SYSTEM:F Administrators:F' ${EndIf} + CreateShortCut "$SMPROGRAMS\Bacula\bconsole.lnk" "$INSTDIR\bin\bconsole.exe" '-c "$APPDATA\Bacula\bconsole.conf"' "$INSTDIR\bin\bconsole.exe" 0 CreateShortCut "$SMPROGRAMS\Bacula\Edit Command Console Configuration.lnk" "write.exe" '"$APPDATA\Bacula\bconsole.conf"' SectionEnd @@ -753,7 +754,7 @@ Section "Graphical Console" SecWxConsole ${EndIf} ; Create Start Menu entry - CreateShortCut "$SMPROGRAMS\Bacula\Console.lnk" "$INSTDIR\bin\wx-console.exe" '-c "$APPDATA\Bacula\wx-console.conf"' "$INSTDIR\bin\wx-console.exe" 0 + CreateShortCut "$SMPROGRAMS\Bacula\wx-console.lnk" "$INSTDIR\bin\wx-console.exe" '-c "$APPDATA\Bacula\wx-console.conf"' "$INSTDIR\bin\wx-console.exe" 0 CreateShortCut "$SMPROGRAMS\Bacula\Edit Graphical Console Configuration.lnk" "write.exe" '"$APPDATA\Bacula\wx-console.conf"' SectionEnd diff --git a/bacula/technotes-1.39 b/bacula/technotes-1.39 index 764128f22b..4ca576fe07 100644 --- a/bacula/technotes-1.39 +++ b/bacula/technotes-1.39 @@ -2,6 +2,10 @@ General: 08Sep06 +kes Make two separate Win32 menu links for starting bconsole and + wx-console in winbacula.nsi +kes Apply DVD part_spooled patch from Richard Mortimer + richm@oldelvet.org.uk kes Put installer/Readme.txt into Win32 EOL format for Notebook. rbn Fixed problems migrating settings from previous releases in Win32 installer. Add Readme.txt with an option to show it on -- 2.39.5