]> git.sur5r.net Git - bacula/bacula/commitdiff
Fix Windows' daemons so that messages print to stdout if not running as a service.
authorRobert Nelson <robertn@the-nelsons.org>
Wed, 11 Oct 2006 09:11:55 +0000 (09:11 +0000)
committerRobert Nelson <robertn@the-nelsons.org>
Wed, 11 Oct 2006 09:11:55 +0000 (09:11 +0000)
Add daemon name to trace file name (eg bacula-dir.trace).

Fix environment variable expansion in directory names on Windows.

Fix autochanger support in fill command.

Update SQL scripts.

Fix daemon usage displays.

Cleanup bacula-dir.conf template.

Install openssl.cnf.

git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@3543 91ce42f0-d328-0410-95d8-f526ca767f89

16 files changed:
bacula/src/win32/cats/create_postgresql_database.sql
bacula/src/win32/cats/drop_mysql_tables.sql
bacula/src/win32/cats/grant_postgresql_privileges.sql
bacula/src/win32/cats/make_mysql_tables.sql
bacula/src/win32/cats/update_mysql_tables.cmd
bacula/src/win32/cats/update_mysql_tables.sql
bacula/src/win32/dird/dird.vcproj
bacula/src/win32/dird/winbacula.h
bacula/src/win32/dird/winmain.cpp
bacula/src/win32/filed/baculafd.vcproj
bacula/src/win32/filed/winmain.cpp
bacula/src/win32/installer/bacula-dir.conf.in
bacula/src/win32/installer/winbacula.nsi
bacula/src/win32/libwin32/winbacula.h
bacula/src/win32/stored/baculasd/winbacula.h
bacula/src/win32/stored/baculasd/winmain.cpp

index 2dec4e48c3bc1e8a771c479ada76b8fe02b1e612..bebc25138d3e83e87315adff1bcbb2c19449b08f 100644 (file)
@@ -1,2 +1,2 @@
-CREATE DATABASE bacula $ENCODING;\r
+CREATE DATABASE bacula ENCODING 'SQL_ASCII';\r
 ALTER DATABASE bacula SET datestyle TO 'ISO, YMD';\r
index 562a50b237a8f8b1b9f0fc7cb0cb9f08e3bbc18f..b57d7e5029b051ab647fa94186f16a290decb6da 100644 (file)
@@ -9,7 +9,6 @@ DROP TABLE IF EXISTS File;
 DROP TABLE IF EXISTS Client;\r
 DROP TABLE IF EXISTS Job;\r
 DROP TABLE IF EXISTS Media;\r
-DROP TABLE IF EXISTS MAC;\r
 DROP TABLE IF EXISTS JobMedia;\r
 DROP TABLE IF EXISTS Pool;\r
 DROP TABLE IF EXISTS MultiVolume;\r
@@ -22,4 +21,6 @@ DROP TABLE IF EXISTS UnsavedFiles;
 DROP TABLE IF EXISTS CDImages;\r
 DROP TABLE IF EXISTS Status;\r
 DROP TABLE IF EXISTS MAC;\r
+DROP TABLE IF EXISTS Log;\r
 DROP TABLE IF EXISTS Location;\r
+DROP TABLE IF EXISTS LocationLog;\r
index 2737efcc02a7cec0151888fcb8fbd1c9afff39c5..3a73f6d2c5e46ce6788625cbcb31d74ec9b567c8 100644 (file)
@@ -1,37 +1,37 @@
-create user ${USER};\r
+create user bacula;\r
 \r
 -- for tables\r
-grant all on unsavedfiles to ${USER};\r
-grant all on basefiles   to ${USER};\r
-grant all on jobmedia    to ${USER};\r
-grant all on file        to ${USER};\r
-grant all on job         to ${USER};\r
-grant all on media       to ${USER};\r
-grant all on client      to ${USER};\r
-grant all on pool        to ${USER};\r
-grant all on fileset     to ${USER};\r
-grant all on path        to ${USER};\r
-grant all on filename    to ${USER};\r
-grant all on counters    to ${USER};\r
-grant all on version     to ${USER};\r
-grant all on cdimages    to ${USER};\r
-grant all on mediatype   to ${USER};\r
-grant all on storage     to ${USER};\r
-grant all on device      to ${USER};\r
-grant all on status      to ${USER};\r
+grant all on unsavedfiles to bacula;\r
+grant all on basefiles   to bacula;\r
+grant all on jobmedia    to bacula;\r
+grant all on file        to bacula;\r
+grant all on job         to bacula;\r
+grant all on media       to bacula;\r
+grant all on client      to bacula;\r
+grant all on pool        to bacula;\r
+grant all on fileset     to bacula;\r
+grant all on path        to bacula;\r
+grant all on filename    to bacula;\r
+grant all on counters    to bacula;\r
+grant all on version     to bacula;\r
+grant all on cdimages    to bacula;\r
+grant all on mediatype   to bacula;\r
+grant all on storage     to bacula;\r
+grant all on device      to bacula;\r
+grant all on status      to bacula;\r
 \r
 -- for sequences on those tables\r
 \r
