From 01e39cc484e25fe776533399cd489f19e9d5d248 Mon Sep 17 00:00:00 2001 From: Philipp Storz Date: Tue, 18 Feb 2014 16:48:04 +0100 Subject: [PATCH] Last part in windows support, director on windows. This patch adds the things needed to cross-compile the director using MINGW on Linux. It adds the build infrastructure for building the database backend infrastructure (catalog) and the actual director and dbcheck for windows. It also adds the bsmtp binary in tools and the changes needed to the installer to install all new stuff. It does however not supply the database (postgresql or sqlite3) you need to install those before running the bareos-installer. Signed-off-by: Marco van Wieringen --- platforms/win32/fillup.sed | 22 +- platforms/win32/mingw-debugsrc-devel.spec | 48 +++ platforms/win32/tray-monitor-conf-fd-sd.patch | 6 +- platforms/win32/tray-monitor-conf.patch | 6 +- platforms/win32/winbareos-nsi.spec | 107 +++++- platforms/win32/winbareos.nsi | 359 ++++++++++++++++-- platforms/win32/winbareos32.spec | 39 +- platforms/win32/winbareos64.spec | 39 +- src/cats/bdb_priv.h | 2 +- src/cats/cats.h | 2 +- src/cats/cats_dynamic.c | 5 + src/cats/cats_dynamic.h | 4 +- src/cats/dbi.c | 24 +- src/cats/ingres.c | 24 +- src/cats/mysql.c | 24 +- src/cats/postgresql.c | 24 +- src/cats/sqlite.c | 24 +- src/dird/bareos-dir.conf.in | 2 +- src/include/baconfig.h | 7 +- src/win32/Makefile | 47 ++- src/win32/Makefile.inc | 12 +- src/win32/README.OBS | 4 + src/win32/cats/Makefile | 74 ++++ src/win32/cats/make_def | 61 +++ src/win32/compat/include/mingwconfig.h | 21 + src/win32/console/Makefile | 28 +- src/win32/console/consoleres.rc.in | 2 +- src/win32/dird/Makefile | 80 ++++ src/win32/dird/dbcheckres.rc.in | 31 ++ src/win32/dird/dirdres.rc.in | 31 ++ src/win32/dird/who.h | 31 ++ src/win32/filed/Makefile | 20 + src/win32/filed/who.h | 1 + src/win32/findlib/Makefile | 20 + src/win32/generic/service.c | 2 +- src/win32/lib/Makefile | 20 + src/win32/plugins/Makefile | 20 + src/win32/plugins/filed/Makefile | 38 +- src/win32/plugins/stored/Makefile | 20 + src/win32/stored/Makefile | 20 + src/win32/stored/who.h | 3 +- src/win32/tools/Makefile | 61 +++ src/win32/tools/bsmtpres.rc.in | 31 ++ 43 files changed, 1280 insertions(+), 166 deletions(-) create mode 100644 platforms/win32/mingw-debugsrc-devel.spec create mode 100644 src/win32/cats/Makefile create mode 100755 src/win32/cats/make_def create mode 100644 src/win32/dird/Makefile create mode 100644 src/win32/dird/dbcheckres.rc.in create mode 100644 src/win32/dird/dirdres.rc.in create mode 100644 src/win32/dird/who.h create mode 100644 src/win32/tools/Makefile create mode 100644 src/win32/tools/bsmtpres.rc.in diff --git a/platforms/win32/fillup.sed b/platforms/win32/fillup.sed index 66d1840e9a5..1f76fa808a4 100644 --- a/platforms/win32/fillup.sed +++ b/platforms/win32/fillup.sed @@ -9,5 +9,23 @@ s#@sd_password@#XXX_REPLACE_WITH_STORAGE_PASSWORD_XXX#g s#@dir_port@#9101#g s#@fd_port@#9102#g s#@sd_port@#9103#g -s#@plugindir@#"C:/Program Files/Bareos/Plugins"#g -s#@archivedir@#"C:/bareos-storage"#g +s#@plugindir@#C:/Program Files/Bareos/Plugins#g +s#@archivedir@#C:/bareos-storage#g +s#@scriptdir@#C:/Program Files/Bareos#g +s#@working_dir@#C:/ProgramData/Bareos/working#g +s#@logdir@#C:/ProgramData/Bareos/logs#g +s#@sbindir@#C:/Program Files/Bareos#g +s#@sysconfdir@#C:/ProgramData/Bareos#g +s/@uncomment_dbi/#/g +s#@db_name@#bareos#g +s#@db_user@#bareos#g +s#/tmp/bareos-restores#"C:/temp/bareos-restores"#g +s#@db_password@#XXX_REPLACE_WITH_DB_PASSWORD_XXX#g +s#@smtp_host@#XXX_REPLACE_WITH_SMTP_HOST_XXX#g +s#@job_email@#XXX_REPLACE_WITH_JOB_EMAIL_XXX#g +s#@DEFAULT_DB_TYPE@#XXX_REPLACE_WITH_DEFAULT_DB_TYPE_XXX#g +s#@db_port@#XXX_REPLACE_WITH_DB_PORT_XXX#g + +# ddl sql files +s#@DB_PASS@#XXX_REPLACE_WITH_DB_PASSWORD_XXX#g +s#@DB_USER@#XXX_REPLACE_WITH_DB_USER_XXX#g diff --git a/platforms/win32/mingw-debugsrc-devel.spec b/platforms/win32/mingw-debugsrc-devel.spec new file mode 100644 index 00000000000..3bd58764577 --- /dev/null +++ b/platforms/win32/mingw-debugsrc-devel.spec @@ -0,0 +1,48 @@ +# +# spec file for package mingw-debugsrc-devel +# +# Copyright (c) 2014 Bareos GmbH & Co. KG +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via http://bugs.bareos.org +# +#!BuildIgnore: post-build-checks + +Name: mingw-debugsrc-devel +Version: 14.1.0 +Release: 0 +Summary: bareos +License: LGPLv2+ +Group: Development/Libraries +URL: http://bareos.org +Source0: bareos-%{version}.tar.bz2 +BuildRoot: %{_tmppath}/%{name}-%{version}-build +BuildArch: noarch + +%description + +%prep +%setup -q -n bareos-%{version} + +%build + +%install +cp -av ../bareos-* $RPM_BUILD_ROOT/ + +%post + +%postun + +%files +%defattr(-,root,root) +/bareos-* + +%changelog diff --git a/platforms/win32/tray-monitor-conf-fd-sd.patch b/platforms/win32/tray-monitor-conf-fd-sd.patch index 49ce9971582..d1ae108a3d6 100644 --- a/platforms/win32/tray-monitor-conf-fd-sd.patch +++ b/platforms/win32/tray-monitor-conf-fd-sd.patch @@ -1,6 +1,6 @@ -diff -ruN bareos-13.4.0.git.1383814247.orig/src/qt-tray-monitor/tray-monitor.conf.in bareos-13.4.0.git.1383814247/src/qt-tray-monitor/tray-monitor.conf.in ---- bareos-13.4.0.git.1383814247.orig/src/qt-tray-monitor/tray-monitor.conf.in 2013-11-07 12:57:00.625086539 +0100 -+++ bareos-13.4.0.git.1383814247/src/qt-tray-monitor/tray-monitor.conf.in 2013-11-07 13:06:42.082575296 +0100 +diff -ruN bareos-13.4.0.git.1383814247.orig/src/qt-tray-monitor/tray-monitor.fd-sd-dir.conf.in bareos-13.4.0.git.1383814247/src/qt-tray-monitor/tray-monitor.fd-sd-dir.conf.in +--- bareos-13.4.0.git.1383814247.orig/src/qt-tray-monitor/tray-monitor.fd-sd-dir.conf.in 2013-11-07 12:57:00.625086539 +0100 ++++ bareos-13.4.0.git.1383814247/src/qt-tray-monitor/tray-monitor.fd-sd-dir.conf.in 2013-11-07 13:06:42.082575296 +0100 @@ -22,8 +22,8 @@ Password = "@mon_sd_password@" # password for StorageDaemon } diff --git a/platforms/win32/tray-monitor-conf.patch b/platforms/win32/tray-monitor-conf.patch index d14e34ab883..c3a02867812 100644 --- a/platforms/win32/tray-monitor-conf.patch +++ b/platforms/win32/tray-monitor-conf.patch @@ -1,6 +1,6 @@ -diff -ruN bareos-12.11.orig/src/qt-tray-monitor/tray-monitor.conf.in bareos-12.11/src/qt-tray-monitor/tray-monitor.conf.in ---- bareos-12.11.orig/src/qt-tray-monitor/tray-monitor.conf.in 2012-11-12 11:28:21.000000000 +0100 -+++ bareos-12.11/src/qt-tray-monitor/tray-monitor.conf.in 2012-11-17 00:59:17.000000000 +0100 +diff -ruN bareos-12.11.orig/src/qt-tray-monitor/tray-monitor.fd-sd-dir.conf.in bareos-12.11/src/qt-tray-monitor/tray-monitor.fd-sd-dir.conf.in +--- bareos-12.11.orig/src/qt-tray-monitor/tray-monitor.fd-sd-dir.conf.in 2012-11-12 11:28:21.000000000 +0100 ++++ bareos-12.11/src/qt-tray-monitor/tray-monitor.fd-sd-dir.conf.in 2012-11-17 00:59:17.000000000 +0100 @@ -15,15 +15,15 @@ Password = "@mon_fd_password@" # password for FileDaemon } diff --git a/platforms/win32/winbareos-nsi.spec b/platforms/win32/winbareos-nsi.spec index ac289fb2005..2f61ae8af72 100644 --- a/platforms/win32/winbareos-nsi.spec +++ b/platforms/win32/winbareos-nsi.spec @@ -6,6 +6,10 @@ %define __os_install_post %{_mingw64_debug_install_post} \ %{_mingw64_install_post} +# If versionstring contains debug, enable debug during build +%define WIN_DEBUG %(echo %version | grep debug >/dev/null 2>&1 && echo "yes" || echo "no") + + #!BuildIgnore: post-build-checks Name: winbareos-nsi Version: 14.1.0 @@ -21,11 +25,10 @@ BuildRequires: mingw32-filesystem BuildRequires: mingw64-filesystem BuildRequires: mingw64-cross-nsis -BuildRequires: mingw32-openssl -#mingw32-libopenssl mingw32-libgcc mingw32-openssl mingw32-libstdc++ mingw32-pthreads mingw32-libqt4 mingw32-libqt4-win32 mingw32-zlib mingw32-libpng -BuildRequires: mingw64-openssl -BuildRequires: mingw32-sed -BuildRequires: mingw64-sed +BuildRequires: mingw32-openssl +BuildRequires: mingw64-openssl +BuildRequires: mingw32-sed +BuildRequires: mingw64-sed BuildRequires: sed @@ -33,6 +36,29 @@ BuildRequires: vim, procps, bc BuildRequires: mingw32-winbareos = %{version} BuildRequires: mingw64-winbareos = %{version} +BuildRequires: mingw-debugsrc-devel = %{version} + + +BuildRequires: mingw32-libgcc +BuildRequires: mingw64-libgcc + +BuildRequires: mingw32-readline +BuildRequires: mingw64-readline + +BuildRequires: mingw32-libstdc++ +BuildRequires: mingw64-libstdc++ + +BuildRequires: mingw32-pthreads +BuildRequires: mingw64-pthreads + +BuildRequires: mingw32-libqt4 +BuildRequires: mingw64-libqt4 + +BuildRequires: mingw32-lzo +BuildRequires: mingw64-lzo + +BuildRequires: mingw32-libfastlz +BuildRequires: mingw64-libfastlz Source1: winbareos.nsi Source2: clientdialog.ini @@ -63,35 +89,73 @@ mkdir -p $RPM_BUILD_ROOT/nsisplugins cp %SOURCE5 $RPM_BUILD_ROOT/nsisplugins # KillProcWMI cp %SOURCE7 $RPM_BUILD_ROOT/nsisplugins # AccessControl -mkdir $RPM_BUILD_ROOT/release32 -mkdir $RPM_BUILD_ROOT/release64 +mkdir $RPM_BUILD_ROOT/release32 +mkdir $RPM_BUILD_ROOT/release64 + +# copy the sql ddls over +cp -av /etc/mingw32-winbareos/ddl $RPM_BUILD_ROOT/release32 +cp -av /etc/mingw64-winbareos/ddl $RPM_BUILD_ROOT/release64 + +# copy the sources over if we create debug package +%if %{WIN_DEBUG} == "yes" +cp -av /bareos-*debug* $RPM_BUILD_ROOT/release32 +cp -av /bareos-*debug* $RPM_BUILD_ROOT/release64 +%endif + + for file in \ - bareos-tray-monitor.exe bat.exe bareos-fd.exe bconsole.exe \ - bareos-sd.exe btape.exe bls.exe bextract.exe bpipe-fd.dll \ - mssqlvdi-fd.dll autoxflate-sd.dll libbareos.dll libbareosfind.dll \ - libcrypto-*.dll libgcc_s_*-1.dll libhistory6.dll \ - libreadline6.dll libssl-*.dll libstdc++-6.dll \ - libtermcap-0.dll pthreadGCE2.dll zlib1.dll \ - QtCore4.dll QtGui4.dll liblzo2-2.dll libfastlz.dll \ - libpng15-15.dll openssl.exe sed.exe; do - cp %{_mingw32_bindir}/$file $RPM_BUILD_ROOT/release32 - cp %{_mingw64_bindir}/$file $RPM_BUILD_ROOT/release64 + bareos-fd.exe \ + bareos-sd.exe \ + bareos-dir.exe \ + dbcheck.exe \ + bconsole.exe \ + bsmtp.exe \ + btape.exe \ + bls.exe \ + bextract.exe \ + bareos-tray-monitor.exe \ + bat.exe \ + bpipe-fd.dll \ + mssqlvdi-fd.dll \ + autoxflate-sd.dll \ + libbareos.dll \ + libbareosfind.dll \ + libbareoscats*.dll \ + libcrypto-*.dll \ + libgcc_s_*-1.dll \ + libhistory6.dll \ + libreadline6.dll \ + libssl-*.dll \ + libstdc++-6.dll \ + libtermcap-0.dll \ + pthreadGCE2.dll \ + zlib1.dll \ + QtCore4.dll \ + QtGui4.dll \ + liblzo2-2.dll \ + libfastlz.dll \ + libpng15-15.dll \ + openssl.exe \ + sed.exe;\ +do + cp %{_mingw32_bindir}/$file $RPM_BUILD_ROOT/release32 + cp %{_mingw64_bindir}/$file $RPM_BUILD_ROOT/release64 done for cfg in /etc/mingw32-winbareos/*.conf; do - cp $cfg $RPM_BUILD_ROOT/release32 + cp $cfg $RPM_BUILD_ROOT/release32 done for cfg in /etc/mingw64-winbareos/*.conf; do - cp $cfg $RPM_BUILD_ROOT/release64 + cp $cfg $RPM_BUILD_ROOT/release64 done cp %SOURCE1 %SOURCE2 %SOURCE3 %SOURCE4 %SOURCE5 %SOURCE6 %SOURCE7 %_sourcedir/LICENSE $RPM_BUILD_ROOT/release32 cp %SOURCE1 %SOURCE2 %SOURCE3 %SOURCE4 %SOURCE5 %SOURCE6 %SOURCE7 %_sourcedir/LICENSE $RPM_BUILD_ROOT/release64 -makensis -DPRODUCT_VERSION=%version-%release -DBIT_WIDTH=32 $RPM_BUILD_ROOT/release32/winbareos.nsi -makensis -DPRODUCT_VERSION=%version-%release -DBIT_WIDTH=64 $RPM_BUILD_ROOT/release64/winbareos.nsi +makensis -DVERSION=%version -DPRODUCT_VERSION=%version-%release -DBIT_WIDTH=32 -DWIN_DEBUG=%{WIN_DEBUG} $RPM_BUILD_ROOT/release32/winbareos.nsi +makensis -DVERSION=%version -DPRODUCT_VERSION=%version-%release -DBIT_WIDTH=64 -DWIN_DEBUG=%{WIN_DEBUG} $RPM_BUILD_ROOT/release64/winbareos.nsi %install mkdir -p $RPM_BUILD_ROOT%{_mingw32_bindir} @@ -103,6 +167,7 @@ cp $RPM_BUILD_ROOT/release64/Bareos*.exe $RPM_BUILD_ROOT/winbareos-%version-64-b rm -R $RPM_BUILD_ROOT/release32 rm -R $RPM_BUILD_ROOT/release64 rm -R $RPM_BUILD_ROOT/nsisplugins +#rm -R $RPM_BUILD_ROOT/bareos-* %clean rm -rf $RPM_BUILD_ROOT diff --git a/platforms/win32/winbareos.nsi b/platforms/win32/winbareos.nsi index 91a19ad5d4e..fe4634c6887 100644 --- a/platforms/win32/winbareos.nsi +++ b/platforms/win32/winbareos.nsi @@ -58,6 +58,17 @@ Var StorageAddress Var DirectorAddress #XXX_REPLACE_WITH_HOSTNAME_XXX Var DirectorPassword #XXX_REPLACE_WITH_DIRECTOR_PASSWORD_XXX Var DirectorName +Var DirectorMonPassword + +# Needed for Postgresql Database +Var PostgresPath +Var PostgresBinPath +Var DbDriver +Var DbPassword +Var DbPort +Var DbUser +Var DbName +Var DbEncoding # Generated configuration snippet for bareos director config (client ressource) Var ConfigSnippet @@ -117,6 +128,9 @@ ${StrRep} ; Components page !insertmacro MUI_PAGE_COMPONENTS +; Check if database server is installed +Page custom checkForDatabase + ; Custom für Abfragen benötigter Parameter für den Client Page custom getClientParameters @@ -267,7 +281,10 @@ Section -StopDaemon # so we use the shotgun: KillProcWMI::KillProc "bareos-fd.exe" KillProcWMI::KillProc "bareos-sd.exe" + KillProcWMI::KillProc "bareos-dir.exe" KillProcWMI::KillProc "bareos-tray-monitor.exe" + KillProcWMI::KillProc "bconsole.exe" + KillProcWMI::KillProc "bat.exe" SectionEnd @@ -285,6 +302,7 @@ Section -SetPasswords FileWrite $R1 "s#@DISTNAME@#Windows#g$\r$\n" FileWrite $R1 "s#XXX_REPLACE_WITH_DIRECTOR_PASSWORD_XXX#$DirectorPassword#g$\r$\n" + FileWrite $R1 "s#XXX_REPLACE_WITH_DIRECTOR_MONITOR_PASSWORD_XXX#$DirectorMonPassword#g$\r$\n" FileWrite $R1 "s#XXX_REPLACE_WITH_CLIENT_PASSWORD_XXX#$ClientPassword#g$\r$\n" FileWrite $R1 "s#XXX_REPLACE_WITH_CLIENT_MONITOR_PASSWORD_XXX#$ClientMonitorPassword#g$\r$\n" @@ -305,15 +323,29 @@ Section -SetPasswords FileWrite $R1 "s#XXX_REPLACE_WITH_STORAGE_PASSWORD_XXX#$StoragePassword#g$\r$\n" FileWrite $R1 "s#XXX_REPLACE_WITH_BASENAME_XXX-sd#$StorageDaemonName#g$\r$\n" + # Director DB Connection Setup + + FileWrite $R1 "s#XXX_REPLACE_WITH_DATABASE_DRIVER_XXX#$DbDriver#g$\r$\n" + FileWrite $R1 "s#XXX_REPLACE_WITH_DB_PORT_XXX#$DbPort#g$\r$\n" + FileWrite $R1 "s#XXX_REPLACE_WITH_DB_USER_XXX#$DbUser#g$\r$\n" + FileWrite $R1 "s#XXX_REPLACE_WITH_DB_PASSWORD_XXX#$DbPassword#g$\r$\n" + FileClose $R1 + nsExec::ExecToLog '$PLUGINSDIR\sed.exe -f "$PLUGINSDIR\config.sed" -i-template "$PLUGINSDIR\bareos-dir.conf"' nsExec::ExecToLog '$PLUGINSDIR\sed.exe -f "$PLUGINSDIR\config.sed" -i-template "$PLUGINSDIR\bareos-fd.conf"' nsExec::ExecToLog '$PLUGINSDIR\sed.exe -f "$PLUGINSDIR\config.sed" -i-template "$PLUGINSDIR\bareos-sd.conf"' - nsExec::ExecToLog '$PLUGINSDIR\sed.exe -f "$PLUGINSDIR\config.sed" -i-template "$PLUGINSDIR\tray-monitor.conf"' + nsExec::ExecToLog '$PLUGINSDIR\sed.exe -f "$PLUGINSDIR\config.sed" -i-template "$PLUGINSDIR\tray-monitor.fd.conf"' nsExec::ExecToLog '$PLUGINSDIR\sed.exe -f "$PLUGINSDIR\config.sed" -i-template "$PLUGINSDIR\tray-monitor.fd-sd.conf"' + nsExec::ExecToLog '$PLUGINSDIR\sed.exe -f "$PLUGINSDIR\config.sed" -i-template "$PLUGINSDIR\tray-monitor.fd-sd-dir.conf"' #Delete config.sed + FileOpen $R1 $PLUGINSDIR\postgres.sed w + FileWrite $R1 "s#XXX_REPLACE_WITH_DB_USER_XXX#$DbUser#g$\r$\n" + FileWrite $R1 "s#XXX_REPLACE_WITH_DB_PASSWORD_XXX#with password '$DbPassword'#g$\r$\n" + + FileClose $R1 # # config files for bconsole and bat to access remote director # @@ -347,6 +379,17 @@ Section -SetPasswords # FileClose $R1 SectionEnd +!If ${WIN_DEBUG} == yes +# install sourcecode if WIN_DEBUG is yes +Section Sourcecode SEC_SOURCE + SectionIn 1 2 3 + SetShellVarContext all + SetOutPath "C:\" + SetOverwrite ifnewer + File /r "bareos-${VERSION}" +SectionEnd +!Endif + SubSection "File Daemon (Client)" SUBSEC_FD Section "File Daemon and base libs" SEC_FD @@ -425,6 +468,8 @@ SectionIn 2 File "bls.exe" File "bextract.exe" + CreateDirectory "C:\bareos-storage" + !insertmacro InstallConfFile bareos-sd.conf SectionEnd @@ -442,22 +487,133 @@ SectionIn 2 SetShellVarContext current ${If} ${AtLeastWin7} DetailPrint "Opening Firewall, OS is Win7+" - DetailPrint "netsh advfirewall firewall add rule name=$\"Bareos backup client (bareos-sd) access$\" dir=in action=allow program=$\"$PROGRAMFILES64\${PRODUCT_NAME}\bareos-sd.exe$\" enable=yes protocol=TCP localport=9103 description=$\"Bareos backup client rule$\"" + DetailPrint "netsh advfirewall firewall add rule name=$\"Bareos storage daemon (bareos-sd) access$\" dir=in action=allow program=$\"$PROGRAMFILES64\${PRODUCT_NAME}\bareos-sd.exe$\" enable=yes protocol=TCP localport=9103 description=$\"Bareos storage daemon rule$\"" # profile=[private,domain]" - nsExec::Exec "netsh advfirewall firewall add rule name=$\"Bareos backup client (bareos-sd) access$\" dir=in action=allow program=$\"$PROGRAMFILES64\${PRODUCT_NAME}\bareos-sd.exe$\" enable=yes protocol=TCP localport=9103 description=$\"Bareos backup client rule$\"" + nsExec::Exec "netsh advfirewall firewall add rule name=$\"Bareos storage daemon (bareos-sd) access$\" dir=in action=allow program=$\"$PROGRAMFILES64\${PRODUCT_NAME}\bareos-sd.exe$\" enable=yes protocol=TCP localport=9103 description=$\"Bareos storage daemon rule$\"" # profile=[private,domain]" ${Else} DetailPrint "Opening Firewall, OS is < Win7" - DetailPrint "netsh firewall add portopening protocol=TCP port=9103 name=$\"Bareos backup client (bareos-sd) access$\"" - nsExec::Exec "netsh firewall add portopening protocol=TCP port=9103 name=$\"Bareos backup client (bareos-sd) access$\"" + DetailPrint "netsh firewall add portopening protocol=TCP port=9103 name=$\"Bareos storage daemon (bareos-sd) access$\"" + nsExec::Exec "netsh firewall add portopening protocol=TCP port=9103 name=$\"Bareos storage daemon (bareos-sd) access$\"" ${EndIf} SectionEnd - SubSectionEnd # Storage Daemon Subsection +SubSection "Director" SUBSEC_DIR + +Section /o "Director" SEC_DIR +SectionIn 2 + + SetShellVarContext all + CreateDirectory "$APPDATA\${PRODUCT_NAME}\logs" + CreateDirectory "$APPDATA\${PRODUCT_NAME}\working" + CreateDirectory "$APPDATA\${PRODUCT_NAME}\scripts" + SetOutPath "$INSTDIR" + SetOverwrite ifnewer + File "bareos-dir.exe" + File "dbcheck.exe" + File "bsmtp.exe" + File "libbareoscats.dll" + File "libbareoscats-postgresql.dll" + + # install sql ddl files + # SetOutPath "$APPDATA\${PRODUCT_NAME}\scripts" + + # CopyFiles /SILENT "$PLUGINSDIR\ddl\*" "$APPDATA\${PRODUCT_NAME}\scripts" + + # File "libbareoscats-sqlite3.dll" + !insertmacro InstallConfFile bareos-dir.conf + + # edit sql ddl files + nsExec::ExecToLog '$PLUGINSDIR\sed.exe -f "$PLUGINSDIR\postgres.sed" -i-template "$PLUGINSDIR\postgresql-grant.sql"' + #nsExec::ExecToLog '$PLUGINSDIR\sed.exe -f "$PLUGINSDIR\postgres.sed" -i-template "$PLUGINSDIR\postgresql-create.sql"' + #nsExec::ExecToLog '$PLUGINSDIR\sed.exe -f "$PLUGINSDIR\config.sed" -i-template "$PLUGINSDIR\postgresql-drop.sql"' + # install edited sql ddl files + Rename "$PLUGINSDIR\postgresql-create.sql" "$APPDATA\${PRODUCT_NAME}\scripts\postgresql-create.sql" + Rename "$PLUGINSDIR\postgresql-grant.sql" "$APPDATA\${PRODUCT_NAME}\scripts\postgresql-grant.sql" + Rename "$PLUGINSDIR\postgresql-drop.sql" "$APPDATA\${PRODUCT_NAME}\scripts\postgresql-drop.sql" + + # create db-create script + FileOpen $R1 $PLUGINSDIR\postgresql-createdb.sql w + FileWrite $R1 "CREATE DATABASE $DbName $DbEncoding TEMPLATE template0; $\r$\n" + FileWrite $R1 "ALTER DATABASE $DbName SET datestyle TO 'ISO, YMD'; $\r$\n" + FileClose $R1 + # install db-create script + Rename "$PLUGINSDIR\postgresql-createdb.sql" "$APPDATA\${PRODUCT_NAME}\scripts\postgresql-createdb.sql" + + # copy postgresql libs to our path + + StrCpy $R0 "$PostgresPath" + StrCpy $R1 "\bin" + + StrCpy $PostgresBinPath "$R0$R1" + DetailPrint "Copying dlls from $PostgresBinPath ..." + + DetailPrint "libpq.dll" + CopyFiles /SILENT "$PostgresBinPath\libpq.dll" "$INSTDIR" + + DetailPrint "libintl-8.dll" + CopyFiles /SILENT "$PostgresBinPath\libintl-8.dll" "$INSTDIR" + + DetailPrint "ssleay32.dll" + CopyFiles /SILENT "$PostgresBinPath\ssleay32.dll" "$INSTDIR" + + DetailPrint "libeay32.dll" + CopyFiles /SILENT "$PostgresBinPath\libeay32.dll" "$INSTDIR" + + # + # write database create batch file + # + FileOpen $R1 "$APPDATA\${PRODUCT_NAME}\scripts\postgres_db_setup.bat" w + FileWrite $R1 'rem call this batch file to create the bareos database in postgresql $\r$\n' + FileWrite $R1 'rem $\r$\n' + FileWrite $R1 'REM $\r$\n' + FileWrite $R1 'REM create postgresql database $\r$\n' + FileWrite $R1 "SET PATH=%PATH%;$\"$PostgresBinPath$\"$\r$\n" + FileWrite $R1 "cd $APPDATA\${PRODUCT_NAME}\scripts\$\r$\n" + + FileWrite $R1 "echo creating bareos database$\r$\n" + FileWrite $R1 "psql.exe -U postgres -f postgresql-createdb.sql$\r$\n" + + FileWrite $R1 "echo creating bareos database tables$\r$\n" + FileWrite $R1 "psql.exe -U postgres -f postgresql-create.sql $DbName$\r$\n" + + FileWrite $R1 "echo granting bareos database rights$\r$\n" + FileWrite $R1 "psql.exe -U postgres -f postgresql-grant.sql $DbName$\r$\n" + FileClose $R1 + +SectionEnd + +Section /o "Director Plugins " SEC_DIRPLUGINS +SectionIn 2 + SetShellVarContext all + SetOutPath "$INSTDIR\Plugins" + SetOverwrite ifnewer +# File "autoxflate-sd.dll" +SectionEnd + +Section "Open Firewall for Director" SEC_FIREWALL_DIR +SectionIn 2 + SetShellVarContext current + ${If} ${AtLeastWin7} + DetailPrint "Opening Firewall, OS is Win7+" + DetailPrint "netsh advfirewall firewall add rule name=$\"Bareos director (bareos-dir) access$\" dir=in action=allow program=$\"$PROGRAMFILES64\${PRODUCT_NAME}\bareos-dir.exe$\" enable=yes protocol=TCP localport=9101 description=$\"Bareos director rule$\"" + # profile=[private,domain]" + nsExec::Exec "netsh advfirewall firewall add rule name=$\"Bareos director (bareos-dir) access$\" dir=in action=allow program=$\"$PROGRAMFILES64\${PRODUCT_NAME}\bareos-dir.exe$\" enable=yes protocol=TCP localport=9101 description=$\"Bareos director rule$\"" + # profile=[private,domain]" + ${Else} + DetailPrint "Opening Firewall, OS is < Win7" + DetailPrint "netsh firewall add portopening protocol=TCP port=9101 name=$\"Bareos director (bareos-dir) access$\"" + nsExec::Exec "netsh firewall add portopening protocol=TCP port=9101 name=$\"Bareos director (bareos-dir) access$\"" + ${EndIf} +SectionEnd + + +SubSectionEnd # Director Subsection + SubSection "Consoles" SUBSEC_CONSOLES Section /o "Text Console (bconsole)" SEC_BCONSOLE @@ -489,10 +645,16 @@ SectionIn 1 2 File "libpng15-15.dll" File "QtCore4.dll" File "QtGui4.dll" + rename "$PLUGINSDIR\tray-monitor.fd.conf" "$PLUGINSDIR\tray-monitor.conf" ${If} ${SectionIsSelected} ${SEC_SD} delete "$PLUGINSDIR\tray-monitor.conf" rename "$PLUGINSDIR\tray-monitor.fd-sd.conf" "$PLUGINSDIR\tray-monitor.conf" ${EndIf} +${If} ${SectionIsSelected} ${SEC_DIR} + delete "$PLUGINSDIR\tray-monitor.conf" + rename "$PLUGINSDIR\tray-monitor.fd-sd-dir.conf" "$PLUGINSDIR\tray-monitor.conf" +${EndIf} + !insertmacro InstallConfFile "tray-monitor.conf" SectionEnd @@ -513,21 +675,41 @@ SectionIn 2 SectionEnd SubSectionEnd # Consoles Subsection + + + ; Section descriptions !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN + + ; FD !insertmacro MUI_DESCRIPTION_TEXT ${SEC_FD} "Installs the Bareos File Daemon and required Files" + !insertmacro MUI_DESCRIPTION_TEXT ${SUBSEC_FD} "Programs belonging to the Bareos File Daemon (client)" !insertmacro MUI_DESCRIPTION_TEXT ${SEC_FDPLUGINS} "Installs the Bareos File Daemon Plugins" + !insertmacro MUI_DESCRIPTION_TEXT ${SEC_FIREWALL_FD} "Opens the needed ports for the File Daemon in the windows firewall" + + ; SD !insertmacro MUI_DESCRIPTION_TEXT ${SEC_SD} "Installs the Bareos Storage Daemon" + !insertmacro MUI_DESCRIPTION_TEXT ${SUBSEC_SD} "Programs belonging to the Bareos Storage Daemon" !insertmacro MUI_DESCRIPTION_TEXT ${SEC_SDPLUGINS} "Installs the Bareos Storage Daemon Plugins" + !insertmacro MUI_DESCRIPTION_TEXT ${SEC_FIREWALL_SD} "Opens the needed ports for the Storage Daemon in the windows firewall" + + ; DIR + !insertmacro MUI_DESCRIPTION_TEXT ${SEC_DIR} "Installs the Bareos Director Daemon" + !insertmacro MUI_DESCRIPTION_TEXT ${SUBSEC_DIR} "Programs belonging to the Bareos Director" + !insertmacro MUI_DESCRIPTION_TEXT ${SEC_DIRPLUGINS} "Installs the Bareos Director Plugins" + !insertmacro MUI_DESCRIPTION_TEXT ${SEC_FIREWALL_DIR} "Opens the needed ports for the Director Daemon in the windows firewall" + + ; Consoles + + !insertmacro MUI_DESCRIPTION_TEXT ${SUBSEC_CONSOLES} "Programs to access and monitor the Bareos system (Consoles and Tray Monitor)" !insertmacro MUI_DESCRIPTION_TEXT ${SEC_BCONSOLE} "Installs the CLI client console (bconsole)" !insertmacro MUI_DESCRIPTION_TEXT ${SEC_TRAYMON} "Installs the Tray Icon to monitor the Bareos File Daemon" !insertmacro MUI_DESCRIPTION_TEXT ${SEC_BAT} "Installs the Qt Console (BAT)" - !insertmacro MUI_DESCRIPTION_TEXT ${SEC_FIREWALL_SD} "Opens the needed ports for the Storage Daemon in the windows firewall" - !insertmacro MUI_DESCRIPTION_TEXT ${SEC_FIREWALL_FD} "Opens the needed ports for the File Daemon in the windows firewall" - !insertmacro MUI_DESCRIPTION_TEXT ${SUBSEC_FD} "Programs belonging to the Bareos File Daemon (client)" - !insertmacro MUI_DESCRIPTION_TEXT ${SUBSEC_SD} "Programs belonging to the Bareos Storage Daemon" - !insertmacro MUI_DESCRIPTION_TEXT ${SUBSEC_CONSOLES} "Programs to access and monitor the Bareos system (Consoles and Tray Monitor)" + ; Sourcecode +!If ${WIN_DEBUG} == yes + !insertmacro MUI_DESCRIPTION_TEXT ${SEC_SOURCE} "Sourcecode for debugging will be installed into C:\bareos-${VERSION}" +!Endif !insertmacro MUI_FUNCTION_DESCRIPTION_END @@ -561,18 +743,36 @@ Section -Post nsExec::ExecToLog '"$INSTDIR\bareos-sd.exe" /remove' nsExec::ExecToLog '"$INSTDIR\bareos-sd.exe" /install -c "$APPDATA\${PRODUCT_NAME}\bareos-sd.conf"' ${EndIf} + + ${If} ${SectionIsSelected} ${SEC_DIR} + nsExec::ExecToLog '"$INSTDIR\bareos-dir.exe" /kill' + sleep 3000 + nsExec::ExecToLog '"$INSTDIR\bareos-dir.exe" /remove' + nsExec::ExecToLog '"$INSTDIR\bareos-dir.exe" /install -c "$APPDATA\${PRODUCT_NAME}\bareos-dir.conf"' + ${EndIf} SectionEnd Section -StartDaemon nsExec::ExecToLog "net start bareos-fd" + ${If} ${SectionIsSelected} ${SEC_SD} nsExec::ExecToLog "net start bareos-sd" ${EndIf} + + ${If} ${SectionIsSelected} ${SEC_DIR} + MessageBox MB_OK|MB_ICONINFORMATION "To setup the bareos database, please run the script$\r$\n\ + $APPDATA\${PRODUCT_NAME}\scripts\postgres_db_setup.bat$\r$\n \ + with administrator rights now." /SD IDOK + + nsExec::ExecToLog "net start bareos-dir" + ${EndIf} + ${If} ${SectionIsSelected} ${SEC_TRAYMON} MessageBox MB_OK|MB_ICONINFORMATION "The tray monitor will be started automatically on next login. $\r$\n Alternatively it can be started from the start menu entry now." /SD IDOK ${EndIf} SectionEnd + # helper functions to find out computer name Function GetComputerName Push $R0 @@ -815,17 +1015,27 @@ done: File "/oname=$PLUGINSDIR\bareos-fd.conf" "bareos-fd.conf" File "/oname=$PLUGINSDIR\bareos-sd.conf" "bareos-sd.conf" + File "/oname=$PLUGINSDIR\bareos-dir.conf" "bareos-dir.conf" File "/oname=$PLUGINSDIR\bconsole.conf" "bconsole.conf" File "/oname=$PLUGINSDIR\bat.conf" "bat.conf" - File "/oname=$PLUGINSDIR\tray-monitor.conf" "tray-monitor.conf" + File "/oname=$PLUGINSDIR\tray-monitor.fd.conf" "tray-monitor.fd.conf" File "/oname=$PLUGINSDIR\tray-monitor.fd-sd.conf" "tray-monitor.fd-sd.conf" + File "/oname=$PLUGINSDIR\tray-monitor.fd-sd-dir.conf" "tray-monitor.fd-sd-dir.conf" + + File "/oname=$PLUGINSDIR\postgresql-create.sql" ".\ddl\creates\postgresql.sql" + File "/oname=$PLUGINSDIR\postgresql-drop.sql" ".\ddl\drops\postgresql.sql" + File "/oname=$PLUGINSDIR\postgresql-grant.sql" ".\ddl\grants\postgresql.sql" + # File "/oname=$PLUGINSDIR\postgresql.sql" ".\ddl\updates\postgresql.sql" + + # make first section mandatory SectionSetFlags ${SEC_FD} 17 # SF_SELECTED & SF_RO SectionSetFlags ${SEC_TRAYMON} ${SF_SELECTED} # SF_SELECTED SectionSetFlags ${SEC_FDPLUGINS} ${SF_SELECTED} # SF_SELECTED SectionSetFlags ${SEC_FIREWALL_SD} ${SF_UNSELECTED} # unselect sd firewall (is selected by default, why?) + SectionSetFlags ${SEC_FIREWALL_DIR} ${SF_UNSELECTED} # unselect dir firewall (is selected by default, why?) # find out the computer name Call GetComputerName @@ -891,6 +1101,34 @@ done: ${EndIf} skipstoragemonpassword: + strcmp $DirectorPassword "" gendirectorpassword skipdirectorpassword + gendirectorpassword: + nsExec::Exec '"$PLUGINSDIR\openssl.exe" rand -base64 -out $PLUGINSDIR\pw.txt 33' + pop $R0 + ${If} $R0 = 0 + FileOpen $R1 "$PLUGINSDIR\pw.txt" r + IfErrors +4 + FileRead $R1 $R0 + ${StrTrimNewLines} $DirectorPassword $R0 + FileClose $R1 + ${EndIf} + skipdirectorpassword: + + strcmp $DirectorMonPassword "" gendirectormonpassword skipdirectormonpassword + gendirectormonpassword: + nsExec::Exec '"$PLUGINSDIR\openssl.exe" rand -base64 -out $PLUGINSDIR\pw.txt 33' + pop $R0 + ${If} $R0 = 0 + FileOpen $R1 "$PLUGINSDIR\pw.txt" r + IfErrors +4 + FileRead $R1 $R0 + ${StrTrimNewLines} $DirectorMonPassword $R0 + FileClose $R1 + ${EndIf} + skipdirectormonpassword: + + + # if the variables are not empty (because of cmdline params), # dont set them with our own logic but leave them as they are @@ -899,11 +1137,11 @@ done: strcmp $ClientAddress "" +1 +2 StrCpy $ClientAddress "$HostName" strcmp $DirectorName "" +1 +2 - StrCpy $DirectorName "bareos-dir" + StrCpy $DirectorName "$HostName-dir" strcmp $DirectorAddress "" +1 +2 - StrCpy $DirectorAddress "bareos-dir.example.com" + StrCpy $DirectorAddress "$HostName" strcmp $DirectorPassword "" +1 +2 - StrCpy $DirectorPassword "DIRECTORPASSWORD" + StrCpy $DirectorPassword "$DirectorPassword" strcmp $StorageDaemonName "" +1 +2 StrCpy $StorageDaemonName "$HostName-sd" @@ -914,6 +1152,50 @@ done: strcmp $StorageAddress "" +1 +2 StrCpy $StorageAddress "$HostName" + strcmp $DbDriver "" +1 +2 + StrCpy $DbDriver "postgresql" + + strcmp $DbPassword "" +1 +2 + StrCpy $DbPassword "bareos" + + strcmp $DbPort "" +1 +2 + StrCpy $DbPort "5432" + + strcmp $DbUser "" +1 +2 + StrCpy $DbUser "bareos" + + strcmp $DbEncoding "" +1 +2 + StrCpy $DbEncoding "ENCODING 'SQL_ASCII' LC_COLLATE 'C' LC_CTYPE 'C'" + + strcmp $DbName "" +1 +2 + StrCpy $DbName "bareos" + + + + +FunctionEnd + + +# +## Check for Database +# +Function checkForDatabase +${IfNot} ${SectionIsSelected} ${SEC_DIR} + goto dbcheckend +${EndIf} + +# search for value of HKEY_LOCAL_MACHINE\SOFTWARE\PostgreSQL Global Development Group\PostgreSQL, Key "Location" + ReadRegStr $PostgresPath HKLM "SOFTWARE\PostgreSQL Global Development Group\PostgreSQL" "Location" + + StrCmp $PostgresPath "" postgresnotfound dbcheckend + +postgresnotfound: + + MessageBox MB_OK|MB_ICONSTOP "Postgresql installation was not found.$\r$\nPostgresql installation is needed for the bareos director to work. $\r$\nPlease download Postgresql for windows following the instructions on$\r$\nhttp://www.postgresql.org/download/windows/. $\r$\nBareos director on windows was tested with Postgresql 9.3 " + Quit + +dbcheckend: + FunctionEnd # @@ -952,8 +1234,6 @@ skip: Pop $R0 FunctionEnd - - # # Storage Configuration Dialog # @@ -988,7 +1268,6 @@ skip: Pop $R0 FunctionEnd - # # Director Configuration Dialog (for bconsole and bat configuration) # @@ -1017,6 +1296,11 @@ FunctionEnd Function displayDirconfSnippet strcmp $Upgrading "yes" skip + +# skip config snippets if we have local director +${If} ${SectionIsSelected} ${SEC_DIR} + goto skip +${EndIf} # # write client config snippet for director # @@ -1065,9 +1349,6 @@ ${EndIf} skip: FunctionEnd - - - Function un.onUninstSuccess HideWindow MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully uninstalled." /SD IDYES @@ -1078,9 +1359,7 @@ Function un.onInit Abort FunctionEnd - Section Uninstall - # UnInstaller Options ${GetParameters} $cmdLineParams ClearErrors @@ -1110,8 +1389,16 @@ Section Uninstall sleep 3000 nsExec::ExecToLog '"$INSTDIR\bareos-sd.exe" /remove' + nsExec::ExecToLog '"$INSTDIR\bareos-dir.exe" /kill' + sleep 3000 + nsExec::ExecToLog '"$INSTDIR\bareos-dir.exe" /remove' + + # kill tray monitor KillProcWMI::KillProc "bareos-tray-monitor.exe" + # kill bconsole and bat if running + KillProcWMI::KillProc "bconsole.exe" + KillProcWMI::KillProc "bat.exe" StrCmp $SilentKeepConfig "yes" ConfDeleteSkip # keep if silent and $SilentKeepConfig is yes @@ -1120,6 +1407,7 @@ Section Uninstall Delete "$APPDATA\${PRODUCT_NAME}\bareos-fd.conf" Delete "$APPDATA\${PRODUCT_NAME}\bareos-sd.conf" + Delete "$APPDATA\${PRODUCT_NAME}\bareos-dir.conf" Delete "$APPDATA\${PRODUCT_NAME}\tray-monitor.conf" Delete "$APPDATA\${PRODUCT_NAME}\bconsole.conf" Delete "$APPDATA\${PRODUCT_NAME}\bat.conf" @@ -1127,10 +1415,15 @@ Section Uninstall ConfDeleteSkip: Delete "$APPDATA\${PRODUCT_NAME}\bareos-fd.conf.old" Delete "$APPDATA\${PRODUCT_NAME}\bareos-sd.conf.old" + Delete "$APPDATA\${PRODUCT_NAME}\bareos-dir.conf.old" Delete "$APPDATA\${PRODUCT_NAME}\tray-monitor.conf.old" Delete "$APPDATA\${PRODUCT_NAME}\bconsole.conf.old" Delete "$APPDATA\${PRODUCT_NAME}\bat.conf.old" + RMDir "$APPDATA\${PRODUCT_NAME}\logs" + RMDir "$APPDATA\${PRODUCT_NAME}\working" + RMDir "$APPDATA\${PRODUCT_NAME}\scripts" + RMDir "$APPDATA\${PRODUCT_NAME}" Delete "$INSTDIR\${PRODUCT_NAME}.url" @@ -1139,6 +1432,8 @@ ConfDeleteSkip: Delete "$INSTDIR\bat.exe" Delete "$INSTDIR\bareos-fd.exe" Delete "$INSTDIR\bareos-sd.exe" + Delete "$INSTDIR\bareos-dir.exe" + Delete "$INSTDIR\dbcheck.exe" Delete "$INSTDIR\btape.exe" Delete "$INSTDIR\bls.exe" Delete "$INSTDIR\bextract.exe" @@ -1196,15 +1491,25 @@ ConfDeleteSkip: DetailPrint "Closing Firewall, OS is Win7+" DetailPrint "netsh advfirewall firewall delete rule name=$\"Bareos backup client (bareos-fd) access$\"" nsExec::Exec "netsh advfirewall firewall delete rule name=$\"Bareos backup client (bareos-fd) access$\"" - DetailPrint "netsh advfirewall firewall delete rule name=$\"Bareos backup client (bareos-sd) access$\"" - nsExec::Exec "netsh advfirewall firewall delete rule name=$\"Bareos backup client (bareos-sd) access$\"" + DetailPrint "netsh advfirewall firewall delete rule name=$\"Bareos storage daemon (bareos-sd) access$\"" + nsExec::Exec "netsh advfirewall firewall delete rule name=$\"Bareos storage daemon (bareos-sd) access$\"" + DetailPrint "netsh advfirewall firewall delete rule name=$\"Bareos director (bareos-dir) access$\"" + nsExec::Exec "netsh advfirewall firewall delete rule name=$\"Bareos director (bareos-dir) access$\"" + ${Else} DetailPrint "Closing Firewall, OS is < Win7" DetailPrint "netsh firewall delete portopening protocol=TCP port=9102 name=$\"Bareos backup client (bareos-fd) access$\"" nsExec::Exec "netsh firewall delete portopening protocol=TCP port=9102 name=$\"Bareos backup client (bareos-fd) access$\"" - DetailPrint "netsh firewall delete portopening protocol=TCP port=9103 name=$\"Bareos backup client (bareos-sd) access$\"" - nsExec::Exec "netsh firewall delete portopening protocol=TCP port=9103 name=$\"Bareos backup client (bareos-sd) access$\"" + DetailPrint "netsh firewall delete portopening protocol=TCP port=9103 name=$\"Bareos storage dameon (bareos-sd) access$\"" + nsExec::Exec "netsh firewall delete portopening protocol=TCP port=9103 name=$\"Bareos storage daemon (bareos-sd) access$\"" + DetailPrint "netsh firewall delete portopening protocol=TCP port=9101 name=$\"Bareos director (bareos-dir) access$\"" + nsExec::Exec "netsh firewall delete portopening protocol=TCP port=9101 name=$\"Bareos director (bareos-dir) access$\"" + ${EndIf} + + # remove sourcecode + RMDir /r "C:\bareos-${VERSION}" + SectionEnd Function .onSelChange diff --git a/platforms/win32/winbareos32.spec b/platforms/win32/winbareos32.spec index 3860953ca4a..03563cea159 100644 --- a/platforms/win32/winbareos32.spec +++ b/platforms/win32/winbareos32.spec @@ -7,7 +7,7 @@ %define __strip %{_mingw32_strip} %define __objdump %{_mingw32_objdump} %define _use_internal_dependency_generator 0 -%define __find_requires %{_mingw32_findrequires} +#define __find_requires %{_mingw32_findrequires} %define __find_provides %{_mingw32_findprovides} #define __os_install_post #{_mingw32_debug_install_post} \ # #{_mingw32_install_post} @@ -29,6 +29,7 @@ BuildArch: noarch Source1: fillup.sed Source2: vss_headers.tar Source3: vdi_headers.tar +Source4: pgsql-libpq.tar Patch1: tray-monitor-conf.patch Patch2: tray-monitor-conf-fd-sd.patch @@ -65,6 +66,8 @@ BuildRequires: mingw32-lzo BuildRequires: mingw32-lzo-devel BuildRequires: mingw32-libfastlz BuildRequires: mingw32-libfastlz-devel +BuildRequires: mingw32-libsqlite +BuildRequires: mingw32-libsqlite-devel BuildRequires: sed BuildRequires: vim, procps, bc @@ -86,15 +89,17 @@ bareos #setup %setup -q -n bareos-%{version} cp src/qt-tray-monitor/tray-monitor.conf.in src/qt-tray-monitor/tray-monitor.conf.in.orig +cp src/qt-tray-monitor/tray-monitor.conf.in src/qt-tray-monitor/tray-monitor.fd-sd-dir.conf.in %patch1 -p1 -mv src/qt-tray-monitor/tray-monitor.conf.in src/qt-tray-monitor/tray-monitor.conf.in.fd -cp src/qt-tray-monitor/tray-monitor.conf.in.orig src/qt-tray-monitor/tray-monitor.conf.in +mv src/qt-tray-monitor/tray-monitor.fd-sd-dir.conf.in src/qt-tray-monitor/tray-monitor.fd.conf.in +cp src/qt-tray-monitor/tray-monitor.conf.in.orig src/qt-tray-monitor/tray-monitor.fd-sd-dir.conf.in %patch2 -p1 -mv src/qt-tray-monitor/tray-monitor.conf.in src/qt-tray-monitor/tray-monitor.fd-sd.conf.in -mv src/qt-tray-monitor/tray-monitor.conf.in.fd src/qt-tray-monitor/tray-monitor.conf.in +mv src/qt-tray-monitor/tray-monitor.fd-sd-dir.conf.in src/qt-tray-monitor/tray-monitor.fd-sd.conf.in +cp src/qt-tray-monitor/tray-monitor.conf.in.orig src/qt-tray-monitor/tray-monitor.fd-sd-dir.conf.in tar xvf %SOURCE2 tar xvf %SOURCE3 +tar xvf %SOURCE4 %build @@ -117,6 +122,10 @@ cp qt-tray-monitor/bareos-tray-monitor.exe \ stored/btape.exe \ stored/bls.exe \ stored/bextract.exe \ + dird/bareos-dir.exe \ + dird/dbcheck.exe \ + tools/bsmtp.exe \ + cats/libbareoscats*.dll \ lib/libbareos.dll \ findlib/libbareosfind.dll \ plugins/filed/bpipe-fd.dll \ @@ -124,9 +133,11 @@ cp qt-tray-monitor/bareos-tray-monitor.exe \ plugins/stored/autoxflate-sd.dll \ $RPM_BUILD_ROOT%{_mingw32_bindir} -for cfg in ../qt-tray-monitor/tray-monitor.conf.in \ +for cfg in ../qt-tray-monitor/tray-monitor.fd.conf.in \ ../qt-tray-monitor/tray-monitor.fd-sd.conf.in \ + ../qt-tray-monitor/tray-monitor.fd-sd-dir.conf.in \ ../qt-console/bat.conf.in \ + ../dird/bareos-dir.conf.in \ ../filed/bareos-fd.conf.in \ ../stored/bareos-sd.conf.in \ ../console/bconsole.conf.in \ @@ -138,12 +149,28 @@ do sed -f %SOURCE1 $cfg -i ; done +popd + +mkdir -p $RPM_BUILD_ROOT/etc/%name/ddl +for i in creates drops grants updates; do + mkdir $RPM_BUILD_ROOT/etc/%name/ddl/$i/ + cp -av src/cats/ddl/$i/postgres* $RPM_BUILD_ROOT/etc/%name/ddl/$i/ +done + +for sql in $RPM_BUILD_ROOT/etc/%name/ddl/*/*.sql; +do + sed -f %SOURCE1 $sql -i ; +done + + + %clean rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root) /etc/%name/*.conf +/etc/%name/ddl/ %dir %{_mingw32_bindir} %{_mingw32_bindir}/*.dll %{_mingw32_bindir}/*.exe diff --git a/platforms/win32/winbareos64.spec b/platforms/win32/winbareos64.spec index 54ccefe7702..7f1adc12cc9 100644 --- a/platforms/win32/winbareos64.spec +++ b/platforms/win32/winbareos64.spec @@ -7,7 +7,7 @@ %define __strip %{_mingw64_strip} %define __objdump %{_mingw64_objdump} %define _use_internal_dependency_generator 0 -%define __find_requires %{_mingw64_findrequires} +#define __find_requires %{_mingw64_findrequires} %define __find_provides %{_mingw64_findprovides} #define __os_install_post #{_mingw64_debug_install_post} \ # #{_mingw64_install_post} @@ -29,6 +29,7 @@ BuildArch: noarch Source1: fillup.sed Source2: vss_headers.tar Source3: vdi_headers.tar +Source4: pgsql-libpq.tar Patch1: tray-monitor-conf.patch Patch2: tray-monitor-conf-fd-sd.patch @@ -65,6 +66,8 @@ BuildRequires: mingw64-lzo BuildRequires: mingw64-lzo-devel BuildRequires: mingw64-libfastlz BuildRequires: mingw64-libfastlz-devel +BuildRequires: mingw64-libsqlite +BuildRequires: mingw64-libsqlite-devel BuildRequires: sed BuildRequires: vim, procps, bc @@ -86,16 +89,18 @@ bareos #setup %setup -q -n bareos-%{version} cp src/qt-tray-monitor/tray-monitor.conf.in src/qt-tray-monitor/tray-monitor.conf.in.orig +cp src/qt-tray-monitor/tray-monitor.conf.in src/qt-tray-monitor/tray-monitor.fd-sd-dir.conf.in %patch1 -p1 -mv src/qt-tray-monitor/tray-monitor.conf.in src/qt-tray-monitor/tray-monitor.conf.in.fd -cp src/qt-tray-monitor/tray-monitor.conf.in.orig src/qt-tray-monitor/tray-monitor.conf.in +mv src/qt-tray-monitor/tray-monitor.fd-sd-dir.conf.in src/qt-tray-monitor/tray-monitor.fd.conf.in +cp src/qt-tray-monitor/tray-monitor.conf.in.orig src/qt-tray-monitor/tray-monitor.fd-sd-dir.conf.in %patch2 -p1 -mv src/qt-tray-monitor/tray-monitor.conf.in src/qt-tray-monitor/tray-monitor.fd-sd.conf.in -mv src/qt-tray-monitor/tray-monitor.conf.in.fd src/qt-tray-monitor/tray-monitor.conf.in +mv src/qt-tray-monitor/tray-monitor.fd-sd-dir.conf.in src/qt-tray-monitor/tray-monitor.fd-sd.conf.in +cp src/qt-tray-monitor/tray-monitor.conf.in.orig src/qt-tray-monitor/tray-monitor.fd-sd-dir.conf.in tar xvf %SOURCE2 tar xvf %SOURCE3 +tar xvf %SOURCE4 %build @@ -118,6 +123,10 @@ cp qt-tray-monitor/bareos-tray-monitor.exe \ stored/btape.exe \ stored/bls.exe \ stored/bextract.exe \ + dird/bareos-dir.exe \ + dird/dbcheck.exe \ + tools/bsmtp.exe \ + cats/libbareoscats*.dll \ lib/libbareos.dll \ findlib/libbareosfind.dll \ plugins/filed/bpipe-fd.dll \ @@ -125,9 +134,11 @@ cp qt-tray-monitor/bareos-tray-monitor.exe \ plugins/stored/autoxflate-sd.dll \ $RPM_BUILD_ROOT%{_mingw64_bindir} -for cfg in ../qt-tray-monitor/tray-monitor.conf.in \ +for cfg in ../qt-tray-monitor/tray-monitor.fd.conf.in \ ../qt-tray-monitor/tray-monitor.fd-sd.conf.in \ + ../qt-tray-monitor/tray-monitor.fd-sd-dir.conf.in \ ../qt-console/bat.conf.in \ + ../dird/bareos-dir.conf.in \ ../filed/bareos-fd.conf.in \ ../stored/bareos-sd.conf.in \ ../console/bconsole.conf.in \ @@ -139,12 +150,28 @@ do sed -f %SOURCE1 $cfg -i ; done +popd + +mkdir -p $RPM_BUILD_ROOT/etc/%name/ddl +for i in creates drops grants updates; do + mkdir $RPM_BUILD_ROOT/etc/%name/ddl/$i/ + cp -av src/cats/ddl/$i/postgres* $RPM_BUILD_ROOT/etc/%name/ddl/$i/ +done + +for sql in $RPM_BUILD_ROOT/etc/%name/ddl/*/*.sql; +do + sed -f %SOURCE1 $sql -i ; +done + + + %clean rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root) /etc/%name/*.conf +/etc/%name/ddl/ %dir %{_mingw64_bindir} %{_mingw64_bindir}/*.dll %{_mingw64_bindir}/*.exe diff --git a/src/cats/bdb_priv.h b/src/cats/bdb_priv.h index b45ffa0e418..a4b8588e804 100644 --- a/src/cats/bdb_priv.h +++ b/src/cats/bdb_priv.h @@ -40,7 +40,7 @@ typedef struct sql_field { uint32_t flags; /* flags */ } SQL_FIELD; -class B_DB_PRIV: public B_DB { +class CATS_IMP_EXP B_DB_PRIV: public B_DB { protected: int m_status; /* status */ int m_num_rows; /* number of rows returned by last query */ diff --git a/src/cats/cats.h b/src/cats/cats.h index b61879932c9..cb77d4abc27 100644 --- a/src/cats/cats.h +++ b/src/cats/cats.h @@ -454,7 +454,7 @@ typedef int (DB_RESULT_HANDLER)(void *, int, char **); /* Current database version number for all drivers */ #define BDB_VERSION 2002 -class B_DB: public SMARTALLOC { +class CATS_IMP_EXP B_DB: public SMARTALLOC { protected: brwlock_t m_lock; /* transaction lock */ dlink m_link; /* queue control */ diff --git a/src/cats/cats_dynamic.c b/src/cats/cats_dynamic.c index 26302875642..907fa042dbe 100644 --- a/src/cats/cats_dynamic.c +++ b/src/cats/cats_dynamic.c @@ -132,8 +132,13 @@ B_DB *db_init_database(JCR *jcr, /* * This is a new backend try to use dynamic loading to load the backend library. */ +#if defined(HAVE_WIN32) + bsnprintf(shared_library_name, sizeof(shared_library_name), "libbareoscats-%s%s", + backend_interface_mapping->interface_name, DYN_LIB_EXTENSION); +#else bsnprintf(shared_library_name, sizeof(shared_library_name), "%s/libbareoscats-%s%s", LIBDIR, backend_interface_mapping->interface_name, DYN_LIB_EXTENSION); +#endif dl_handle = dlopen(shared_library_name, RTLD_NOW); if (!dl_handle) { diff --git a/src/cats/cats_dynamic.h b/src/cats/cats_dynamic.h index d3b766236d3..3923bbc3cf5 100644 --- a/src/cats/cats_dynamic.h +++ b/src/cats/cats_dynamic.h @@ -58,7 +58,9 @@ struct backend_shared_library_t { t_flush_backend flush_backend; }; -#if defined(HAVE_DARWIN_OS) +#if defined(HAVE_WIN32) +#define DYN_LIB_EXTENSION ".dll" +#elif defined(HAVE_DARWIN_OS) #define DYN_LIB_EXTENSION ".dylib" #else #define DYN_LIB_EXTENSION ".so" diff --git a/src/cats/dbi.c b/src/cats/dbi.c index 3ce6973c57a..9fe8692fc1c 100644 --- a/src/cats/dbi.c +++ b/src/cats/dbi.c @@ -1451,17 +1451,17 @@ bool B_DB_DBI::sql_batch_insert(JCR *jcr, ATTR_DBR *ar) * never have errors, or it is really fatal. */ #ifdef HAVE_DYNAMIC_CATS_BACKENDS -extern "C" B_DB *backend_instantiate(JCR *jcr, - const char *db_driver, - const char *db_name, - const char *db_user, - const char *db_password, - const char *db_address, - int db_port, - const char *db_socket, - bool mult_db_connections, - bool disable_batch_insert, - bool need_private) +extern "C" B_DB CATS_IMP_EXP *backend_instantiate(JCR *jcr, + const char *db_driver, + const char *db_name, + const char *db_user, + const char *db_password, + const char *db_address, + int db_port, + const char *db_socket, + bool mult_db_connections, + bool disable_batch_insert, + bool need_private) #else B_DB *db_init_database(JCR *jcr, const char *db_driver, @@ -1528,7 +1528,7 @@ B_DB *db_init_database(JCR *jcr, } #ifdef HAVE_DYNAMIC_CATS_BACKENDS -extern "C" void flush_backend(void) +extern "C" void CATS_IMP_EXP flush_backend(void) #else void db_flush_backends(void) #endif diff --git a/src/cats/ingres.c b/src/cats/ingres.c index 796f2830e7c..806c3ba261e 100755 --- a/src/cats/ingres.c +++ b/src/cats/ingres.c @@ -1000,17 +1000,17 @@ bool B_DB_INGRES::sql_batch_insert(JCR *jcr, ATTR_DBR *ar) * never have errors, or it is really fatal. */ #ifdef HAVE_DYNAMIC_CATS_BACKENDS -extern "C" B_DB *backend_instantiate(JCR *jcr, - const char *db_driver, - const char *db_name, - const char *db_user, - const char *db_password, - const char *db_address, - int db_port, - const char *db_socket, - bool mult_db_connections, - bool disable_batch_insert, - bool need_private) +extern "C" B_DB CATS_IMP_EXP *backend_instantiate(JCR *jcr, + const char *db_driver, + const char *db_name, + const char *db_user, + const char *db_password, + const char *db_address, + int db_port, + const char *db_socket, + bool mult_db_connections, + bool disable_batch_insert, + bool need_private) #else B_DB *db_init_database(JCR *jcr, const char *db_driver, @@ -1070,7 +1070,7 @@ B_DB *db_init_database(JCR *jcr, } #ifdef HAVE_DYNAMIC_CATS_BACKENDS -extern "C" void flush_backend(void) +extern "C" void CATS_IMP_EXP flush_backend(void) #else void db_flush_backends(void) #endif diff --git a/src/cats/mysql.c b/src/cats/mysql.c index 1bf062ac6d6..b08fea82f98 100644 --- a/src/cats/mysql.c +++ b/src/cats/mysql.c @@ -701,17 +701,17 @@ bool B_DB_MYSQL::sql_batch_insert(JCR *jcr, ATTR_DBR *ar) * never have errors, or it is really fatal. */ #ifdef HAVE_DYNAMIC_CATS_BACKENDS -extern "C" B_DB *backend_instantiate(JCR *jcr, - const char *db_driver, - const char *db_name, - const char *db_user, - const char *db_password, - const char *db_address, - int db_port, - const char *db_socket, - bool mult_db_connections, - bool disable_batch_insert, - bool need_private) +extern "C" B_DB CATS_IMP_EXP *backend_instantiate(JCR *jcr, + const char *db_driver, + const char *db_name, + const char *db_user, + const char *db_password, + const char *db_address, + int db_port, + const char *db_socket, + bool mult_db_connections, + bool disable_batch_insert, + bool need_private) #else B_DB *db_init_database(JCR *jcr, const char *db_driver, @@ -769,7 +769,7 @@ B_DB *db_init_database(JCR *jcr, } #ifdef HAVE_DYNAMIC_CATS_BACKENDS -extern "C" void flush_backend(void) +extern "C" void CATS_IMP_EXP flush_backend(void) #else void db_flush_backends(void) #endif diff --git a/src/cats/postgresql.c b/src/cats/postgresql.c index 3a9ec675c25..e8a40fcfe7c 100644 --- a/src/cats/postgresql.c +++ b/src/cats/postgresql.c @@ -1121,17 +1121,17 @@ bool B_DB_POSTGRESQL::sql_batch_insert(JCR *jcr, ATTR_DBR *ar) * never have errors, or it is really fatal. */ #ifdef HAVE_DYNAMIC_CATS_BACKENDS -extern "C" B_DB *backend_instantiate(JCR *jcr, - const char *db_driver, - const char *db_name, - const char *db_user, - const char *db_password, - const char *db_address, - int db_port, - const char *db_socket, - bool mult_db_connections, - bool disable_batch_insert, - bool need_private) +extern "C" B_DB CATS_IMP_EXP *backend_instantiate(JCR *jcr, + const char *db_driver, + const char *db_name, + const char *db_user, + const char *db_password, + const char *db_address, + int db_port, + const char *db_socket, + bool mult_db_connections, + bool disable_batch_insert, + bool need_private) #else B_DB *db_init_database(JCR *jcr, const char *db_driver, @@ -1189,7 +1189,7 @@ B_DB *db_init_database(JCR *jcr, } #ifdef HAVE_DYNAMIC_CATS_BACKENDS -extern "C" void flush_backend(void) +extern "C" void CATS_IMP_EXP flush_backend(void) #else void db_flush_backends(void) #endif diff --git a/src/cats/sqlite.c b/src/cats/sqlite.c index f571641f9ac..035d8a4719e 100644 --- a/src/cats/sqlite.c +++ b/src/cats/sqlite.c @@ -653,17 +653,17 @@ bool B_DB_SQLITE::sql_batch_insert(JCR *jcr, ATTR_DBR *ar) * never have errors, or it is really fatal. */ #ifdef HAVE_DYNAMIC_CATS_BACKENDS -extern "C" B_DB *backend_instantiate(JCR *jcr, - const char *db_driver, - const char *db_name, - const char *db_user, - const char *db_password, - const char *db_address, - int db_port, - const char *db_socket, - bool mult_db_connections, - bool disable_batch_insert, - bool need_private) +extern "C" B_DB CATS_IMP_EXP *backend_instantiate(JCR *jcr, + const char *db_driver, + const char *db_name, + const char *db_user, + const char *db_password, + const char *db_address, + int db_port, + const char *db_socket, + bool mult_db_connections, + bool disable_batch_insert, + bool need_private) #else B_DB *db_init_database(JCR *jcr, const char *db_driver, @@ -717,7 +717,7 @@ B_DB *db_init_database(JCR *jcr, } #ifdef HAVE_DYNAMIC_CATS_BACKENDS -extern "C" void flush_backend(void) +extern "C" void CATS_IMP_EXP flush_backend(void) #else void db_flush_backends(void) #endif diff --git a/src/dird/bareos-dir.conf.in b/src/dird/bareos-dir.conf.in index 62a309e8e47..1cd94cc719e 100644 --- a/src/dird/bareos-dir.conf.in +++ b/src/dird/bareos-dir.conf.in @@ -179,7 +179,7 @@ FileSet { Options { Signature = MD5 # calculate md5 checksum per file } - File = @sbindir@ + File = "@sbindir@" } } diff --git a/src/include/baconfig.h b/src/include/baconfig.h index 08ef0e6faa8..30065deef3d 100644 --- a/src/include/baconfig.h +++ b/src/include/baconfig.h @@ -104,15 +104,12 @@ void InitWinAPIWrapper(); #if defined(BUILDING_DLL) #define DLL_IMP_EXP _declspec(dllexport) +#define CATS_IMP_EXP _declspec(dllexport) #elif defined(USING_DLL) #define DLL_IMP_EXP _declspec(dllimport) -#else -#define DLL_IMP_EXP -#endif - -#if defined(USING_CATS) #define CATS_IMP_EXP _declspec(dllimport) #else +#define DLL_IMP_EXP #define CATS_IMP_EXP #endif diff --git a/src/win32/Makefile b/src/win32/Makefile index d7870cde785..05915d156a8 100644 --- a/src/win32/Makefile +++ b/src/win32/Makefile @@ -1,8 +1,28 @@ +# +# BAREOS® - Backup Archiving REcovery Open Sourced +# +# Copyright (C) 2014-2014 Bareos GmbH & Co. KG +# +# This program is Free Software; you can redistribute it and/or +# modify it under the terms of version three of the GNU Affero General Public +# License as published by the Free Software Foundation and included +# in the file LICENSE. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. +# include Makefile.inc VERSION_STRING := $(shell grep 'VERSION "' ../include/version.h | cut -d ' ' -f3) -all_subdirs = lib findlib filed stored console plugins +all_subdirs = lib findlib filed console tools cats dird stored plugins ifeq ($(BUILD_QTGUI),yes) all_subdirs += qt-console qt-tray-monitor endif @@ -36,11 +56,23 @@ distclean: done ifeq ($(BUILD_QTGUI),) -rc-files: console/consoleres.rc filed/filedres.rc stored/storedres.rc +rc-files: tools/bsmtpres.rc \ + console/consoleres.rc \ + filed/filedres.rc \ + stored/storedres.rc \ + dird/dirdres.rc \ + dird/dbcheckres.rc qt-gui: else -rc-files: console/consoleres.rc filed/filedres.rc stored/storedres.rc qt-console/batres.rc qt-tray-monitor/traymon.rc +rc-files: tools/bsmtpres.rc \ + console/consoleres.rc \ + filed/filedres.rc \ + stored/storedres.rc \ + dird/dirdres.rc \ + dird/dbcheckres.rc \ + qt-console/batres.rc \ + qt-tray-monitor/traymon.rc qt-gui: qt-console/Makefile qt-tray-monitor/Makefile @@ -57,6 +89,9 @@ qt-tray-monitor/traymon.rc: qt-tray-monitor/traymon.rc.in @sed -e 's/@VERSION@/$(VERSION_STRING)/' $< > $@ endif +tools/bsmtpres.rc: tools/bsmtpres.rc.in + @sed -e 's/@VERSION@/$(VERSION_STRING)/' $< > $@ + console/consoleres.rc: console/consoleres.rc.in @sed -e 's/@VERSION@/$(VERSION_STRING)/' $< > $@ @@ -65,3 +100,9 @@ filed/filedres.rc: filed/filedres.rc.in stored/storedres.rc: stored/storedres.rc.in @sed -e 's/@VERSION@/$(VERSION_STRING)/' $< > $@ + +dird/dirdres.rc: dird/dirdres.rc.in + @sed -e 's/@VERSION@/$(VERSION_STRING)/' $< > $@ + +dird/dbcheckres.rc: dird/dbcheckres.rc.in + @sed -e 's/@VERSION@/$(VERSION_STRING)/' $< > $@ diff --git a/src/win32/Makefile.inc b/src/win32/Makefile.inc index e5d7294a0dc..986bd922390 100644 --- a/src/win32/Makefile.inc +++ b/src/win32/Makefile.inc @@ -35,21 +35,25 @@ DEFINES = -DHAVE_WIN32 -DHAVE_MINGW -D_WIN32_WINNT=$(WINDOWS_VERSION) QMAKE = /usr/bin/i686-w64-mingw32-qmake WINDRES = /usr/bin/i686-w64-mingw32-windres CXX = /usr/bin/i686-w64-mingw32-g++ +ifeq ($(WIN_DEBUG),yes) +CXXFLAGS = $(DEFINES) $(INCLUDES) -Wall -m$(WIN_VERSION) -mwin32 -mthreads -fno-strict-aliasing -Wno-unknown-pragmas -g +else CXXFLAGS = $(DEFINES) $(INCLUDES) -Wall -m$(WIN_VERSION) -mwin32 -mthreads -O3 -fno-strict-aliasing -Wno-unknown-pragmas +endif MINGW_LIB = $(MINGW_32_BASE)/sys-root/mingw/lib else DEFINES = -DMINGW64 -DHAVE_WIN32 -DHAVE_MINGW -D_WIN32_WINNT=$(WINDOWS_VERSION) QMAKE = /usr/bin/x86_64-w64-mingw32-qmake WINDRES = /usr/bin/x86_64-w64-mingw32-windres CXX = /usr/bin/x86_64-w64-mingw32-g++ +ifeq ($(WIN_DEBUG),yes) +CXXFLAGS = $(DEFINES) $(INCLUDES) -Wall -m$(WIN_VERSION) -mwin32 -mthreads -fno-strict-aliasing -Wno-unknown-pragmas -g +else CXXFLAGS = $(DEFINES) $(INCLUDES) -Wall -m$(WIN_VERSION) -mwin32 -mthreads -O3 -fno-strict-aliasing -Wno-unknown-pragmas +endif MINGW_LIB = $(MINGW_64_BASE)/sys-root/mingw/lib endif WINSOCKLIB = -lws2_32 LDFLAGS_DLL = -mdll -mwindows LDFLAGS_WINAPP = -mwindows LDFLAGS_CONS = -mconsole - -ifeq ($(WIN_DEBUG),yes) -CXXFLAGS += -g -endif diff --git a/src/win32/README.OBS b/src/win32/README.OBS index 653d87bcac2..05753b469df 100644 --- a/src/win32/README.OBS +++ b/src/win32/README.OBS @@ -21,6 +21,8 @@ mingw32-runtime mingw32-zlib-devel mingw32-libqt4 mingw32-libqt4-devel +mingw32-libsqlite +mingw32-libsqlite-devel For mingw64: @@ -39,6 +41,8 @@ mingw64-readline-devel mingw64-runtime mingw64-zlib-devel mingw64-libqt4-devel +mingw64-libsqlite +mingw64-libsqlite-devel The Makefiles in this directory are setup to work with this setup. As the are seriously simple adapting to an other mingw install should be rather simple. diff --git a/src/win32/cats/Makefile b/src/win32/cats/Makefile new file mode 100644 index 00000000000..d8937516501 --- /dev/null +++ b/src/win32/cats/Makefile @@ -0,0 +1,74 @@ +# +# BAREOS® - Backup Archiving REcovery Open Sourced +# +# Copyright (C) 2014-2014 Bareos GmbH & Co. KG +# +# This program is Free Software; you can redistribute it and/or +# modify it under the terms of version three of the GNU Affero General Public +# License as published by the Free Software Foundation and included +# in the file LICENSE. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. +# +VPATH = .:../../cats + +include ../Makefile.inc + +INCLUDES = -I../.. \ + -I../../include \ + -I../include \ + -I../../findlib \ + -I../compat/include +LDLIBS = ../lib/libbareos.dll + +LIBBAREOSCATS_SRCS = bvfs.c cats.c cats_dynamic.c sql.c sql_cmds.c \ + sql_create.c sql_delete.c sql_find.c sql_get.c \ + sql_glue.c sql_list.c sql_pooling.c sql_update.c +LIBBAREOSCATS_OBJS = $(LIBBAREOSCATS_SRCS:.c=.o) + +DEFINES += -D_BDB_PRIV_INTERFACE_ + +DYNAMIC_OBJS = $(LIBBAREOSCATS_OBJS) + +all: libbareoscats.dll libbareoscats-postgresql.dll libbareoscats-sqlite3.dll + +bareos$(WIN_VERSION).def: $(DYNAMIC_OBJS) make_def + ./make_def $(WIN_VERSION) $(DYNAMIC_OBJS) > $@ + +libbareoscats.dll: DLL_USAGE = -DBUILDING_DLL +libbareoscats.dll: $(DYNAMIC_OBJS) \ + bareos$(WIN_VERSION).def + $(CXX) $(LDFLAGS_DLL) -Wl,--out-implib,$@.a $(DYNAMIC_OBJS) bareos$(WIN_VERSION).def $(LDLIBS) -o $@ + +postgresql.o: postgresql.c + @echo "Compiling $<" + $(CXX) $(DLL_USAGE) $(CXXFLAGS) -Ipgsql/include -c -o $@ $< + +libbareoscats-postgresql.dll: DLL_USAGE = -DBUILDING_DLL +libbareoscats-postgresql.dll: postgresql.o libbareoscats.dll + $(CXX) $(LDFLAGS_DLL) -Wl,--out-implib,$@.a postgresql.o $(LDLIBS) libbareoscats.dll pgsql/lib/$(WIN_VERSION)/libpq.dll -o $@ + +libbareoscats-sqlite3.dll: DLL_USAGE = -DBUILDING_DLL +libbareoscats-sqlite3.dll: sqlite.o libbareoscats.dll + $(CXX) $(LDFLAGS_DLL) -Wl,--out-implib,$@.a sqlite.o $(LDLIBS) libbareoscats.dll -lsqlite3 -o $@ + +clean: + rm -f *.o bareos$(WIN_VERSION).def + +distclean: clean + rm -f libbareoscats.dll libbareoscats.dll.a \ + libbareoscats-postgresql.dll libbareoscats-postgresql.dll.a \ + libbareoscats-sqlite3.dll libbareoscats-sqlite3.dll.a + +# inference rules +.c.o: + @echo "Compiling $<" + $(CXX) $(DLL_USAGE) $(CXXFLAGS) -c -o $@ $< diff --git a/src/win32/cats/make_def b/src/win32/cats/make_def new file mode 100755 index 00000000000..910bb6f830e --- /dev/null +++ b/src/win32/cats/make_def @@ -0,0 +1,61 @@ +#!/bin/sh +NM=nm + +case $1 in + 32) + SYMBOL_START=13 + ;; + 64) + SYMBOL_START=20 + ;; + *) + SYMBOL_START=13 + ;; +esac +shift + +echo "LIBRARY libbareoscats.dll" +echo "EXPORTS" +echo " " + +# +# Get all function symbols. +# +for i in $* +do + header=1 + ${NM} $i | grep "^[0-9a-f]* T " | cut -c${SYMBOL_START}- > /tmp/sym.$$ + while read symbol + do + if [ ${header} = 1 ]; then + echo "; $i" + header=0 + fi + echo "${symbol}" + done < /tmp/sym.$$ + if [ ${header} = 0 ]; then + echo " " + fi + rm -f /tmp/sym.$$ +done + +# +# Get all data symbols. +# +for i in $* +do + header=1 + ${NM} $i | grep "^[0-9a-f]* D " | cut -c${SYMBOL_START}- > /tmp/sym.$$ + while read symbol + do + if [ ${header} = 1 ]; then + echo "; $i" + header=0 + fi + echo "${symbol}" + done < /tmp/sym.$$ + if [ ${header} = 0 ]; then + echo " " + fi + rm -f /tmp/sym.$$ +done diff --git a/src/win32/compat/include/mingwconfig.h b/src/win32/compat/include/mingwconfig.h index 75296335d4a..2f320024ac5 100644 --- a/src/win32/compat/include/mingwconfig.h +++ b/src/win32/compat/include/mingwconfig.h @@ -419,4 +419,25 @@ /* Directory for daemon files */ #define _PATH_BAREOS_WORKINGDIR "%TEMP%" +/* Define to 1 if dynamic loading of catalog backends is enabled */ +#define HAVE_DYNAMIC_CATS_BACKENDS 1 + +/* Define to 1 if DB batch insert code enabled */ +#define USE_BATCH_FILE_INSERT 1 + +/* Set if you have an SQLite3 Database */ +#define HAVE_SQLITE3 1 + +/* Define to 1 if you have the `sqlite3_threadsafe' function. */ +#define HAVE_SQLITE3_THREADSAFE 1 + +/* Set if you have an PostgreSQL Database */ +#define HAVE_POSTGRESQL 1 + +/* Set if PostgreSQL DB batch insert code enabled */ +#define HAVE_POSTGRESQL_BATCH_FILE_INSERT 1 + +/* Set if have PQisthreadsafe */ +#define HAVE_PQISTHREADSAFE 1 + #endif /* __MINGWNCONFIG_H */ diff --git a/src/win32/console/Makefile b/src/win32/console/Makefile index f462cf70251..43a30fa2314 100644 --- a/src/win32/console/Makefile +++ b/src/win32/console/Makefile @@ -1,20 +1,32 @@ +# +# BAREOS® - Backup Archiving REcovery Open Sourced +# +# Copyright (C) 2014-2014 Bareos GmbH & Co. KG +# +# This program is Free Software; you can redistribute it and/or +# modify it under the terms of version three of the GNU Affero General Public +# License as published by the Free Software Foundation and included +# in the file LICENSE. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. +# VPATH = .:../../console include ../Makefile.inc -ifeq ($(WIN_VERSION),32) INCLUDES = -I../.. \ -I../../include \ -I../include \ -I../compat/include \ -I../vss/include -else -INCLUDES = -I../.. \ - -I../../include \ - -I../include \ - -I../compat/include \ - -I../vss/include -endif LDLIBS = ../lib/libbareos.a \ ../lib/libbareos.dll \ $(MINGW_LIB)/libpthreadGCE2.a \ diff --git a/src/win32/console/consoleres.rc.in b/src/win32/console/consoleres.rc.in index d8bd3131993..f95404def9f 100644 --- a/src/win32/console/consoleres.rc.in +++ b/src/win32/console/consoleres.rc.in @@ -11,7 +11,7 @@ BEGIN VALUE "FileDescription", "Bareos Console" VALUE "FileVersion", @VERSION@ VALUE "InternalName", "bconsole.exe" - VALUE "OriginalFilename", "bconsole" + VALUE "OriginalFilename", "bconsole.exe" VALUE "ProductName", "Bareos Console" VALUE "ProductVersion", @VERSION@ VALUE "LegalCopyright", "Copyright 2000-2012 Free Software Foundation Europe e.V. " diff --git a/src/win32/dird/Makefile b/src/win32/dird/Makefile new file mode 100644 index 00000000000..59604d0cff5 --- /dev/null +++ b/src/win32/dird/Makefile @@ -0,0 +1,80 @@ +# +# BAREOS® - Backup Archiving REcovery Open Sourced +# +# Copyright (C) 2014-2014 Bareos GmbH & Co. KG +# +# This program is Free Software; you can redistribute it and/or +# modify it under the terms of version three of the GNU Affero General Public +# License as published by the Free Software Foundation and included +# in the file LICENSE. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. +# +VPATH = .:../../dird:../generic + +include ../Makefile.inc + +INCLUDES = -I. \ + -I../.. \ + -I../../include \ + -I../include \ + -I../compat/include +LDLIBS = ../lib/libbareos.a \ + ../lib/libbareos.dll \ + ../findlib/libbareosfind.dll \ + ../cats/libbareoscats.dll \ + $(MINGW_LIB)/libpthreadGCE2.a \ + $(WINSOCKLIB) -lole32 -loleaut32 -luuid -lcomctl32 + +SVRSRCS = admin.c authenticate.c autoprune.c backup.c bsr.c catreq.c \ + dir_plugins.c dird_conf.c dird.c expand.c fd_cmds.c getmsg.c \ + inc_conf.c job.c jobq.c migrate.c mountreq.c msgchan.c \ + ndmp_dma.c newvol.c next_vol.c quota.c recycle.c restore.c \ + run_conf.c sd_cmds.c scheduler.c ua_acl.c ua_cmds.c \ + ua_dotcmds.c ua_input.c ua_impexp.c ua_label.c ua_output.c \ + ua_prune.c ua_purge.c ua_query.c ua_restore.c ua_run.c \ + ua_select.c ua_server.c ua_status.c ua_tree.c ua_update.c \ + vbackup.c verify.c service.c main.c +SVROBJS = $(SVRSRCS:.c=.o) + +DBCHKSRCS = dbcheck.c dird_conf.c ua_acl.c run_conf.c inc_conf.c +DBCHKOBJS = $(DBCHKSRCS:.c=.o) + +WINDRESSRCS = dirdres.rc +WINDRESOBJS = $(WINDRESSRCS:.rc=.o) + +DBCHKRESSRCS = dbcheckres.rc +DBCHKRESOBJS = $(DBCHKRESSRCS:.rc=.o) + +all: bareos-dir.exe dbcheck.exe + +bareos-dir.exe: DLL_USAGE = -DUSING_DLL +bareos-dir.exe: $(SVROBJS) $(WINDRESOBJS) + $(CXX) $(LDFLAGS_WINAPP) $(SVROBJS) $(WINDRESOBJS) $(LDLIBS) -o $@ + +dbcheck.exe: DLL_USAGE = -DUSING_DLL +dbcheck.exe: $(DBCHKOBJS) $(DBCHKRESOBJS) + $(CXX) $(LDFLAGS_CONS) $(DBCHKOBJS) $(LDLIBS) $(WINDRESOBJS) -o $@ + +clean: + rm -f *.o + +distclean:: clean + rm -f bareos-dir.exe dbcheck.exe + +# inference rules +.c.o: + @echo "Compiling $<" + $(CXX) $(DLL_USAGE) $(CXXFLAGS) -c -o $@ $< + +%.o : %.rc + @echo "Ressource Compiling $^" + $(WINDRES) $^ -o $@ diff --git a/src/win32/dird/dbcheckres.rc.in b/src/win32/dird/dbcheckres.rc.in new file mode 100644 index 00000000000..5118ac9643d --- /dev/null +++ b/src/win32/dird/dbcheckres.rc.in @@ -0,0 +1,31 @@ +id ICON "../../../platforms/win32/bareos.ico" +1 VERSIONINFO +FILEVERSION 1,0,0,0 +PRODUCTVERSION 1,0,0,0 +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "080904E4" + BEGIN + VALUE "CompanyName", "Bareos GmbH & Co. KG" + VALUE "FileDescription", "Bareos Database Check" + VALUE "FileVersion", @VERSION@ + VALUE "InternalName", "dbcheck.exe" + VALUE "OriginalFilename", "dbcheck.exe" + VALUE "ProductName", "Bareos Database Check" + VALUE "ProductVersion", @VERSION@ + VALUE "LegalCopyright", "Copyright 2000-2012 Free Software Foundation Europe e.V. " + "Copyright 2013-2014 Bareos GmbH & Co. KG " + VALUE "LegalTrademarks", "Licensed under GNU AGPLv3." + "This program is distributed in the hope that it will be useful, " + "but WITHOUT ANY WARRANTY; without even the implied warranty of " + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the " + "GNU Affero General Public License for more details. " + END + END + + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x809, 1252 + END +END diff --git a/src/win32/dird/dirdres.rc.in b/src/win32/dird/dirdres.rc.in new file mode 100644 index 00000000000..e749d4d131d --- /dev/null +++ b/src/win32/dird/dirdres.rc.in @@ -0,0 +1,31 @@ +id ICON "../../../platforms/win32/bareos.ico" +1 VERSIONINFO +FILEVERSION 1,0,0,0 +PRODUCTVERSION 1,0,0,0 +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "080904E4" + BEGIN + VALUE "CompanyName", "Bareos GmbH & Co. KG" + VALUE "FileDescription", "Bareos Director" + VALUE "FileVersion", @VERSION@ + VALUE "InternalName", "bareos-dir.exe" + VALUE "OriginalFilename", "bareos-dir.exe" + VALUE "ProductName", "Bareos Director" + VALUE "ProductVersion", @VERSION@ + VALUE "LegalCopyright", "Copyright 2000-2012 Free Software Foundation Europe e.V. " + "Copyright 2013-2014 Bareos GmbH & Co. KG " + VALUE "LegalTrademarks", "Licensed under GNU AGPLv3." + "This program is distributed in the hope that it will be useful, " + "but WITHOUT ANY WARRANTY; without even the implied warranty of " + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the " + "GNU Affero General Public License for more details. " + END + END + + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x809, 1252 + END +END diff --git a/src/win32/dird/who.h b/src/win32/dird/who.h new file mode 100644 index 00000000000..b6a22a09f4f --- /dev/null +++ b/src/win32/dird/who.h @@ -0,0 +1,31 @@ +/* + BAREOS® - Backup Archiving REcovery Open Sourced + + Copyright (C) 2007-2010 Free Software Foundation Europe e.V. + + This program is Free Software; you can redistribute it and/or + modify it under the terms of version three of the GNU Affero General Public + License as published by the Free Software Foundation, which is + listed in the file LICENSE. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. +*/ +/* + * Kern Sibbald, August 2007 + */ + +#define APP_NAME "Bareos-dir" +#define LC_APP_NAME "bareos-dir" +#define APP_DESC "Bareos Director Service" +#define SERVICE_DESC "Provides bareos director services." + +#define terminate_app(x) terminate_dird(x) +extern void terminate_dird(int sig); diff --git a/src/win32/filed/Makefile b/src/win32/filed/Makefile index 428a6c6c64c..2989533987e 100644 --- a/src/win32/filed/Makefile +++ b/src/win32/filed/Makefile @@ -1,3 +1,23 @@ +# +# BAREOS® - Backup Archiving REcovery Open Sourced +# +# Copyright (C) 2014-2014 Bareos GmbH & Co. KG +# +# This program is Free Software; you can redistribute it and/or +# modify it under the terms of version three of the GNU Affero General Public +# License as published by the Free Software Foundation and included +# in the file LICENSE. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. +# VPATH = .:../../filed:../generic include ../Makefile.inc diff --git a/src/win32/filed/who.h b/src/win32/filed/who.h index 1b8353b2daf..e0dddad54f5 100644 --- a/src/win32/filed/who.h +++ b/src/win32/filed/who.h @@ -25,6 +25,7 @@ #define APP_NAME "Bareos-fd" #define LC_APP_NAME "bareos-fd" #define APP_DESC "Bareos File Backup Service" +#define SERVICE_DESC "Provides file backup and restore services (bareos client)." #define terminate_app(x) terminate_filed(x) extern void terminate_filed(int sig); diff --git a/src/win32/findlib/Makefile b/src/win32/findlib/Makefile index fb8864b409c..94e3e48f9da 100644 --- a/src/win32/findlib/Makefile +++ b/src/win32/findlib/Makefile @@ -1,3 +1,23 @@ +# +# BAREOS® - Backup Archiving REcovery Open Sourced +# +# Copyright (C) 2014-2014 Bareos GmbH & Co. KG +# +# This program is Free Software; you can redistribute it and/or +# modify it under the terms of version three of the GNU Affero General Public +# License as published by the Free Software Foundation and included +# in the file LICENSE. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. +# VPATH = .:../../findlib include ../Makefile.inc diff --git a/src/win32/generic/service.c b/src/win32/generic/service.c index a901be206aa..80756d26d39 100644 --- a/src/win32/generic/service.c +++ b/src/win32/generic/service.c @@ -324,7 +324,7 @@ int installService(const char *cmdOpts) */ set_service_description(serviceManager, bareosService, - (char *)_("Provides file backup and restore services. BAREOS -- Backup Archiving REcovery Open Sourced")); + (char *)_(SERVICE_DESC)); CloseServiceHandle(serviceManager); CloseServiceHandle(bareosService); diff --git a/src/win32/lib/Makefile b/src/win32/lib/Makefile index a7bc919ef2a..5b6db7a09cf 100644 --- a/src/win32/lib/Makefile +++ b/src/win32/lib/Makefile @@ -1,3 +1,23 @@ +# +# BAREOS® - Backup Archiving REcovery Open Sourced +# +# Copyright (C) 2014-2014 Bareos GmbH & Co. KG +# +# This program is Free Software; you can redistribute it and/or +# modify it under the terms of version three of the GNU Affero General Public +# License as published by the Free Software Foundation and included +# in the file LICENSE. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. +# VPATH = .:../../lib:../compat include ../Makefile.inc diff --git a/src/win32/plugins/Makefile b/src/win32/plugins/Makefile index 78457121bf4..fb13244d320 100644 --- a/src/win32/plugins/Makefile +++ b/src/win32/plugins/Makefile @@ -1,3 +1,23 @@ +# +# BAREOS® - Backup Archiving REcovery Open Sourced +# +# Copyright (C) 2014-2014 Bareos GmbH & Co. KG +# +# This program is Free Software; you can redistribute it and/or +# modify it under the terms of version three of the GNU Affero General Public +# License as published by the Free Software Foundation and included +# in the file LICENSE. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. +# all_subdirs = filed stored all: diff --git a/src/win32/plugins/filed/Makefile b/src/win32/plugins/filed/Makefile index dce181d70bf..c0e56e5b187 100644 --- a/src/win32/plugins/filed/Makefile +++ b/src/win32/plugins/filed/Makefile @@ -1,8 +1,27 @@ +# +# BAREOS® - Backup Archiving REcovery Open Sourced +# +# Copyright (C) 2014-2014 Bareos GmbH & Co. KG +# +# This program is Free Software; you can redistribute it and/or +# modify it under the terms of version three of the GNU Affero General Public +# License as published by the Free Software Foundation and included +# in the file LICENSE. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. +# VPATH = .:../../../plugins/filed include ../../Makefile.inc -ifeq ($(WIN_VERSION),32) INCLUDES = -I../../.. \ -I../../../include \ -I../../../filed \ @@ -10,20 +29,17 @@ INCLUDES = -I../../.. \ -I../../include \ -I../../compat/include VDI_INCLUDES = -I../../vdi/include -else -INCLUDES = -I../../.. \ - -I../../../include \ - -I../../../filed \ - -I../../../plugins/filed \ - -I../../include \ - -I../../compat/include -VDI_INCLUDES = -I../../vdi/include -endif LDLIBS = ../../lib/libbareos.dll \ $(MINGW_LIB)/libpthreadGCE2.a \ $(MINGW_LIB)/libz.dll.a \ $(WINSOCKLIB) -lole32 -loleaut32 -luuid +ifeq ($(WIN_DEBUG),yes) +OPT_CXXFLAGS = $(CXXFLAGS) -O2 +else +OPT_CXXFLAGS = $(CXXFLAGS) +endif + all: bpipe-fd.dll mssqlvdi-fd.dll bpipe-fd.dll: DLL_USAGE = -DBUILDING_DLL @@ -33,7 +49,7 @@ bpipe-fd.dll: bpipe-fd.o mssqlvdi-fd.o: CXXFLAGS += -fpermissive mssqlvdi-fd.o: mssqlvdi-fd.c @echo "Compiling $<" - $(CXX) $(DLL_USAGE) $(CXXFLAGS) $(VDI_INCLUDES) -c -o $@ $< + $(CXX) $(DLL_USAGE) $(OPT_CXXFLAGS) $(VDI_INCLUDES) -c -o $@ $< mssqlvdi-fd.dll: DLL_USAGE = -DBUILDING_DLL mssqlvdi-fd.dll: mssqlvdi-fd.o diff --git a/src/win32/plugins/stored/Makefile b/src/win32/plugins/stored/Makefile index e5348487bc4..a39b85a352a 100644 --- a/src/win32/plugins/stored/Makefile +++ b/src/win32/plugins/stored/Makefile @@ -1,3 +1,23 @@ +# +# BAREOS® - Backup Archiving REcovery Open Sourced +# +# Copyright (C) 2014-2014 Bareos GmbH & Co. KG +# +# This program is Free Software; you can redistribute it and/or +# modify it under the terms of version three of the GNU Affero General Public +# License as published by the Free Software Foundation and included +# in the file LICENSE. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. +# VPATH = .:../../../plugins/stored include ../../Makefile.inc diff --git a/src/win32/stored/Makefile b/src/win32/stored/Makefile index 07f56fcf095..7d8053daa47 100644 --- a/src/win32/stored/Makefile +++ b/src/win32/stored/Makefile @@ -1,3 +1,23 @@ +# +# BAREOS® - Backup Archiving REcovery Open Sourced +# +# Copyright (C) 2014-2014 Bareos GmbH & Co. KG +# +# This program is Free Software; you can redistribute it and/or +# modify it under the terms of version three of the GNU Affero General Public +# License as published by the Free Software Foundation and included +# in the file LICENSE. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. +# VPATH = .:../../stored:../generic include ../Makefile.inc diff --git a/src/win32/stored/who.h b/src/win32/stored/who.h index 1fada4c53b5..77956cc7b83 100644 --- a/src/win32/stored/who.h +++ b/src/win32/stored/who.h @@ -24,7 +24,8 @@ #define APP_NAME "Bareos-sd" #define LC_APP_NAME "bareos-sd" -#define APP_DESC "Bareos Storage Backup Service" +#define APP_DESC "Bareos Storage Service" +#define SERVICE_DESC "Provides bareos storage services." #define terminate_app(x) terminate_stored(x) extern void terminate_stored(int sig); diff --git a/src/win32/tools/Makefile b/src/win32/tools/Makefile new file mode 100644 index 00000000000..648410b6f04 --- /dev/null +++ b/src/win32/tools/Makefile @@ -0,0 +1,61 @@ +# +# BAREOS® - Backup Archiving REcovery Open Sourced +# +# Copyright (C) 2014-2014 Bareos GmbH & Co. KG +# +# This program is Free Software; you can redistribute it and/or +# modify it under the terms of version three of the GNU Affero General Public +# License as published by the Free Software Foundation and included +# in the file LICENSE. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. +# +VPATH = .:../../tools + +include ../Makefile.inc + +INCLUDES = -I../.. \ + -I../../include \ + -I../include \ + -I../compat/include \ + -I../vss/include +LDLIBS = ../lib/libbareos.a \ + ../lib/libbareos.dll \ + $(MINGW_LIB)/libpthreadGCE2.a \ + $(MINGW_LIB)/libz.dll.a \ + $(WINSOCKLIB) -lole32 -loleaut32 -luuid + +BSMTPSRCS = bsmtp.c +BSMTPOBJS = $(BSMTPSRCS:.c=.o) + +WINDRESSRCS = bsmtpres.rc +WINDRESOBJS = $(WINDRESSRCS:.rc=.o) + +all: bsmtp.exe + +bsmtp.exe: DLL_USAGE = -DUSING_DLL +bsmtp.exe: $(BSMTPOBJS) $(WINDRESOBJS) + $(CXX) $(LDFLAGS_CONS) $(BSMTPOBJS) $(LDLIBS) $(WINDRESOBJS) -o $@ + +clean: + rm -f *.o + +distclean:: clean + rm -f bsmtp.exe + +# inference rules +.c.o: + @echo "Compiling $<" + $(CXX) $(DLL_USAGE) $(CXXFLAGS) -c -o $@ $< + +%.o : %.rc + @echo "Ressource Compiling $^" + $(WINDRES) $^ -o $@ diff --git a/src/win32/tools/bsmtpres.rc.in b/src/win32/tools/bsmtpres.rc.in new file mode 100644 index 00000000000..bf92ae08f4e --- /dev/null +++ b/src/win32/tools/bsmtpres.rc.in @@ -0,0 +1,31 @@ +id ICON "../../../platforms/win32/bareos.ico" +1 VERSIONINFO +FILEVERSION 1,0,0,0 +PRODUCTVERSION 1,0,0,0 +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "080904E4" + BEGIN + VALUE "CompanyName", "Bareos GmbH & Co. KG" + VALUE "FileDescription", "Bareos SMTP Client" + VALUE "FileVersion", @VERSION@ + VALUE "InternalName", "bsmtp.exe" + VALUE "OriginalFilename", "bsmtp.exe" + VALUE "ProductName", "Bareos SMTP Agent" + VALUE "ProductVersion", @VERSION@ + VALUE "LegalCopyright", "Copyright 2000-2012 Free Software Foundation Europe e.V. " + "Copyright 2013-2014 Bareos GmbH & Co. KG " + VALUE "LegalTrademarks", "Licensed under GNU AGPLv3." + "This program is distributed in the hope that it will be useful, " + "but WITHOUT ANY WARRANTY; without even the implied warranty of " + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the " + "GNU Affero General Public License for more details. " + END + END + + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x809, 1252 + END +END