-grant select, update on filename_filenameid_seq    to ${USER};\r
-grant select, update on path_pathid_seq           to ${USER};\r
-grant select, update on fileset_filesetid_seq     to ${USER};\r
-grant select, update on pool_poolid_seq           to ${USER};\r
-grant select, update on client_clientid_seq       to ${USER};\r
-grant select, update on media_mediaid_seq         to ${USER};\r
-grant select, update on job_jobid_seq             to ${USER};\r
-grant select, update on file_fileid_seq           to ${USER};\r
-grant select, update on jobmedia_jobmediaid_seq    to ${USER};\r
-grant select, update on basefiles_baseid_seq      to ${USER};\r
-grant select, update on storage_storageid_seq     to ${USER};\r
-grant select, update on mediatype_mediatypeid_seq  to ${USER};\r
-grant select, update on device_deviceid_seq       to ${USER};\r
+grant select, update on filename_filenameid_seq    to bacula;\r
+grant select, update on path_pathid_seq           to bacula;\r
+grant select, update on fileset_filesetid_seq     to bacula;\r
+grant select, update on pool_poolid_seq           to bacula;\r
+grant select, update on client_clientid_seq       to bacula;\r
+grant select, update on media_mediaid_seq         to bacula;\r
+grant select, update on job_jobid_seq             to bacula;\r
+grant select, update on file_fileid_seq           to bacula;\r
+grant select, update on jobmedia_jobmediaid_seq    to bacula;\r
+grant select, update on basefiles_baseid_seq      to bacula;\r
+grant select, update on storage_storageid_seq     to bacula;\r
+grant select, update on mediatype_mediatypeid_seq  to bacula;\r
+grant select, update on device_deviceid_seq       to bacula;\r
index 2d2e7fc5dc8a51b40190afd7783fafb386ae1fd0..4f6833f1fe2b6c0a15763da659ce9f282cba9923 100644 (file)
@@ -22,13 +22,13 @@ CREATE TABLE Path (
 \r
 CREATE TABLE File (\r
    FileId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,\r
-   FileIndex INTEGER UNSIGNED NOT NULL DEFAULT 0,\r
+   FileIndex INTEGER UNSIGNED DEFAULT 0,\r
    JobId INTEGER UNSIGNED NOT NULL REFERENCES Job,\r
    PathId INTEGER UNSIGNED NOT NULL REFERENCES Path,\r
    FilenameId INTEGER UNSIGNED NOT NULL REFERENCES Filename,\r
-   MarkId INTEGER UNSIGNED NOT NULL DEFAULT 0,\r
+   MarkId INTEGER UNSIGNED DEFAULT 0,\r
    LStat TINYBLOB NOT NULL,\r
-   MD5 TINYBLOB NOT NULL,\r
+   MD5 TINYBLOB,\r
    PRIMARY KEY(FileId),\r
    INDEX (JobId),\r
    INDEX (JobId, PathId, FilenameId)\r
@@ -62,8 +62,8 @@ CREATE TABLE Storage (
 CREATE TABLE Device (\r
    DeviceId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,\r
    Name TINYBLOB NOT NULL,\r
-   MediaTypeId INTEGER UNSIGNED NOT NULL REFERENCES MediaType,\r
-   StorageId INTEGER UNSIGNED NOT NULL REFERENCES Storage,\r
+   MediaTypeId INTEGER UNSIGNED DEFAULT 0 REFERENCES MediaType,\r
+   StorageId INTEGER UNSIGNED DEFAULT 0 REFERENCES Storage,\r
    DevMounts INTEGER UNSIGNED DEFAULT 0,\r
    DevReadBytes BIGINT UNSIGNED DEFAULT 0,\r
    DevWriteBytes BIGINT UNSIGNED DEFAULT 0,\r
@@ -85,50 +85,56 @@ CREATE TABLE Job (
    Name TINYBLOB NOT NULL,\r
    Type BINARY(1) NOT NULL,\r
    Level BINARY(1) NOT NULL,\r
-   ClientId INTEGER NULL REFERENCES Client,\r
+   ClientId INTEGER DEFAULT 0 REFERENCES Client,\r
    JobStatus BINARY(1) NOT NULL,\r
-   SchedTime DATETIME NOT NULL,\r
-   StartTime DATETIME NULL,\r
-   EndTime DATETIME NULL,\r
-   JobTDate BIGINT UNSIGNED NOT NULL,\r
-   VolSessionId INTEGER UNSIGNED NOT NULL DEFAULT 0,\r
-   VolSessionTime INTEGER UNSIGNED NOT NULL DEFAULT 0,\r
-   JobFiles INTEGER UNSIGNED NOT NULL DEFAULT 0,\r
-   JobBytes BIGINT UNSIGNED NOT NULL DEFAULT 0,\r
-   JobErrors INTEGER UNSIGNED NOT NULL DEFAULT 0,\r
-   JobMissingFiles INTEGER UNSIGNED NOT NULL DEFAULT 0,\r
-   PoolId INTEGER UNSIGNED NULL REFERENCES Pool,\r
-   FileSetId INTEGER UNSIGNED NULL REFERENCES FileSet,\r
-   PurgedFiles TINYINT NOT NULL DEFAULT 0,\r
-   HasBase TINYINT NOT NULL DEFAULT 0,\r
+   SchedTime DATETIME DEFAULT 0,\r
+   StartTime DATETIME DEFAULT 0,\r
+   EndTime DATETIME DEFAULT 0,\r
+   RealEndTime DATETIME DEFAULT 0,\r
+   JobTDate BIGINT UNSIGNED DEFAULT 0,\r
+   VolSessionId INTEGER UNSIGNED DEFAULT 0,\r
+   VolSessionTime INTEGER UNSIGNED DEFAULT 0,\r
+   JobFiles INTEGER UNSIGNED DEFAULT 0,\r
+   JobBytes BIGINT UNSIGNED DEFAULT 0,\r
+   JobErrors INTEGER UNSIGNED DEFAULT 0,\r
+   JobMissingFiles INTEGER UNSIGNED DEFAULT 0,\r
+   PoolId INTEGER UNSIGNED DEFAULT 0 REFERENCES Pool,\r
+   FileSetId INTEGER UNSIGNED DEFAULT 0 REFERENCES FileSet,\r
+   PriorJobId INTEGER UNSIGNED DEFAULT 0 REFERENCES Job,\r
+   PurgedFiles TINYINT DEFAULT 0,\r
+   HasBase TINYINT DEFAULT 0,\r
    PRIMARY KEY(JobId),\r
    INDEX (Name(128))\r
    );\r
 \r
-CREATE TABLE MAC (\r
-   JobId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,\r
-   OriginalJobId INTEGER UNSIGNED NOT NULL,\r
-   JobType BINARY(1) NOT NULL,\r
-   JobLevel BINARY(1) NOT NULL,\r
-   SchedTime DATETIME NOT NULL,\r
-   StartTime DATETIME NOT NULL,\r
-   EndTime DATETIME NOT NULL,\r
-   JobTDate BIGINT UNSIGNED NOT NULL,\r
-   PRIMARY KEY(JobId)\r
-   );\r
 \r
 CREATE TABLE Location (\r
    LocationId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,\r
    Location TINYBLOB NOT NULL,\r
+   Cost INTEGER DEFAULT 0,\r
+   Enabled TINYINT,\r
    PRIMARY KEY(LocationId)\r
    );\r
 \r
+CREATE TABLE LocationLog (\r
+   LocLogId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,\r
+   Date DATETIME DEFAULT 0,\r
+   Comment BLOB NOT NULL,\r
+   MediaId INTEGER UNSIGNED DEFAULT 0 REFERENCES Media,\r
+   LocationId INTEGER UNSIGNED DEFAULT 0 REFERENCES Location,\r
+   NewVolStatus ENUM('Full', 'Archive', 'Append', 'Recycle', 'Purged',\r
+    'Read-Only', 'Disabled', 'Error', 'Busy', 'Used', 'Cleaning') NOT NULL,\r
+   NewEnabled TINYINT,\r
+   PRIMARY KEY(LocLogId)\r
+);\r
+\r
+\r
 # \r
 CREATE TABLE FileSet (\r
    FileSetId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,\r
    FileSet TINYBLOB NOT NULL,\r
-   MD5 TINYBLOB NOT NULL,\r
-   CreateTime DATETIME NOT NULL,\r
+   MD5 TINYBLOB,\r
+   CreateTime DATETIME DEFAULT 0,\r
    PRIMARY KEY(FileSetId)\r
    );\r
 \r
@@ -136,15 +142,15 @@ CREATE TABLE JobMedia (
    JobMediaId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,\r
    JobId INTEGER UNSIGNED NOT NULL REFERENCES Job,\r
    MediaId INTEGER UNSIGNED NOT NULL REFERENCES Media,\r
-   FirstIndex INTEGER UNSIGNED NOT NULL DEFAULT 0,\r
-   LastIndex INTEGER UNSIGNED NOT NULL DEFAULT 0,\r
-   StartFile INTEGER UNSIGNED NOT NULL DEFAULT 0,\r
-   EndFile INTEGER UNSIGNED NOT NULL DEFAULT 0,\r
-   StartBlock INTEGER UNSIGNED NOT NULL DEFAULT 0,\r
-   EndBlock INTEGER UNSIGNED NOT NULL DEFAULT 0,\r
-   VolIndex INTEGER UNSIGNED NOT NULL DEFAULT 0,\r
-   Copy INTEGER UNSIGNED NOT NULL DEFAULT 0,\r
-   Stripe INTEGER UNSIGNED NOT NULL DEFAULT 0,\r
+   FirstIndex INTEGER UNSIGNED DEFAULT 0,\r
+   LastIndex INTEGER UNSIGNED DEFAULT 0,\r
+   StartFile INTEGER UNSIGNED DEFAULT 0,\r
+   EndFile INTEGER UNSIGNED DEFAULT 0,\r
+   StartBlock INTEGER UNSIGNED DEFAULT 0,\r
+   EndBlock INTEGER UNSIGNED DEFAULT 0,\r
+   VolIndex INTEGER UNSIGNED DEFAULT 0,\r
+   Copy INTEGER UNSIGNED DEFAULT 0,\r
+   Stripe INTEGER UNSIGNED DEFAULT 0,\r
    PRIMARY KEY(JobMediaId),\r
    INDEX (JobId, MediaId)\r
    );\r
@@ -153,44 +159,46 @@ CREATE TABLE JobMedia (
 CREATE TABLE Media (\r
    MediaId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,\r
    VolumeName TINYBLOB NOT NULL,\r
-   Slot INTEGER NOT NULL DEFAULT 0,\r
-   PoolId INTEGER UNSIGNED NOT NULL REFERENCES Pool,\r
+   Slot INTEGER DEFAULT 0,\r
+   PoolId INTEGER UNSIGNED DEFAULT 0 REFERENCES Pool,\r
    MediaType TINYBLOB NOT NULL,\r
-   MediaTypeId INTEGER UNSIGNED NOT NULL REFERENCES MediaType,\r
-   LabelType TINYINT NOT NULL DEFAULT 0,\r
-   FirstWritten DATETIME NULL,\r
-   LastWritten DATETIME NULL,\r
-   LabelDate DATETIME NULL,\r
-   VolJobs INTEGER UNSIGNED NOT NULL DEFAULT 0,\r
-   VolFiles INTEGER UNSIGNED NOT NULL DEFAULT 0,\r
-   VolBlocks INTEGER UNSIGNED NOT NULL DEFAULT 0,\r
-   VolMounts INTEGER UNSIGNED NOT NULL DEFAULT 0,\r
-   VolBytes BIGINT UNSIGNED NOT NULL DEFAULT 0,\r
-   VolParts INTEGER UNSIGNED NOT NULL DEFAULT 0,\r
-   VolErrors INTEGER UNSIGNED NOT NULL DEFAULT 0,\r
-   VolWrites INTEGER UNSIGNED NOT NULL DEFAULT 0,\r
-   VolCapacityBytes BIGINT UNSIGNED NOT NULL,\r
+   MediaTypeId INTEGER UNSIGNED DEFAULT 0 REFERENCES MediaType,\r
+   LabelType TINYINT DEFAULT 0,\r
+   FirstWritten DATETIME DEFAULT 0,\r
+   LastWritten DATETIME DEFAULT 0,\r
+   LabelDate DATETIME DEFAULT 0,\r
+   VolJobs INTEGER UNSIGNED DEFAULT 0,\r
+   VolFiles INTEGER UNSIGNED DEFAULT 0,\r
+   VolBlocks INTEGER UNSIGNED DEFAULT 0,\r
+   VolMounts INTEGER UNSIGNED DEFAULT 0,\r
+   VolBytes BIGINT UNSIGNED DEFAULT 0,\r
+   VolParts INTEGER UNSIGNED DEFAULT 0,\r
+   VolErrors INTEGER UNSIGNED DEFAULT 0,\r
+   VolWrites INTEGER UNSIGNED DEFAULT 0,\r
+   VolCapacityBytes BIGINT UNSIGNED DEFAULT 0,\r
    VolStatus ENUM('Full', 'Archive', 'Append', 'Recycle', 'Purged',\r
     'Read-Only', 'Disabled', 'Error', 'Busy', 'Used', 'Cleaning') NOT NULL,\r
-   Recycle TINYINT NOT NULL DEFAULT 0,\r
-   VolRetention BIGINT UNSIGNED NOT NULL DEFAULT 0,\r
-   VolUseDuration BIGINT UNSIGNED NOT NULL DEFAULT 0,\r
-   MaxVolJobs INTEGER UNSIGNED NOT NULL DEFAULT 0,\r
-   MaxVolFiles INTEGER UNSIGNED NOT NULL DEFAULT 0,\r
-   MaxVolBytes BIGINT UNSIGNED NOT NULL DEFAULT 0,\r
-   InChanger TINYINT NOT NULL DEFAULT 0,\r
-   StorageId INTEGER UNSIGNED NOT NULL REFERENCES Storage,\r
-   DeviceId INTEGER UNSIGNED NOT NULL REFERENCES Device,\r
-   MediaAddressing TINYINT NOT NULL DEFAULT 0,\r
-   VolReadTime BIGINT UNSIGNED NOT NULL DEFAULT 0,\r
-   VolWriteTime BIGINT UNSIGNED NOT NULL DEFAULT 0,\r
-   EndFile INTEGER UNSIGNED NOT NULL DEFAULT 0,\r
-   EndBlock INTEGER UNSIGNED NOT NULL DEFAULT 0,\r
-   LocationId INTEGER UNSIGNED NOT NULL REFERENCES Location,\r
+   Enabled TINYINT DEFAULT 1,\r
+   Recycle TINYINT DEFAULT 0,\r
+   VolRetention BIGINT UNSIGNED DEFAULT 0,\r
+   VolUseDuration BIGINT UNSIGNED DEFAULT 0,\r
+   MaxVolJobs INTEGER UNSIGNED DEFAULT 0,\r
+   MaxVolFiles INTEGER UNSIGNED DEFAULT 0,\r
+   MaxVolBytes BIGINT UNSIGNED DEFAULT 0,\r
+   InChanger TINYINT DEFAULT 0,\r
+   StorageId INTEGER UNSIGNED DEFAULT 0 REFERENCES Storage,\r
+   DeviceId INTEGER UNSIGNED DEFAULT 0 REFERENCES Device,\r
+   MediaAddressing TINYINT DEFAULT 0,\r
+   VolReadTime BIGINT UNSIGNED DEFAULT 0,\r
+   VolWriteTime BIGINT UNSIGNED DEFAULT 0,\r
+   EndFile INTEGER UNSIGNED DEFAULT 0,\r
+   EndBlock INTEGER UNSIGNED DEFAULT 0,\r
+   LocationId INTEGER UNSIGNED DEFAULT 0 REFERENCES Location,\r
    RecycleCount INTEGER UNSIGNED DEFAULT 0,\r
-   InitialWrite DATETIME NULL,\r
+   InitialWrite DATETIME DEFAULT 0,\r
    ScratchPoolId INTEGER UNSIGNED DEFAULT 0 REFERENCES Pool,\r
    RecyclePoolId INTEGER UNSIGNED DEFAULT 0 REFERENCES Pool,\r
+   Comment BLOB,\r
    PRIMARY KEY(MediaId),\r
    INDEX (PoolId)\r
    );\r
@@ -202,20 +210,20 @@ CREATE INDEX inx8 ON Media (PoolId);
 CREATE TABLE Pool (\r
    PoolId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,\r
    Name TINYBLOB NOT NULL,\r
-   NumVols INTEGER UNSIGNED NOT NULL DEFAULT 0,\r
-   MaxVols INTEGER UNSIGNED NOT NULL DEFAULT 0,\r
-   UseOnce TINYINT NOT NULL,\r
-   UseCatalog TINYINT NOT NULL,\r
+   NumVols INTEGER UNSIGNED DEFAULT 0,\r
+   MaxVols INTEGER UNSIGNED DEFAULT 0,\r
+   UseOnce TINYINT DEFAULT 0,\r
+   UseCatalog TINYINT DEFAULT 0,\r
    AcceptAnyVolume TINYINT DEFAULT 0,\r
-   VolRetention BIGINT UNSIGNED NOT NULL,\r
-   VolUseDuration BIGINT UNSIGNED NOT NULL,\r
-   MaxVolJobs INTEGER UNSIGNED NOT NULL DEFAULT 0,\r
-   MaxVolFiles INTEGER UNSIGNED NOT NULL DEFAULT 0,\r
-   MaxVolBytes BIGINT UNSIGNED NOT NULL,\r
+   VolRetention BIGINT UNSIGNED DEFAULT 0,\r
+   VolUseDuration BIGINT UNSIGNED DEFAULT 0,\r
+   MaxVolJobs INTEGER UNSIGNED DEFAULT 0,\r
+   MaxVolFiles INTEGER UNSIGNED DEFAULT 0,\r
+   MaxVolBytes BIGINT UNSIGNED DEFAULT 0,\r
    AutoPrune TINYINT DEFAULT 0,\r
    Recycle TINYINT DEFAULT 0,\r
    PoolType ENUM('Backup', 'Copy', 'Cloned', 'Archive', 'Migration', 'Scratch') NOT NULL,\r
-   LabelType TINYINT NOT NULL DEFAULT 0,\r
+   LabelType TINYINT DEFAULT 0,\r
    LabelFormat TINYBLOB,\r
    Enabled TINYINT DEFAULT 1,\r
    ScratchPoolId INTEGER UNSIGNED DEFAULT 0 REFERENCES Pool,\r
@@ -234,12 +242,22 @@ CREATE TABLE Client (
    Name TINYBLOB NOT NULL,\r
    Uname TINYBLOB NOT NULL,      /* full uname -a of client */\r
    AutoPrune TINYINT DEFAULT 0,\r
-   FileRetention BIGINT UNSIGNED NOT NULL,\r
-   JobRetention  BIGINT UNSIGNED NOT NULL,\r
+   FileRetention BIGINT UNSIGNED DEFAULT 0,\r
+   JobRetention  BIGINT UNSIGNED DEFAULT 0,\r
    UNIQUE (Name(128)),\r
    PRIMARY KEY(ClientId)\r
    );\r
 \r
+CREATE TABLE Log (\r
+   LogId INTEGER UNSIGNED AUTO_INCREMENT,\r
+   JobId INTEGER UNSIGNED DEFAULT 0 REFERENCES Job,\r
+   Time DATETIME DEFAULT 0,\r
+   LogText BLOB NOT NULL,\r
+   PRIMARY KEY(LogId),\r
+   INDEX (JobId)\r
+   );\r
+\r
+\r
 CREATE TABLE BaseFiles (\r
    BaseId INTEGER UNSIGNED AUTO_INCREMENT,\r
    BaseJobId INTEGER UNSIGNED NOT NULL REFERENCES Job,\r
@@ -261,9 +279,9 @@ CREATE TABLE UnsavedFiles (
 \r
 CREATE TABLE Counters (\r
    Counter TINYBLOB NOT NULL,\r
-   MinValue INTEGER,\r
-   MaxValue INTEGER,\r
-   CurrentValue INTEGER,\r
+   MinValue INTEGER DEFAULT 0,\r
+   MaxValue INTEGER DEFAULT 0,\r
+   CurrentValue INTEGER DEFAULT 0,\r
    WrapCounter TINYBLOB NOT NULL,\r
    PRIMARY KEY (Counter(128))\r
    );\r
@@ -306,4 +324,4 @@ CREATE TABLE Version (
    );\r
 \r
 -- Initialize Version           \r
-INSERT INTO Version (VersionId) VALUES (9);\r
+INSERT INTO Version (VersionId) VALUES (10);\r
index e94a3ab98de499c09fde47d7415ef1da421ca2b8..3baf987091ec3979869dae82437358c7bd89f4df 100644 (file)
@@ -1,18 +1,19 @@
+@echo off\r
 rem\r
 rem Script to update MySQL tables from version 1.38 to 1.39\r
 rem\r
-echo " "\r
-echo "This script will update a Bacula MySQL database from version 9 to 9"\r
-echo "Depending on the size of your database,"\r
-echo "this script may take several minutes to run."\r
-echo " "\r
+echo.\r
+echo This script will update a Bacula MySQL database from version 9 to 10\r
+echo Depending on the size of your database,\r
+echo this script may take several minutes to run.\r
+echo.\r
 \r
-if %SQL_BINDIR%/mysql $* -f < update_mysql_tables.sql\r
+"%SQL_BINDIR%\mysql" %* -f -u bacula --password=bacula bacula < update_mysql_tables.sql\r
 set RESULT=%ERRORLEVEL%\r
 if %RESULT% GTR 0 goto :ERROR\r
 echo "Update of Bacula MySQL tables succeeded."\r
 exit /b 0\r
 \r
 :ERROR\r
-echo "Update of Bacula MySQL tables failed."\r
+echo Update of Bacula MySQL tables failed.\r
 exit /b %RESULT%\r
index c758097df5e7d63f181ae14b2e4c0e7e1e2c2df4..b48b885ec96de8dc32d51dbbd6a38dec5dccae94 100644 (file)
@@ -1,5 +1,39 @@
 USE bacula;\r
 \r
+DROP TABLE IF EXISTS MAC;\r
+DROP TABLE IF EXISTS Log;\r
+DROP TABLE IF EXISTS Location;\r
+DROP TABLE IF EXISTS LocationLog;\r
+\r
+CREATE TABLE Log (\r
+   LogId INTEGER UNSIGNED AUTO_INCREMENT,\r
+   JobId INTEGER UNSIGNED DEFAULT 0 REFERENCES Job,\r
+   Time DATETIME DEFAULT 0,\r
+   LogText BLOB NOT NULL,\r
+   PRIMARY KEY(LogId),\r
+   INDEX (JobId)\r
+   );\r
+\r
+CREATE TABLE Location (\r
+   LocationId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,\r
+   Location TINYBLOB NOT NULL,\r
+   Cost INTEGER DEFAULT 0,\r
+   Enabled TINYINT,\r
+   PRIMARY KEY(LocationId)\r
+   );\r
+\r
+CREATE TABLE LocationLog (\r
+   LocLogId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,\r
+   Date DATETIME DEFAULT 0,\r
+   Comment BLOB,\r
+   MediaId INTEGER UNSIGNED DEFAULT 0 REFERENCES Media,\r
+   LocationId INTEGER UNSIGNED DEFAULT 0 REFERENCES Location,\r
+   NewVolStatus ENUM('Full', 'Archive', 'Append', 'Recycle', 'Purged',\r
+    'Read-Only', 'Disabled', 'Error', 'Busy', 'Used', 'Cleaning') NOT NULL,\r
+   NewEnabled TINYINT,\r
+   PRIMARY KEY(LocLogId)\r
+);\r
+\r
 ALTER TABLE Media ADD COLUMN MediaTypeId INTEGER UNSIGNED DEFAULT 0 REFERENCES MediaType;\r
 ALTER TABLE Media ADD COLUMN DeviceId INTEGER UNSIGNED DEFAULT 0 REFERENCES Device;\r
 ALTER TABLE Media ADD COLUMN LocationId INTEGER UNSIGNED DEFAULT 0 REFERENCES Location;\r
@@ -7,26 +41,15 @@ ALTER TABLE Media ADD COLUMN RecycleCount INTEGER UNSIGNED DEFAULT 0;
 ALTER TABLE Media ADD COLUMN InitialWrite DATETIME DEFAULT 0;\r
 ALTER TABLE Media ADD COLUMN ScratchPoolId INTEGER UNSIGNED DEFAULT 0 REFERENCES Pool;\r
 ALTER TABLE Media ADD COLUMN RecyclePoolId INTEGER UNSIGNED DEFAULT 0 REFERENCES Pool;\r
+ALTER TABLE Media ADD COLUMN Enabled TINYINT DEFAULT 1;\r
+ALTER TABLE Media ADD COLUMN Comment BLOB;\r
 \r
+ALTER TABLE JobMedia DROP COLUMN Stripe;\r
 \r
-CREATE TABLE MAC (\r
-   JobId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,\r
-   OriginalJobId INTEGER UNSIGNED NOT NULL,\r
-   JobType BINARY(1) NOT NULL,\r
-   JobLevel BINARY(1) NOT NULL,\r
-   SchedTime DATETIME NOT NULL,\r
-   StartTime DATETIME NOT NULL,\r
-   EndTime DATETIME NOT NULL,\r
-   JobTDate BIGINT UNSIGNED NOT NULL,\r
-   PRIMARY KEY(JobId)\r
-   );\r
+ALTER TABLE Job ADD COLUMN PriorJobId INTEGER UNSIGNED DEFAULT 0 REFERENCES Job;\r
+ALTER TABLE Job ADD COLUMN RealEndTime DATETIME DEFAULT 0;\r
 \r
-CREATE TABLE Location (\r
-   LocationId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,\r
-   Location TINYBLOB NOT NULL,\r
-   PRIMARY KEY(LocationId)\r
-   );\r
 \r
 \r
 DELETE FROM Version;\r
-INSERT INTO Version (VersionId) VALUES (9);\r
+INSERT INTO Version (VersionId) VALUES (10);\r
index c50661d15c8b0072fe04e1d6150b36d02fb17ff9..5882733306725bd664310e4b63bb6aed1a964c65 100644 (file)
@@ -51,8 +51,8 @@
                                UsePrecompiledHeader="0"\r
                                BrowseInformation="1"\r
                                WarningLevel="3"\r
-                               Detect64BitPortabilityProblems="false"\r
                                SuppressStartupBanner="true"\r
+                               Detect64BitPortabilityProblems="false"\r
                                DebugInformationFormat="4"\r
                        />\r
                        <Tool\r
                                EnableFunctionLevelLinking="true"\r
                                BrowseInformation="1"\r
                                WarningLevel="3"\r
-                               Detect64BitPortabilityProblems="false"\r
                                SuppressStartupBanner="true"\r
+                               Detect64BitPortabilityProblems="false"\r
                                DebugInformationFormat="3"\r
                        />\r
                        <Tool\r
                                RelativePath="..\..\dird\admin.c"\r
                                >\r
                                <FileConfiguration\r
-                                       Name="Release|Win32"\r
+                                       Name="Debug|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                        />\r
                                </FileConfiguration>\r
                                <FileConfiguration\r
-                                       Name="Debug|Win32"\r
+                                       Name="Release|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                RelativePath="..\..\dird\authenticate.c"\r
                                >\r
                                <FileConfiguration\r
-                                       Name="Release|Win32"\r
+                                       Name="Debug|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                        />\r
                                </FileConfiguration>\r
                                <FileConfiguration\r
-                                       Name="Debug|Win32"\r
+                                       Name="Release|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                RelativePath="..\..\dird\autoprune.c"\r
                                >\r
                                <FileConfiguration\r
-                                       Name="Release|Win32"\r
+                                       Name="Debug|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                        />\r
                                </FileConfiguration>\r
                                <FileConfiguration\r
-                                       Name="Debug|Win32"\r
+                                       Name="Release|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                RelativePath="..\..\dird\backup.c"\r
                                >\r
                                <FileConfiguration\r
-                                       Name="Release|Win32"\r
+                                       Name="Debug|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                        />\r
                                </FileConfiguration>\r
                                <FileConfiguration\r
-                                       Name="Debug|Win32"\r
+                                       Name="Release|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                RelativePath="..\..\dird\bsr.c"\r
                                >\r
                                <FileConfiguration\r
-                                       Name="Release|Win32"\r
+                                       Name="Debug|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                        />\r
                                </FileConfiguration>\r
                                <FileConfiguration\r
-                                       Name="Debug|Win32"\r
+                                       Name="Release|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                RelativePath="..\..\dird\catreq.c"\r
                                >\r
                                <FileConfiguration\r
-                                       Name="Release|Win32"\r
+                                       Name="Debug|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                        />\r
                                </FileConfiguration>\r
                                <FileConfiguration\r
-                                       Name="Debug|Win32"\r
+                                       Name="Release|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                RelativePath="..\..\dird\dird.c"\r
                                >\r
                                <FileConfiguration\r
-                                       Name="Release|Win32"\r
+                                       Name="Debug|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                        />\r
                                </FileConfiguration>\r
                                <FileConfiguration\r
-                                       Name="Debug|Win32"\r
+                                       Name="Release|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                RelativePath="..\..\dird\dird_conf.c"\r
                                >\r
                                <FileConfiguration\r
-                                       Name="Release|Win32"\r
+                                       Name="Debug|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                        />\r
                                </FileConfiguration>\r
                                <FileConfiguration\r
-                                       Name="Debug|Win32"\r
+                                       Name="Release|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                RelativePath="..\..\dird\expand.c"\r
                                >\r
                                <FileConfiguration\r
-                                       Name="Release|Win32"\r
+                                       Name="Debug|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                        />\r
                                </FileConfiguration>\r
                                <FileConfiguration\r
-                                       Name="Debug|Win32"\r
+                                       Name="Release|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                RelativePath="..\..\dird\fd_cmds.c"\r
                                >\r
                                <FileConfiguration\r
-                                       Name="Release|Win32"\r
+                                       Name="Debug|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                        />\r
                                </FileConfiguration>\r
                                <FileConfiguration\r
-                                       Name="Debug|Win32"\r
+                                       Name="Release|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                RelativePath="..\..\dird\getmsg.c"\r
                                >\r
                                <FileConfiguration\r
-                                       Name="Release|Win32"\r
+                                       Name="Debug|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                        />\r
                                </FileConfiguration>\r
                                <FileConfiguration\r
-                                       Name="Debug|Win32"\r
+                                       Name="Release|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                RelativePath="..\..\dird\inc_conf.c"\r
                                >\r
                                <FileConfiguration\r
-                                       Name="Release|Win32"\r
+                                       Name="Debug|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                        />\r
                                </FileConfiguration>\r
                                <FileConfiguration\r
-                                       Name="Debug|Win32"\r
+                                       Name="Release|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                RelativePath="..\..\dird\job.c"\r
                                >\r
                                <FileConfiguration\r
-                                       Name="Release|Win32"\r
+                                       Name="Debug|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                        />\r
                                </FileConfiguration>\r
                                <FileConfiguration\r
-                                       Name="Debug|Win32"\r
+                                       Name="Release|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                RelativePath="..\..\dird\jobq.c"\r
                                >\r
                                <FileConfiguration\r
-                                       Name="Release|Win32"\r
+                                       Name="Debug|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                        />\r
                                </FileConfiguration>\r
                                <FileConfiguration\r
-                                       Name="Debug|Win32"\r
+                                       Name="Release|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                RelativePath="..\..\dird\migrate.c"\r
                                >\r
                                <FileConfiguration\r
-                                       Name="Release|Win32"\r
+                                       Name="Debug|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                        />\r
                                </FileConfiguration>\r
                                <FileConfiguration\r
-                                       Name="Debug|Win32"\r
+                                       Name="Release|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                RelativePath="..\..\dird\mountreq.c"\r
                                >\r
                                <FileConfiguration\r
-                                       Name="Release|Win32"\r
+                                       Name="Debug|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                        />\r
                                </FileConfiguration>\r
                                <FileConfiguration\r
-                                       Name="Debug|Win32"\r
+                                       Name="Release|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                RelativePath="..\..\dird\msgchan.c"\r
                                >\r
                                <FileConfiguration\r
-                                       Name="Release|Win32"\r
+                                       Name="Debug|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                        />\r
                                </FileConfiguration>\r
                                <FileConfiguration\r
-                                       Name="Debug|Win32"\r
+                                       Name="Release|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                RelativePath="..\..\dird\newvol.c"\r
                                >\r
                                <FileConfiguration\r
-                                       Name="Release|Win32"\r
+                                       Name="Debug|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                        />\r
                                </FileConfiguration>\r
                                <FileConfiguration\r
-                                       Name="Debug|Win32"\r
+                                       Name="Release|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                RelativePath="..\..\dird\next_vol.c"\r
                                >\r
                                <FileConfiguration\r
-                                       Name="Release|Win32"\r
+                                       Name="Debug|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                        />\r
                                </FileConfiguration>\r
                                <FileConfiguration\r
-                                       Name="Debug|Win32"\r
+                                       Name="Release|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                RelativePath="..\..\dird\pythondir.c"\r
                                >\r
                                <FileConfiguration\r
-                                       Name="Release|Win32"\r
+                                       Name="Debug|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                        />\r
                                </FileConfiguration>\r
                                <FileConfiguration\r
-                                       Name="Debug|Win32"\r
+                                       Name="Release|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                RelativePath="..\..\dird\recycle.c"\r
                                >\r
                                <FileConfiguration\r
-                                       Name="Release|Win32"\r
+                                       Name="Debug|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                        />\r
                                </FileConfiguration>\r
                                <FileConfiguration\r
-                                       Name="Debug|Win32"\r
+                                       Name="Release|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                RelativePath="..\..\dird\restore.c"\r
                                >\r
                                <FileConfiguration\r
-                                       Name="Release|Win32"\r
+                                       Name="Debug|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                        />\r
                                </FileConfiguration>\r
                                <FileConfiguration\r
-                                       Name="Debug|Win32"\r
+                                       Name="Release|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                RelativePath="..\..\dird\run_conf.c"\r
                                >\r
                                <FileConfiguration\r
-                                       Name="Release|Win32"\r
+                                       Name="Debug|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                        />\r
                                </FileConfiguration>\r
                                <FileConfiguration\r
-                                       Name="Debug|Win32"\r
+                                       Name="Release|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                RelativePath="..\..\dird\scheduler.c"\r
                                >\r
                                <FileConfiguration\r
-                                       Name="Release|Win32"\r
+                                       Name="Debug|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                        />\r
                                </FileConfiguration>\r
                                <FileConfiguration\r
-                                       Name="Debug|Win32"\r
+                                       Name="Release|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                RelativePath="..\..\dird\ua_acl.c"\r
                                >\r
                                <FileConfiguration\r
-                                       Name="Release|Win32"\r
+                                       Name="Debug|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                        />\r
                                </FileConfiguration>\r
                                <FileConfiguration\r
-                                       Name="Debug|Win32"\r
+                                       Name="Release|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                RelativePath="..\..\dird\ua_cmds.c"\r
                                >\r
                                <FileConfiguration\r
-                                       Name="Release|Win32"\r
+                                       Name="Debug|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                        />\r
                                </FileConfiguration>\r
                                <FileConfiguration\r
-                                       Name="Debug|Win32"\r
+                                       Name="Release|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                RelativePath="..\..\dird\ua_dotcmds.c"\r
                                >\r
                                <FileConfiguration\r
-                                       Name="Release|Win32"\r
+                                       Name="Debug|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                        />\r
                                </FileConfiguration>\r
                                <FileConfiguration\r
-                                       Name="Debug|Win32"\r
+                                       Name="Release|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                RelativePath="..\..\dird\ua_input.c"\r
                                >\r
                                <FileConfiguration\r
-                                       Name="Release|Win32"\r
+                                       Name="Debug|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                        />\r
                                </FileConfiguration>\r
                                <FileConfiguration\r
-                                       Name="Debug|Win32"\r
+                                       Name="Release|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                RelativePath="..\..\dird\ua_label.c"\r
                                >\r
                                <FileConfiguration\r
-                                       Name="Release|Win32"\r
+                                       Name="Debug|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                        />\r
                                </FileConfiguration>\r
                                <FileConfiguration\r
-                                       Name="Debug|Win32"\r
+                                       Name="Release|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                RelativePath="..\..\dird\ua_output.c"\r
                                >\r
                                <FileConfiguration\r
-                                       Name="Release|Win32"\r
+                                       Name="Debug|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                        />\r
                                </FileConfiguration>\r
                                <FileConfiguration\r
-                                       Name="Debug|Win32"\r
+                                       Name="Release|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                RelativePath="..\..\dird\ua_prune.c"\r
                                >\r
                                <FileConfiguration\r
-                                       Name="Release|Win32"\r
+                                       Name="Debug|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                        />\r
                                </FileConfiguration>\r
                                <FileConfiguration\r
-                                       Name="Debug|Win32"\r
+                                       Name="Release|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                RelativePath="..\..\dird\ua_purge.c"\r
                                >\r
                                <FileConfiguration\r
-                                       Name="Release|Win32"\r
+                                       Name="Debug|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                        />\r
                                </FileConfiguration>\r
                                <FileConfiguration\r
-                                       Name="Debug|Win32"\r
+                                       Name="Release|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                RelativePath="..\..\dird\ua_query.c"\r
                                >\r
                                <FileConfiguration\r
-                                       Name="Release|Win32"\r
+                                       Name="Debug|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                        />\r
                                </FileConfiguration>\r
                                <FileConfiguration\r
-                                       Name="Debug|Win32"\r
+                                       Name="Release|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                RelativePath="..\..\dird\ua_restore.c"\r
                                >\r
                                <FileConfiguration\r
-                                       Name="Release|Win32"\r
+                                       Name="Debug|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                        />\r
                                </FileConfiguration>\r
                                <FileConfiguration\r
-                                       Name="Debug|Win32"\r
+                                       Name="Release|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                RelativePath="..\..\dird\ua_run.c"\r
                                >\r
                                <FileConfiguration\r
-                                       Name="Release|Win32"\r
+                                       Name="Debug|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                        />\r
                                </FileConfiguration>\r
                                <FileConfiguration\r
-                                       Name="Debug|Win32"\r
+                                       Name="Release|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                RelativePath="..\..\dird\ua_select.c"\r
                                >\r
                                <FileConfiguration\r
-                                       Name="Release|Win32"\r
+                                       Name="Debug|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                        />\r
                                </FileConfiguration>\r
                                <FileConfiguration\r
-                                       Name="Debug|Win32"\r
+                                       Name="Release|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                RelativePath="..\..\dird\ua_server.c"\r
                                >\r
                                <FileConfiguration\r
-                                       Name="Release|Win32"\r
+                                       Name="Debug|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                        />\r
                                </FileConfiguration>\r
                                <FileConfiguration\r
-                                       Name="Debug|Win32"\r
+                                       Name="Release|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                RelativePath="..\..\dird\ua_status.c"\r
                                >\r
                                <FileConfiguration\r
-                                       Name="Release|Win32"\r
+                                       Name="Debug|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                        />\r
                                </FileConfiguration>\r
                                <FileConfiguration\r
-                                       Name="Debug|Win32"\r
+                                       Name="Release|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                RelativePath="..\..\dird\ua_tree.c"\r
                                >\r
                                <FileConfiguration\r
-                                       Name="Release|Win32"\r
+                                       Name="Debug|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                        />\r
                                </FileConfiguration>\r
                                <FileConfiguration\r
-                                       Name="Debug|Win32"\r
+                                       Name="Release|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                RelativePath="..\..\dird\ua_update.c"\r
                                >\r
                                <FileConfiguration\r
-                                       Name="Release|Win32"\r
+                                       Name="Debug|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                        />\r
                                </FileConfiguration>\r
                                <FileConfiguration\r
-                                       Name="Debug|Win32"\r
+                                       Name="Release|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                RelativePath="..\..\dird\verify.c"\r
                                >\r
                                <FileConfiguration\r
-                                       Name="Release|Win32"\r
+                                       Name="Debug|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                        />\r
                                </FileConfiguration>\r
                                <FileConfiguration\r
-                                       Name="Debug|Win32"\r
+                                       Name="Release|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
index 22c655f602775587edba86b98afc4aae12820391..0e6960284862c650b71108402439f64c1e413fa6 100644 (file)
@@ -49,22 +49,19 @@ extern int BaculaAppMain();
 extern void LogErrorMsg(char *msg);
 
 // Standard command-line flag definitions
+const char BaculaSilent[]                = "/silent";
+
 const char BaculaRunService[]            = "/service";
-const char BaculaRunServiceHelper[]      = "/servicehelper";
 const char BaculaRunAsUserApp[]          = "/run";
+const char BaculaKillRunningCopy[]       = "/kill";
 
 const char BaculaInstallService[]        = "/install";
 const char BaculaRemoveService[]         = "/remove";
 
-const char BaculaShowAbout[]             = "/about";
-const char BaculaShowStatus[]            = "/status";
-const char BaculaShowEvents[]            = "/events";
-const char BaculaKillRunningCopy[]       = "/kill";
-
 const char BaculaShowHelp[]              = "/help";
 
 // Usage string
-const char BaculaUsageText[] = "Bacula [/run] [/kill] [/install] [/remove] [/about] [/status] [/events]\n";
+const char BaculaUsageText[] = "Bacula [/silent] [/service] [/run] [/kill] [/install] [/remove] [/help]\n";
 
 void LogErrorMsg(char *msg, char *fname, int lineno);
 #define log_error_message(msg) LogErrorMsg((msg), __FILE__, __LINE__)
index 12eec7029037db760fab4401c901aeb659b1df10..a3f680eaf2f64a9a4301aa850ef8fb41f59cbb66 100644 (file)
@@ -55,6 +55,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
    char *szCmdLine = CmdLine;
    char *wordPtr, *tempPtr;
    int i, quote;
+   DWORD dwCharsWritten;
 
    /* Save the application instance and main thread id */
    hAppInstance = hInstance;
@@ -83,7 +84,6 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
    if (*szCmdLine != '"' && *wordPtr == '"') {
       szCmdLine = wordPtr + 1;
    }
-// MessageBox(NULL, szCmdLine, "Cmdline", MB_OK);
 
    /* Build Unix style argc *argv[] */      
 
@@ -133,7 +133,6 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
    /*
     * Now process Windows command line options
     */
-   bool argfound = false;
    for (i = 0; i < (int)strlen(szCmdLine); i++) {
       if (szCmdLine[i] <= ' ') {
          continue;
@@ -143,69 +142,67 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
          break;
       }
 
-      argfound = true;
-
       /* Now check for command-line arguments */
 
       /* /silent install quietly -- no prompts */
-      if (strnicmp(&szCmdLine[i], "/silent", strlen("/silent")) == 0) {
+      if (strnicmp(&szCmdLine[i], BaculaSilent, sizeof(BaculaSilent) - 1) == 0) {
          silent = true;
-         i += strlen("/silent");
+         i += sizeof(BaculaSilent) - 1;
          continue;
       }
 
       /* /service start service */
-      if (strnicmp(&szCmdLine[i], BaculaRunService, strlen(BaculaRunService)) == 0) {
+      if (strnicmp(&szCmdLine[i], BaculaRunService, sizeof(BaculaRunService) - 1) == 0) {
          /* Run Bacula as a service */
          return bacService::BaculaServiceMain();
       }
       /* /run  (this is the default if no command line arguments) */
-      if (strnicmp(&szCmdLine[i], BaculaRunAsUserApp, strlen(BaculaRunAsUserApp)) == 0) {
+      if (strnicmp(&szCmdLine[i], BaculaRunAsUserApp, sizeof(BaculaRunAsUserApp) - 1) == 0) {
          /* Bacula is being run as a user-level program */
+         if (!AttachConsole(ATTACH_PARENT_PROCESS)) {
+            AllocConsole();
+         }
+         WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE), "\r\n", 2, &dwCharsWritten, NULL);
+
          return BaculaAppMain();
       }
       /* /install */
-      if (strnicmp(&szCmdLine[i], BaculaInstallService, strlen(BaculaInstallService)) == 0) {
+      if (strnicmp(&szCmdLine[i], BaculaInstallService, sizeof(BaculaInstallService) - 1) == 0) {
          /* Install Bacula as a service */
-         bacService::InstallService(&szCmdLine[i + strlen(BaculaInstallService)]);
-         i += strlen(BaculaInstallService);
-         continue;
+         return bacService::InstallService(&szCmdLine[i + sizeof(BaculaInstallService) - 1]);
       }
       /* /remove */
-      if (strnicmp(&szCmdLine[i], BaculaRemoveService, strlen(BaculaRemoveService)) == 0) {
+      if (strnicmp(&szCmdLine[i], BaculaRemoveService, sizeof(BaculaRemoveService) - 1) == 0) {
          /* Remove the Bacula service */
-         bacService::RemoveService();
-         i += strlen(BaculaRemoveService);
-         continue;
+         return bacService::RemoveService();
       }
 
       /* /kill */
-      if (strnicmp(&szCmdLine[i], BaculaKillRunningCopy, strlen(BaculaKillRunningCopy)) == 0) {
+      if (strnicmp(&szCmdLine[i], BaculaKillRunningCopy, sizeof(BaculaKillRunningCopy) - 1) == 0) {
          /* Kill running copy of Bacula */
-         bacService::KillRunningCopy();
-         i += strlen(BaculaKillRunningCopy);
-         continue;
+         return bacService::KillRunningCopy() ? 0 : 1;
       }
 
       /* /help */
-      if (strnicmp(&szCmdLine[i], BaculaShowHelp, strlen(BaculaShowHelp)) == 0) {
+      if (strnicmp(&szCmdLine[i], BaculaShowHelp, sizeof(BaculaShowHelp) - 1) == 0) {
          MessageBox(NULL, BaculaUsageText, _("Bacula Usage"), MB_OK|MB_ICONINFORMATION);
-         i += strlen(BaculaShowHelp);
-         continue;
+         return 0;
       }
       
       MessageBox(NULL, szCmdLine, _("Bad Command Line Options"), MB_OK);
 
       /* Show the usage dialog */
       MessageBox(NULL, BaculaUsageText, _("Bacula Usage"), MB_OK | MB_ICONINFORMATION);
-      break;
+      return 1;
    }
 
    /* If no arguments were given then just run */
-   if (!argfound) {
-      BaculaAppMain();
+   if (!AttachConsole(ATTACH_PARENT_PROCESS)) {
+      AllocConsole();
    }
-   return 0;
+   WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE), "\r\n", 2, &dwCharsWritten, NULL);
+
+   return BaculaAppMain();
 }
 
 
@@ -218,7 +215,6 @@ void *Main_Msg_Loop(LPVOID lpwThreadParam)
 {
    DWORD old_servicethread = g_servicethread;
 
-
    pthread_detach(pthread_self());
 
    /* Since we are the only thread with a message loop
@@ -272,15 +268,6 @@ int BaculaAppMain()
       p_SetProcessShutdownParameters(0x100, 0);
    }
 
-#if 0
-   HWND hservwnd = FindWindow(MENU_CLASS_NAME, NULL);
-   if (hservwnd != NULL) {
-      /* We don't allow multiple instances! */
-      MessageBox(NULL, _("Another instance of Bacula is already running"), szAppName, MB_OK);
-      _exit(0);
-   }
-#endif
-
    /* Create a thread to handle the Windows messages */
    pthread_create(&tid, NULL,  Main_Msg_Loop, (void *)0);
 
index 0b3188a67d68a6fc4544ee511f3c92daed48b668..2ac1bf3aa83723f14b553718a37f5e342c264905 100644 (file)
@@ -51,8 +51,8 @@
                                UsePrecompiledHeader="0"\r
                                BrowseInformation="1"\r
                                WarningLevel="3"\r
-                               Detect64BitPortabilityProblems="false"\r
                                SuppressStartupBanner="true"\r
+                               Detect64BitPortabilityProblems="false"\r
                                DebugInformationFormat="4"\r
                        />\r
                        <Tool\r
                                UsePrecompiledHeader="0"\r
                                BrowseInformation="1"\r
                                WarningLevel="3"\r
-                               Detect64BitPortabilityProblems="false"\r
                                SuppressStartupBanner="true"\r
+                               Detect64BitPortabilityProblems="false"\r
                                DebugInformationFormat="3"\r
                        />\r
                        <Tool\r
                                RelativePath="..\..\filed\acl.c"\r
                                >\r
                                <FileConfiguration\r
-                                       Name="Release|Win32"\r
+                                       Name="Debug|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                        />\r
                                </FileConfiguration>\r
                                <FileConfiguration\r
-                                       Name="Debug|Win32"\r
+                                       Name="Release|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                RelativePath="..\..\filed\authenticate.c"\r
                                >\r
                                <FileConfiguration\r
-                                       Name="Release|Win32"\r
+                                       Name="Debug|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                        />\r
                                </FileConfiguration>\r
                                <FileConfiguration\r
-                                       Name="Debug|Win32"\r
+                                       Name="Release|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                RelativePath="..\..\filed\backup.c"\r
                                >\r
                                <FileConfiguration\r
-                                       Name="Release|Win32"\r
+                                       Name="Debug|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                        />\r
                                </FileConfiguration>\r
                                <FileConfiguration\r
-                                       Name="Debug|Win32"\r
+                                       Name="Release|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                RelativePath="..\..\filed\estimate.c"\r
                                >\r
                                <FileConfiguration\r
-                                       Name="Release|Win32"\r
+                                       Name="Debug|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                        />\r
                                </FileConfiguration>\r
                                <FileConfiguration\r
-                                       Name="Debug|Win32"\r
+                                       Name="Release|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                RelativePath="..\..\filed\filed.c"\r
                                >\r
                                <FileConfiguration\r
-                                       Name="Release|Win32"\r
+                                       Name="Debug|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                        />\r
                                </FileConfiguration>\r
                                <FileConfiguration\r
-                                       Name="Debug|Win32"\r
+                                       Name="Release|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                RelativePath="..\..\filed\filed_conf.c"\r
                                >\r
                                <FileConfiguration\r
-                                       Name="Release|Win32"\r
+                                       Name="Debug|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                        />\r
                                </FileConfiguration>\r
                                <FileConfiguration\r
-                                       Name="Debug|Win32"\r
+                                       Name="Release|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                RelativePath="..\..\filed\heartbeat.c"\r
                                >\r
                                <FileConfiguration\r
-                                       Name="Release|Win32"\r
+                                       Name="Debug|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                        />\r
                                </FileConfiguration>\r
                                <FileConfiguration\r
-                                       Name="Debug|Win32"\r
+                                       Name="Release|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                RelativePath="..\..\filed\job.c"\r
                                >\r
                                <FileConfiguration\r
-                                       Name="Release|Win32"\r
+                                       Name="Debug|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                        />\r
                                </FileConfiguration>\r
                                <FileConfiguration\r
-                                       Name="Debug|Win32"\r
+                                       Name="Release|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                RelativePath="..\..\filed\pythonfd.c"\r
                                >\r
                                <FileConfiguration\r
-                                       Name="Release|Win32"\r
+                                       Name="Debug|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                        />\r
                                </FileConfiguration>\r
                                <FileConfiguration\r
-                                       Name="Debug|Win32"\r
+                                       Name="Release|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                RelativePath="..\..\filed\restore.c"\r
                                >\r
                                <FileConfiguration\r
-                                       Name="Release|Win32"\r
+                                       Name="Debug|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                        />\r
                                </FileConfiguration>\r
                                <FileConfiguration\r
-                                       Name="Debug|Win32"\r
+                                       Name="Release|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                RelativePath="..\..\filed\status.c"\r
                                >\r
                                <FileConfiguration\r
-                                       Name="Release|Win32"\r
+                                       Name="Debug|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                        />\r
                                </FileConfiguration>\r
                                <FileConfiguration\r
-                                       Name="Debug|Win32"\r
+                                       Name="Release|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                RelativePath="..\..\filed\verify.c"\r
                                >\r
                                <FileConfiguration\r
-                                       Name="Release|Win32"\r
+                                       Name="Debug|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                        />\r
                                </FileConfiguration>\r
                                <FileConfiguration\r
-                                       Name="Debug|Win32"\r
+                                       Name="Release|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                RelativePath="..\..\filed\verify_vol.c"\r
                                >\r
                                <FileConfiguration\r
-                                       Name="Release|Win32"\r
+                                       Name="Debug|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                        />\r
                                </FileConfiguration>\r
                                <FileConfiguration\r
-                                       Name="Debug|Win32"\r
+                                       Name="Release|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                RelativePath="..\libwin32\winabout.h"\r
                                >\r
                        </File>\r
+                       <File\r
+                               RelativePath="..\libwin32\winbacula.h"\r
+                               >\r
+                       </File>\r
                        <File\r
                                RelativePath="..\compat\winconfig.h"\r
                                >\r
index a6bf96034873ad9c7952d876dfbe38361b8ea579..85b941cc94b52e23b419a0a354ac10598f57a95f 100644 (file)
@@ -57,6 +57,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
    char *szCmdLine = CmdLine;
    char *wordPtr, *tempPtr;
    int i, quote;
+   DWORD dwCharsWritten;
 
    /* Save the application instance and main thread id */
    hAppInstance = hInstance;
@@ -135,7 +136,6 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
    /*
     * Now process Windows command line options
     */
-   bool argfound = false;
    for (i = 0; i < (int)strlen(szCmdLine); i++) {
       if (szCmdLine[i] <= ' ') {
          continue;
@@ -145,85 +145,80 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
          break;
       }
 
-      argfound = true;
-
       /* Now check for command-line arguments */
 
       /* /silent install quietly -- no prompts */
-      if (strnicmp(&szCmdLine[i], "/silent", strlen("/silent")) == 0) {
+      if (strnicmp(&szCmdLine[i], BaculaSilent, sizeof(BaculaSilent) - 1) == 0) {
          silent = true;
-         i += strlen("/silent");
+         i += sizeof(BaculaSilent) - 1;
          continue;
       }
 
       /* /service start service */
-      if (strnicmp(&szCmdLine[i], BaculaRunService, strlen(BaculaRunService)) == 0) {
+      if (strnicmp(&szCmdLine[i], BaculaRunService, sizeof(BaculaRunService) - 1) == 0) {
          /* Run Bacula as a service */
          return bacService::BaculaServiceMain();
       }
       /* /run  (this is the default if no command line arguments) */
-      if (strnicmp(&szCmdLine[i], BaculaRunAsUserApp, strlen(BaculaRunAsUserApp)) == 0) {
+      if (strnicmp(&szCmdLine[i], BaculaRunAsUserApp, sizeof(BaculaRunAsUserApp) - 1) == 0) {
          /* Bacula is being run as a user-level program */
+         if (!AttachConsole(ATTACH_PARENT_PROCESS)) {
+            AllocConsole();
+         }
+         WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE), "\r\n", 2, &dwCharsWritten, NULL);
+
          return BaculaAppMain();
       }
       /* /install */
-      if (strnicmp(&szCmdLine[i], BaculaInstallService, strlen(BaculaInstallService)) == 0) {
+      if (strnicmp(&szCmdLine[i], BaculaInstallService, sizeof(BaculaInstallService) - 1) == 0) {
          /* Install Bacula as a service */
-         bacService::InstallService(&szCmdLine[i + strlen(BaculaInstallService)]);
-         i += strlen(BaculaInstallService);
-         continue;
+         return bacService::InstallService(&szCmdLine[i + sizeof(BaculaInstallService) - 1]);
       }
       /* /remove */
-      if (strnicmp(&szCmdLine[i], BaculaRemoveService, strlen(BaculaRemoveService)) == 0) {
+      if (strnicmp(&szCmdLine[i], BaculaRemoveService, sizeof(BaculaRemoveService) - 1) == 0) {
          /* Remove the Bacula service */
-         bacService::RemoveService();
-         i += strlen(BaculaRemoveService);
-         continue;
+         return bacService::RemoveService();
       }
 
       /* /about */
-      if (strnicmp(&szCmdLine[i], BaculaShowAbout, strlen(BaculaShowAbout)) == 0) {
+      if (strnicmp(&szCmdLine[i], BaculaShowAbout, sizeof(BaculaShowAbout) - 1) == 0) {
          /* Show Bacula's about box */
-         bacService::ShowAboutBox();
-         i += strlen(BaculaShowAbout);
-         continue;
+         return bacService::ShowAboutBox();
       }
 
       /* /status */
-      if (strnicmp(&szCmdLine[i], BaculaShowStatus, strlen(BaculaShowStatus)) == 0) {
+      if (strnicmp(&szCmdLine[i], BaculaShowStatus, sizeof(BaculaShowStatus) - 1) == 0) {
          /* Show Bacula's status box */                             
-         bacService::ShowStatus();
-         i += strlen(BaculaShowStatus);
-         continue;
+         return bacService::ShowStatus();
       }
 
       /* /kill */
-      if (strnicmp(&szCmdLine[i], BaculaKillRunningCopy, strlen(BaculaKillRunningCopy)) == 0) {
+      if (strnicmp(&szCmdLine[i], BaculaKillRunningCopy, sizeof(BaculaKillRunningCopy) - 1) == 0) {
          /* Kill running copy of Bacula */
-         bacService::KillRunningCopy();
-         i += strlen(BaculaKillRunningCopy);
-         continue;
+         return bacService::KillRunningCopy();
       }
 
       /* /help */
-      if (strnicmp(&szCmdLine[i], BaculaShowHelp, strlen(BaculaShowHelp)) == 0) {
+      if (strnicmp(&szCmdLine[i], BaculaShowHelp, sizeof(BaculaShowHelp) - 1) == 0) {
          MessageBox(NULL, BaculaUsageText, _("Bacula Usage"), MB_OK|MB_ICONINFORMATION);
-         i += strlen(BaculaShowHelp);
-         continue;
+         return 0;
       }
       
       MessageBox(NULL, szCmdLine, _("Bad Command Line Options"), MB_OK);
 
       /* Show the usage dialog */
       MessageBox(NULL, BaculaUsageText, _("Bacula Usage"), MB_OK | MB_ICONINFORMATION);
-      break;
+
+      return 1;
    }
 
    /* If no arguments were given then just run */
-   if (!argfound) {
-      BaculaAppMain();
+   if (!AttachConsole(ATTACH_PARENT_PROCESS)) {
+      AllocConsole();
    }
-   return 0;
+   WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE), "\r\n", 2, &dwCharsWritten, NULL);
+
+   return BaculaAppMain();
 }
 
 
index 52a6d6492276f6dda79278a32623f29565e98f94..0ed0dfae330a9cb3cdff50d81503279951c65ecd 100644 (file)
@@ -39,7 +39,7 @@ JobDefs {
 
 #
 # Define the main nightly save backup job
-#   By default, this job will back up to disk in /tmp
+#   By default, this job will back up to disk in C:/tmp
 Job {
   Name = "Client1"
   JobDefs = "DefaultJob"
@@ -48,7 +48,7 @@ Job {
 
 #Job {
 #  Name = "Client2"
-#  Client = @client_address@2-fd
+#  Client = @client_name@2
 #  JobDefs = "DefaultJob"
 #  Write Bootstrap = "@working_dir@\\Client2.bsr"
 #}
@@ -61,9 +61,9 @@ Job {
   FileSet="Catalog"
   Schedule = "WeeklyCycleAfterBackup"
   # This creates an ASCII copy of the catalog
-  RunBeforeJob = "@bin_dir@\\make_catalog_backup bacula bacula"
+  RunBeforeJob = "\"@bin_dir@\\make_catalog_backup\" bacula bacula"
   # This deletes the copy of the catalog
-  RunAfterJob  = "@bin_dir@\\delete_catalog_backup"
+  RunAfterJob  = "\"@bin_dir@\\delete_catalog_backup\""
   Write Bootstrap = "@working_dir@\\BackupCatalog.bsr"
   Priority = 11                   # run after main backup
 }
@@ -80,7 +80,7 @@ Job {
   Storage = File
   Pool = Default
   Messages = Standard
-  Where = /tmp/bacula-restores
+  Where = C:\\tmp\\bacula-restores
 }
 
 
@@ -179,7 +179,7 @@ Client {
 # Definition of file storage device
 Storage {
   Name = File
-# Do not use "localhost" here    
+# Do not use "localhost" here
   Address = @storage_address@                # N.B. Use a fully qualified name here
   SDPort = @storage_port@
   Password = "@storage_password@"
@@ -212,17 +212,6 @@ Storage {
 #  MediaType = "8mm"
 #}
 
-# Definition of DVD storage device
-#Storage {
-#  Name = "DVD"
-#  Do not use "localhost" here
-#  Address = @storage_address@                # N.B. Use a fully qualified name here
-#  SDPort = @storage_port@
-#  Password = "@storage_password@"
-#  Device = "DVD Writer"
-#  MediaType = "DVD"
-#}
-
 
 # Generic catalog service
 Catalog {
@@ -239,8 +228,8 @@ Messages {
 #  to replace the %r in the from field (-f part) with a single valid
 #  email address in both the mailcommand and the operatorcommand.
 #
-  mailcommand = "@bin_dir@\\bsmtp -h @smtp_host@ -f \"\(Bacula\) %r\" -s \"Bacula: %t %e of %c %l\" %r"
-  operatorcommand = "@bin_dir@\\bsmtp -h @smtp_host@ -f \"\(Bacula\) %r\" -s \"Bacula: Intervention needed for %j\" %r"
+  mailcommand = "\"@bin_dir@\\bsmtp\" -h @smtp_host@ -f \"\(Bacula\) %r\" -s \"Bacula: %t %e of %c %l\" %r"
+  operatorcommand = "\"@bin_dir@\\bsmtp\" -h @smtp_host@ -f \"\(Bacula\) %r\" -s \"Bacula: Intervention needed for %j\" %r"
   mail = @job_email@ = all, !skipped            
   operator = @job_email@ = mount
   console = all, !skipped, !saved
@@ -257,7 +246,7 @@ Messages {
 # Message delivery for daemon messages (no job).
 Messages {
   Name = Daemon
-  mailcommand = "@bin_dir@\\bsmtp -h @smtp_host@ -f \"\(Bacula\) %r\" -s \"Bacula daemon message\" %r"
+  mailcommand = "\"@bin_dir@\\bsmtp\" -h @smtp_host@ -f \"\(Bacula\) %r\" -s \"Bacula daemon message\" %r"
   mail = @job_email@ = all, !skipped            
   console = all, !skipped, !saved
   append = "@working_dir@\\log" = all, !skipped
index c403c810c0e1b60eac59ff59d22a072b8f519ad3..565076f9e73e65c9f195ef3535bdc033e48fba1b 100644 (file)
@@ -345,6 +345,10 @@ Function InstallCommonFiles
     File "${DEPKGS_BIN}\pthreadVCE.dll"
 !endif
 !if "${BUILD_TOOLS}" == "VC8_DEBUG"
+    File "${VC_REDIST_DIR}\msvcm80.dll"
+    File "${VC_REDIST_DIR}\msvcp80.dll"
+    File "${VC_REDIST_DIR}\msvcr80.dll"
+    File "${VC_REDIST_DIR}\Microsoft.VC80.CRT.manifest"
     File "${VC_REDIST_DIR}\msvcm80d.dll"
     File "${VC_REDIST_DIR}\msvcp80d.dll"
     File "${VC_REDIST_DIR}\msvcr80d.dll"
@@ -360,9 +364,14 @@ Function InstallCommonFiles
     File "${DEPKGS_BIN}\zlib1.dll"
 !if "${BUILD_TOOLS}" == "VC8"
     File "${DEPKGS_BIN}\zlib1.dll.manifest"
+    File "/oname=$INSTDIR\openssl.cnf" "${DEPKGS_BIN}\..\openssl.cnf"
 !endif
 !If "${BUILD_TOOLS}" == "VC8_DEBUG"
     File "${DEPKGS_BIN}\zlib1.dll.manifest"
+    File "/oname=$INSTDIR\openssl.cnf" "${DEPKGS_BIN}\..\openssl.cnf"
+!endif
+!if "${BUILD_TOOLS}" == "MinGW"
+    File "/oname=$INSTDIR\openssl.cnf" "${DEPKGS_BIN}\..\ssl\openssl.cnf"
 !endif
     File "${DEPKGS_BIN}\openssl.exe"
     File "${BACULA_BIN}\bsleep.exe"
index 22c655f602775587edba86b98afc4aae12820391..7968b1da6af86396bf78fd6b7cbe7c466316f824 100644 (file)
@@ -49,22 +49,22 @@ extern int BaculaAppMain();
 extern void LogErrorMsg(char *msg);
 
 // Standard command-line flag definitions
+const char BaculaSilent[]                = "/silent";
+
 const char BaculaRunService[]            = "/service";
-const char BaculaRunServiceHelper[]      = "/servicehelper";
 const char BaculaRunAsUserApp[]          = "/run";
+const char BaculaKillRunningCopy[]       = "/kill";
 
 const char BaculaInstallService[]        = "/install";
 const char BaculaRemoveService[]         = "/remove";
 
 const char BaculaShowAbout[]             = "/about";
 const char BaculaShowStatus[]            = "/status";
-const char BaculaShowEvents[]            = "/events";
-const char BaculaKillRunningCopy[]       = "/kill";
 
 const char BaculaShowHelp[]              = "/help";
 
 // Usage string
-const char BaculaUsageText[] = "Bacula [/run] [/kill] [/install] [/remove] [/about] [/status] [/events]\n";
+const char BaculaUsageText[] = "Bacula [/silent] [/service] [/run] [/kill] [/install] [/remove] [/about] [/status] [/help]\n";
 
 void LogErrorMsg(char *msg, char *fname, int lineno);
 #define log_error_message(msg) LogErrorMsg((msg), __FILE__, __LINE__)
index 22c655f602775587edba86b98afc4aae12820391..7968b1da6af86396bf78fd6b7cbe7c466316f824 100644 (file)
@@ -49,22 +49,22 @@ extern int BaculaAppMain();
 extern void LogErrorMsg(char *msg);
 
 // Standard command-line flag definitions
+const char BaculaSilent[]                = "/silent";
+
 const char BaculaRunService[]            = "/service";
-const char BaculaRunServiceHelper[]      = "/servicehelper";
 const char BaculaRunAsUserApp[]          = "/run";
+const char BaculaKillRunningCopy[]       = "/kill";
 
 const char BaculaInstallService[]        = "/install";
 const char BaculaRemoveService[]         = "/remove";
 
 const char BaculaShowAbout[]             = "/about";
 const char BaculaShowStatus[]            = "/status";
-const char BaculaShowEvents[]            = "/events";
-const char BaculaKillRunningCopy[]       = "/kill";
 
 const char BaculaShowHelp[]              = "/help";
 
 // Usage string
-const char BaculaUsageText[] = "Bacula [/run] [/kill] [/install] [/remove] [/about] [/status] [/events]\n";
+const char BaculaUsageText[] = "Bacula [/silent] [/service] [/run] [/kill] [/install] [/remove] [/about] [/status] [/help]\n";
 
 void LogErrorMsg(char *msg, char *fname, int lineno);
 #define log_error_message(msg) LogErrorMsg((msg), __FILE__, __LINE__)
index f40b947b5c915a2ed481f6b75bde36449a39e023..a42e02922052469923fb8ffcb5ef351fd4919f6e 100644 (file)
@@ -56,6 +56,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
    char *szCmdLine = CmdLine;
    char *wordPtr, *tempPtr;
    int i, quote;
+   DWORD dwCharsWritten;
 
    /* Save the application instance and main thread id */
    hAppInstance = hInstance;
@@ -84,7 +85,6 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
    if (*szCmdLine != '"' && *wordPtr == '"') {
       szCmdLine = wordPtr + 1;
    }
-// MessageBox(NULL, szCmdLine, "Cmdline", MB_OK);
 
    /* Build Unix style argc *argv[] */      
 
@@ -134,7 +134,6 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
    /*
     * Now process Windows command line options
     */
-   bool argfound = false;
    for (i = 0; i < (int)strlen(szCmdLine); i++) {
       if (szCmdLine[i] <= ' ') {
          continue;
@@ -144,85 +143,79 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
          break;
       }
 
-      argfound = true;
-
       /* Now check for command-line arguments */
 
       /* /silent install quietly -- no prompts */
-      if (strnicmp(&szCmdLine[i], "/silent", strlen("/silent")) == 0) {
+      if (strnicmp(&szCmdLine[i], BaculaSilent, sizeof(BaculaSilent) - 1) == 0) {
          silent = true;
-         i += strlen("/silent");
+         i += sizeof(BaculaSilent) - 1;
          continue;
       }
 
       /* /service start service */
-      if (strnicmp(&szCmdLine[i], BaculaRunService, strlen(BaculaRunService)) == 0) {
+      if (strnicmp(&szCmdLine[i], BaculaRunService, sizeof(BaculaRunService) - 1) == 0) {
          /* Run Bacula as a service */
          return bacService::BaculaServiceMain();
       }
       /* /run  (this is the default if no command line arguments) */
-      if (strnicmp(&szCmdLine[i], BaculaRunAsUserApp, strlen(BaculaRunAsUserApp)) == 0) {
+      if (strnicmp(&szCmdLine[i], BaculaRunAsUserApp, sizeof(BaculaRunAsUserApp) - 1) == 0) {
          /* Bacula is being run as a user-level program */
+         if (!AttachConsole(ATTACH_PARENT_PROCESS)) {
+            AllocConsole();
+         }
+         WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE), "\r\n", 2, &dwCharsWritten, NULL);
+
          return BaculaAppMain();
       }
       /* /install */
-      if (strnicmp(&szCmdLine[i], BaculaInstallService, strlen(BaculaInstallService)) == 0) {
+      if (strnicmp(&szCmdLine[i], BaculaInstallService, sizeof(BaculaInstallService) - 1) == 0) {
          /* Install Bacula as a service */
-         bacService::InstallService(&szCmdLine[i + strlen(BaculaInstallService)]);
-         i += strlen(BaculaInstallService);
-         continue;
+         return bacService::InstallService(&szCmdLine[i + sizeof(BaculaInstallService) - 1]);
       }
       /* /remove */
-      if (strnicmp(&szCmdLine[i], BaculaRemoveService, strlen(BaculaRemoveService)) == 0) {
+      if (strnicmp(&szCmdLine[i], BaculaRemoveService, sizeof(BaculaRemoveService) - 1) == 0) {
          /* Remove the Bacula service */
-         bacService::RemoveService();
-         i += strlen(BaculaRemoveService);
-         continue;
+         return bacService::RemoveService();
       }
 
       /* /about */
-      if (strnicmp(&szCmdLine[i], BaculaShowAbout, strlen(BaculaShowAbout)) == 0) {
+      if (strnicmp(&szCmdLine[i], BaculaShowAbout, sizeof(BaculaShowAbout) - 1) == 0) {
          /* Show Bacula's about box */
-         bacService::ShowAboutBox();
-         i += strlen(BaculaShowAbout);
-         continue;
+         return bacService::ShowAboutBox();
       }
 
       /* /status */
-      if (strnicmp(&szCmdLine[i], BaculaShowStatus, strlen(BaculaShowStatus)) == 0) {
+      if (strnicmp(&szCmdLine[i], BaculaShowStatus, sizeof(BaculaShowStatus) - 1) == 0) {
          /* Show Bacula's status box */                             
-         bacService::ShowStatus();
-         i += strlen(BaculaShowStatus);
-         continue;
+         return bacService::ShowStatus();
       }
 
       /* /kill */
-      if (strnicmp(&szCmdLine[i], BaculaKillRunningCopy, strlen(BaculaKillRunningCopy)) == 0) {
+      if (strnicmp(&szCmdLine[i], BaculaKillRunningCopy, sizeof(BaculaKillRunningCopy) - 1) == 0) {
          /* Kill running copy of Bacula */
-         bacService::KillRunningCopy();
-         i += strlen(BaculaKillRunningCopy);
-         continue;
+         return bacService::KillRunningCopy();
       }
 
       /* /help */
-      if (strnicmp(&szCmdLine[i], BaculaShowHelp, strlen(BaculaShowHelp)) == 0) {
+      if (strnicmp(&szCmdLine[i], BaculaShowHelp, sizeof(BaculaShowHelp) - 1) == 0) {
          MessageBox(NULL, BaculaUsageText, _("Bacula Usage"), MB_OK|MB_ICONINFORMATION);
-         i += strlen(BaculaShowHelp);
-         continue;
+         return 0;
       }
       
       MessageBox(NULL, szCmdLine, _("Bad Command Line Options"), MB_OK);
 
       /* Show the usage dialog */
       MessageBox(NULL, BaculaUsageText, _("Bacula Usage"), MB_OK | MB_ICONINFORMATION);
-      break;
+      return 1;
    }
 
    /* If no arguments were given then just run */
-   if (!argfound) {
-      BaculaAppMain();
+   if (!AttachConsole(ATTACH_PARENT_PROCESS)) {
+      AllocConsole();
    }
-   return 0;
+   WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE), "\r\n", 2, &dwCharsWritten, NULL);
+
+   return BaculaAppMain();
 }