Changes of Revision 9
[-] | Added | bacula.spec |
x 1
2 +# 3 +# spec file for package bacula (Version 2.4.3) 4 +# 5 +# Copyright (c) 2007 SUSE LINUX Products GmbH, Nuernberg, Germany. 6 +# This file and all modifications and additions to the pristine 7 +# package are under the same license as the package itself. 8 +# 9 +# Please submit bugfixes or comments via http://bugs.opensuse.org/ 10 +# 11 + 12 +Name: bacula 13 +%define _fwdefdir /etc/sysconfig/SuSEfirewall2.d/services 14 +BuildRequires: gcc-c++ libacl-devel sqlite-devel openssl-devel readline-devel tcpd-devel 15 +BuildRequires: xorg-x11-devel qt qt-devel python python-devel atk-devel 16 +BuildRequires: cairo-devel expat fontconfig-devel freetype2-devel glib2-devel glitz-devel 17 +BuildRequires: gtk2-devel libpng-devel pango-devel xorg-x11-devel zlib-devel 18 +%if 0%{?sles_version} > 10 || 0%{?suse_version} 19 +BuildRequires: libqwt5-devel libqwt5 20 +%endif 21 +License: GPL v2 or later 22 +Group: Productivity/Archiving/Backup 23 +Autoreqprov: on 24 +Version: 2.4.3 25 +Release: 1 26 +Summary: Bacula--The Network Backup Solution: Client Part 27 +URL: http://www.bacula.org 28 +Source0: %{name}-%{version}.tar.gz 29 +Source10: bacula-dir.init 30 +Source11: bacula-fd.init 31 +Source12: bacula-sd.init 32 +Source20: bacula-dir.fw 33 +Source21: bacula-fd.fw 34 +Source22: bacula-sd.fw 35 +#Patch: %{name}-%{version}-cflags.diff 36 +Patch1: 001-check-python26.diff 37 +Patch2: 2.4.3-cancel-after-network-outage.patch 38 +Patch3: 2.4.3-orphaned-jobs.patch 39 +Patch4: 2.4.3-prune-deadlock.patch 40 +Patch5: 2.4.3-update-slots.patch 41 +Patch6: 2.4.3-win32-runscript-unicode-path.patch 42 +BuildRoot: %{_tmppath}/%{name}-%{version}-build 43 + 44 +%description 45 +Bacula comes by night and sucks the vital essence from your computers. 46 +Bacula is a set of computer programs that permit you (or the system 47 +administrator) to manage backup, recovery, and verification of computer 48 +data across a network of computers of different kinds. In technical 49 +terms, it is a network client/server-based backup program. Bacula is 50 +relatively easy to use and efficient, while offering many advanced 51 +storage management features that make it easy to find and recover lost 52 +or damaged files. 53 + 54 + 55 + 56 +%debug_package 57 +%package server 58 +Summary: Bacula - The Network Backup Solution - server part 59 +Group: Productivity/Archiving/Backup 60 +Requires: bacula = %{version} 61 +Autoreqprov: on 62 + 63 +%description server 64 +Bacula - It comes by night and sucks the vital essence from your 65 +computers. Bacula is a set of computer programs that permit you (or the 66 +system administrator) to manage backup, recovery, and verification of 67 +computer data across a network of computers of different kinds. In 68 +technical terms, it is a network client/server based backup program. 69 +Bacula is relatively easy to use and efficient, while offering many 70 +advanced storage management features that make it easy to find and 71 +recover lost or damaged files. This package contains Bacula server 72 +daemons. 73 + 74 +%package gui 75 +Summary: Bacula - The Network Backup Solution - admin GUI 76 +Group: Productivity/Archiving/Backup 77 +Requires: bacula = %{version} 78 +Autoreqprov: on 79 + 80 +%description gui 81 +Bacula - It comes by night and sucks the vital essence from your 82 +computers. Bacula is a set of computer programs that permit you (or the 83 +system administrator) to manage backup, recovery, and verification of 84 +computer data across a network of computers of different kinds. In 85 +technical terms, it is a network client/server based backup program. 86 +Bacula is relatively easy to use and efficient, while offering many 87 +advanced storage management features that make it easy to find and 88 +recover lost or damaged files. This package contains Bacula GUI 89 +programs bat (QT) and tray monitor (KDE/Gnome). 90 + 91 + 92 + 93 +%prep 94 +%setup -q 95 +#%patch 96 +%patch1 -p1 97 +%patch2 98 +%patch3 99 +%patch4 100 +%patch5 101 +%patch6 102 + 103 +%build 104 +unset NOFORTIFY 105 +%if 0%{?suse_version} >= 1100 106 +# bacula will crash otherwise 107 +NOFORTIFY='-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0' 108 +%endif 109 +CFLAGS="-fno-strict-aliasing $RPM_OPT_FLAGS $NOFORTIFY" ./configure \ 110 + --prefix=%{_prefix} \ 111 + --libexecdir=%{_libdir} \ 112 + --sbindir=%{_sbindir} \ 113 + --bindir=%{_bindir} \ 114 + --libdir=%{_libdir} \ 115 + --infodir=%{_infodir} \ 116 + --mandir=%{_mandir} \ 117 + --sysconfdir=%{_sysconfdir}/bacula \ 118 + --with-working-dir=/var/lib/bacula/working \ 119 + --with-scriptdir=/usr/lib/bacula \ 120 + --with-sqlite3 \ 121 + --with-openssl \ 122 + --with-python=/usr/ \ 123 + --enable-bat \ 124 + --enable-tray-monitor \ 125 + --with-tcp-wrappers 126 +make CFLAGS="$RPM_OPT_FLAGS $NOFORTIFY" 127 + 128 +%install 129 +make DESTDIR=$RPM_BUILD_ROOT install 130 +install -m 755 src/qt-console/bat $RPM_BUILD_ROOT/%{_sbindir}/bat 131 +mkdir -p $RPM_BUILD_ROOT/etc/init.d 132 +install -m 755 %SOURCE10 $RPM_BUILD_ROOT/etc/init.d/bacula-dir 133 +install -m 755 %SOURCE11 $RPM_BUILD_ROOT/etc/init.d/bacula-fd 134 +install -m 755 %SOURCE12 $RPM_BUILD_ROOT/etc/init.d/bacula-sd 135 +ln -sf ../../etc/init.d/bacula-fd $RPM_BUILD_ROOT/%{_sbindir}/rcbacula-fd 136 +ln -sf ../../etc/init.d/bacula-sd $RPM_BUILD_ROOT/%{_sbindir}/rcbacula-sd 137 +ln -sf ../../etc/init.d/bacula-dir $RPM_BUILD_ROOT/%{_sbindir}/rcbacula-dir 138 +# remove /etc/bacula/startmysql 139 +# and /etc/bacula/stopmysql 140 +# as they are not needed (bug #145310) 141 +##rm $RPM_BUILD_ROOT/etc/bacula/startmysql $RPM_BUILD_ROOT/etc/bacula/stopmysql 142 +##rm $RPM_BUILD_ROOT/etc/bacula/bacula-ctl-dir $RPM_BUILD_ROOT/etc/bacula/bacula-ctl-fd $RPM_BUILD_ROOT/etc/bacula/bacula-ctl-sd 143 +rm $RPM_BUILD_ROOT/usr/lib/bacula/startmysql $RPM_BUILD_ROOT/usr/lib/bacula/stopmysql 144 +rm $RPM_BUILD_ROOT/usr/lib/bacula/bacula-ctl-dir $RPM_BUILD_ROOT/usr/lib/bacula/bacula-ctl-fd $RPM_BUILD_ROOT/usr/lib/bacula/bacula-ctl-sd 145 +#install fw definitions 146 +mkdir -p $RPM_BUILD_ROOT/%{_fwdefdir}/ 147 +install -m 755 %SOURCE20 $RPM_BUILD_ROOT/%{_fwdefdir}/bacula-dir 148 +install -m 755 %SOURCE21 $RPM_BUILD_ROOT/%{_fwdefdir}/bacula-fd 149 +install -m 755 %SOURCE22 $RPM_BUILD_ROOT/%{_fwdefdir}/bacula-sd 150 + 151 +%clean 152 +rm -rf $RPM_BUILD_ROOT 153 + 154 +%preun 155 +%stop_on_removal bacula-fd 156 + 157 +%postun 158 +%restart_on_update bacula-fd 159 +%insserv_cleanup 160 + 161 +%preun server 162 +%stop_on_removal bacula-dir bacula-sd 163 + 164 +%postun server 165 +%restart_on_update bacula-dir bacula-sd 166 +%insserv_cleanup 167 + 168 +%files 169 +%defattr(-,root,root) 170 +%config /etc/init.d/bacula-fd 171 +%doc ABOUT-NLS COPYING INSTALL LICENSE README VERIFYING ReleaseNotes projects 172 +%{_sbindir}/bacula-fd 173 +%{_sbindir}/rcbacula-fd 174 +%{_sbindir}/bconsole 175 +%{_sbindir}/btraceback 176 +%config(noreplace) /etc/bacula/bacula-fd.conf 177 +%config(noreplace) /etc/bacula/bconsole.conf 178 +/usr/lib/bacula/btraceback.dbx 179 +/usr/lib/bacula/btraceback.gdb 180 +/usr/lib/bacula/gconsole 181 +/usr/lib/bacula/mtx-changer 182 +/usr/lib/bacula/bacula 183 +/usr/lib/bacula/dvd-handler 184 +/usr/lib/bacula/disk-changer 185 +/usr/lib/bacula/bconsole 186 +%dir /etc/bacula 187 +%dir /usr/lib/bacula 188 +%dir /var/lib/bacula 189 +%dir /var/lib/bacula/working 190 +%config %{_fwdefdir}/bacula-fd 191 +%doc %{_mandir}/man8/* 192 +%doc %{_mandir}/man1/bsmtp.1.gz 193 + 194 +%files server 195 +%defattr(-,root,root) 196 +%config /etc/init.d/bacula-sd 197 +%config /etc/init.d/bacula-dir 198 +%{_sbindir}/bacula-dir 199 +%{_sbindir}/bacula-sd 200 +%{_sbindir}/rcbacula-dir 201 |
||
[+] | Added | 001-check-python26.diff ^ |
@@ -0,0 +1,73 @@ +--- bacula-2.4.3/configure.ori 2008-12-21 22:03:04.000000000 +0100 ++++ bacula-2.4.3/configure 2008-12-21 22:20:11.000000000 +0100 +@@ -15620,37 +15620,45 @@ + PYTHON_LIBS= + if test "$withval" != "no"; then + if test "$withval" = "yes"; then +- for python_root in /usr /usr/local /usr/sfw; do +- for ver in python2.2 python2.3 python2.4 python2.5; do +- if test -f $python_root/include/${ver}/Python.h; then +- PYTHON_INCDIR=-I$python_root/include/${ver} +- if test -d $python_root/lib64/${ver}/config; then +- PYTHON_LIBS="-L$python_root/lib64/${ver}/config -l${ver}" +- else +- PYTHON_LIBS="-L$python_root/lib/${ver}/config -l${ver}" +- fi +- break +- fi ++ if [ -a /usr/bin/python-config ] ; then ++ PYTHON_INCDIR=`python-config --includes` ++ PYTHON_LIBS=`python-config --libs` ++ else ++ for python_root in /usr /usr/local /usr/sfw; do ++ for ver in python2.2 python2.3 python2.4 python2.5; do ++ if test -f $python_root/include/${ver}/Python.h; then ++ PYTHON_INCDIR=-I$python_root/include/${ver} ++ if test -d $python_root/lib64/${ver}/config; then ++ PYTHON_LIBS="-L$python_root/lib64/${ver}/config -l${ver}" ++ else ++ PYTHON_LIBS="-L$python_root/lib/${ver}/config -l${ver}" ++ fi ++ break ++ fi ++ done + done +- done +- if test x$PYTHON_INCDIR = x; then +- if test -f $prefix/include/Python.h; then +- PYTHON_INCDIR=-I$prefix/include +- if test -d $prefix/lib64/config; then +- PYTHON_LIBS="-L$prefix/lib64/config -lpython" +- else +- PYTHON_LIBS="-L$prefix/lib/config -lpython" +- fi +- else +- { echo "$as_me:$LINENO: result: no" >&5 ++ if test x$PYTHON_INCDIR = x; then ++ if test -f $prefix/include/Python.h; then ++ PYTHON_INCDIR=-I$prefix/include ++ if test -d $prefix/lib64/config; then ++ PYTHON_LIBS="-L$prefix/lib64/config -lpython" ++ else ++ PYTHON_LIBS="-L$prefix/lib/config -lpython" ++ fi ++ else ++ { echo "$as_me:$LINENO: result: no" >&5 + echo "${ECHO_T}no" >&6; } +- { { echo "$as_me:$LINENO: error: Unable to find Python.h in standard locations" >&5 ++ { { echo "$as_me:$LINENO: error: Unable to find Python.h in standard locations" >&5 + echo "$as_me: error: Unable to find Python.h in standard locations" >&2;} +- { (exit 1); exit 1; }; } ++ { (exit 1); exit 1; }; } ++ fi + fi + fi + else +- if test -f $withval/Python.h; then ++ if test -x $withval/bin/python-config ; then ++ PYTHON_INCDIR=`python-config --includes` ++ PYTHON_LIBS=`python-config --libs` ++ elif test -f $withval/Python.h; then + PYTHON_INCDIR=-I$withval + PYTHON_LIBS="-L$withval/config -lpython" + elif test -f $withval/include/Python.h; then | ||
[+] | Added | 2.4.3-cancel-after-network-outage.patch ^ |
@@ -0,0 +1,135 @@ + + This patch fixes a problem when canceling job if client looses + connection while being backed up + Apply the patch to version 2.4.3 (and previous versions) with: + + cd <bacula-source> + patch -p0 <2.4.3-cancel-after-network-outage.patch + ./configure <your-options> + make + ... + make install + + +Index: src/dird/backup.c +=================================================================== +--- src/dird/backup.c (révision 7772) ++++ src/dird/backup.c (copie de travail) +@@ -240,14 +240,16 @@ + } + return false; + +-/* Come here only after starting SD thread */ ++/* Come here only after starting SD thread ++ * and we don't expect any EndJob message because the ++ * the client don't have recieve the "backup" command. ++ */ + bail_out: + set_jcr_job_status(jcr, JS_ErrorTerminated); +- Dmsg1(400, "wait for sd. use=%d\n", jcr->use_count()); +- /* Cancel SD */ +- cancel_storage_daemon_job(jcr); +- wait_for_storage_daemon_termination(jcr); +- Dmsg1(400, "after wait for sd. use=%d\n", jcr->use_count()); ++ Dmsg1(400, "wait for sd and fd. use=%d\n", jcr->use_count()); ++ /* Get status from SD and FD */ ++ wait_for_job_termination(jcr, false /* don't expect EndJob message*/); ++ Dmsg1(400, "after wait for sd and fd. use=%d\n", jcr->use_count()); + return false; + } + +@@ -258,7 +260,7 @@ + * are done, we return the job status. + * Also used by restore.c + */ +-int wait_for_job_termination(JCR *jcr) ++int wait_for_job_termination(JCR *jcr, bool expect_EndJob) + { + int32_t n = 0; + BSOCK *fd = jcr->file_bsock; +@@ -270,30 +272,51 @@ + int Encrypt = 0; + + set_jcr_job_status(jcr, JS_Running); +- /* Wait for Client to terminate */ +- while ((n = bget_dirmsg(fd)) >= 0) { +- if (!fd_ok && +- (sscanf(fd->msg, EndJob, &jcr->FDJobStatus, &JobFiles, +- &ReadBytes, &JobBytes, &Errors, &VSS, &Encrypt) == 7 || +- sscanf(fd->msg, OldEndJob, &jcr->FDJobStatus, &JobFiles, +- &ReadBytes, &JobBytes, &Errors) == 5)) { +- fd_ok = true; +- set_jcr_job_status(jcr, jcr->FDJobStatus); +- Dmsg1(100, "FDStatus=%c\n", (char)jcr->JobStatus); +- } else { +- Jmsg(jcr, M_WARNING, 0, _("Unexpected Client Job message: %s\n"), +- fd->msg); ++ ++ ++ if (fd) { ++ /* Wait for Client to terminate ++ * In some conditions, the client isn't able to send ++ * any messages and we should not wait for ages ++ */ ++ int OK=true; ++ int ret; ++ while (OK && expect_EndJob) { ++ ++ /* Even if the job is canceled, we let a chance to FD to ++ * send EndJob message ++ */ ++ if (job_canceled(jcr)) { ++ OK=false; ++ } ++ ++ /* wait for data few minutes */ ++ ret = fd->wait_data_intr(3*60, 0); ++ if (ret == 1) { /* get data */ ++ n = bget_dirmsg(fd); ++ if (n >= 0 && ++ (sscanf(fd->msg, EndJob, &jcr->FDJobStatus, &JobFiles, ++ &ReadBytes, &JobBytes, &Errors, &VSS, &Encrypt) == 7 || ++ sscanf(fd->msg, OldEndJob, &jcr->FDJobStatus, &JobFiles, ++ &ReadBytes, &JobBytes, &Errors) == 5)) { ++ fd_ok = true; ++ set_jcr_job_status(jcr, jcr->FDJobStatus); ++ OK=false; /* end of loop */ ++ } else { ++ Jmsg(jcr, M_WARNING, 0, _("Unexpected Client Job message: %s\n"), ++ fd->msg); ++ } ++ } /* else get timeout or network error */ ++ ++ if (is_bnet_error(fd)) { ++ Jmsg(jcr, M_FATAL, 0, _("Network error with FD during %s: ERR=%s\n"), ++ job_type_to_str(jcr->JobType), fd->bstrerror()); ++ OK=false; ++ } + } +- if (job_canceled(jcr)) { +- break; +- } +- } + +- if (is_bnet_error(fd)) { +- Jmsg(jcr, M_FATAL, 0, _("Network error with FD during %s: ERR=%s\n"), +- job_type_to_str(jcr->JobType), fd->bstrerror()); ++ fd->signal(BNET_TERMINATE); /* tell Client we are terminating */ + } +- fd->signal(BNET_TERMINATE); /* tell Client we are terminating */ + + /* Force cancel in SD if failing */ + if (job_canceled(jcr) || !fd_ok) { +Index: src/dird/protos.h +=================================================================== +--- src/dird/protos.h (révision 7772) ++++ src/dird/protos.h (copie de travail) +@@ -52,7 +52,7 @@ + extern bool find_recycled_volume(JCR *jcr, bool InChanger, MEDIA_DBR *mr); + + /* backup.c */ +-extern int wait_for_job_termination(JCR *jcr); ++extern int wait_for_job_termination(JCR *jcr, bool expect_EndJob=true); + extern bool do_backup_init(JCR *jcr); + extern bool do_backup(JCR *jcr); + extern void backup_cleanup(JCR *jcr, int TermCode); | ||
[+] | Added | 2.4.3-orphaned-jobs.patch ^ |
@@ -0,0 +1,24 @@ + + This patch fixes a case of orphaned jobs (and possible deadlock) + during pruning. + Apply it to Bacula 2.4.3 (possibly earlier versions) with: + + cd <bacula-source> + patch -p0 <2.4.3-orphaned-jobs.patch + ./configure <your-options> + make + ... + make install + +Index: src/dird/ua_prune.c +=================================================================== +--- src/dird/ua_prune.c (revision 7949) ++++ src/dird/ua_prune.c (working copy) +@@ -468,6 +468,7 @@ + break; + } + } ++ endeach_jcr(jcr); + if (skip) { + continue; + } | ||
[+] | Added | 2.4.3-prune-deadlock.patch ^ |
@@ -0,0 +1,56 @@ + + This patch corrects a deadlock that can occure when using the catalog + as message backend and the director decides to prune volumes. + + Apply it to Bacula 2.4.3 (possibly earlier versions) + with: + + cd <bacula-source> + patch -p0 <2.4.3-prune-deadlock.patch + ./configure <your-options> + make + ... + make install + + +Index: src/lib/jcr.c +=================================================================== +--- src/lib/jcr.c (révision 8063) ++++ src/lib/jcr.c (copie de travail) +@@ -438,7 +438,6 @@ + + #endif + +- dequeue_messages(jcr); + lock_jcr_chain(); + jcr->dec_use_count(); /* decrement use count */ + if (jcr->use_count() < 0) { +@@ -455,6 +454,7 @@ + remove_jcr(jcr); /* remove Jcr from chain */ + unlock_jcr_chain(); + ++ dequeue_messages(jcr); + job_end_pop(jcr); /* pop and call hooked routines */ + + Dmsg1(3400, "End job=%d\n", jcr->JobId); +Index: src/dird/ua_prune.c +=================================================================== +--- src/dird/ua_prune.c (révision 8100) ++++ src/dird/ua_prune.c (copie de travail) +@@ -435,8 +435,6 @@ + return 0; /* cannot prune Archived volumes */ + } + +- db_lock(ua->db); +- + /* + * Now add to the list of JobIds for Jobs written to this Volume + */ +@@ -477,6 +475,5 @@ + } + + bail_out: +- db_unlock(ua->db); + return count; + } + | ||
[+] | Added | 2.4.3-update-slots.patch ^ |
@@ -0,0 +1,79 @@ + + This patch corrects a problem when removing a volume from + an autochanger and the slot is still empty when running + update slots command. #1175 + + Apply it to version 2.4.3 with: + + cd <bacula-source> + patch -p0 <2.4.3-update-slots.patch + ./configure <your-options> + make + ... + make install + +Index: src/cats/sql_update.c +=================================================================== +--- src/cats/sql_update.c (revision 7854) ++++ src/cats/sql_update.c (working copy) +@@ -445,14 +445,28 @@ + db_make_inchanger_unique(JCR *jcr, B_DB *mdb, MEDIA_DBR *mr) + { + char ed1[50], ed2[50]; +- if (mr->InChanger != 0 && mr->Slot != 0 && mr->StorageId != 0 && +- mr->MediaId != 0) { +- Mmsg(mdb->cmd, "UPDATE Media SET InChanger=0 WHERE " +- "Slot=%d AND StorageId=%s AND MediaId!=%s", +- mr->Slot, +- edit_int64(mr->StorageId, ed1), edit_int64(mr->MediaId, ed2)); +- Dmsg1(400, "%s\n", mdb->cmd); +- UPDATE_DB(jcr, mdb, mdb->cmd); ++ if (mr->InChanger != 0 && mr->Slot != 0 && mr->StorageId != 0) { ++ ++ if (mr->MediaId != 0) { ++ Mmsg(mdb->cmd, "UPDATE Media SET InChanger=0 WHERE " ++ "Slot=%d AND StorageId=%s AND MediaId!=%s", ++ mr->Slot, ++ edit_int64(mr->StorageId, ed1), edit_int64(mr->MediaId, ed2)); ++ ++ } else if (mr->VolumeName[0]) { /* We have a volume name */ ++ Mmsg(mdb->cmd, "UPDATE Media SET InChanger=0 WHERE " ++ "Slot=%d AND StorageId=%s AND VolumeName!='%s'", ++ mr->Slot, ++ edit_int64(mr->StorageId, ed1), mr->VolumeName); ++ ++ } else { /* used by ua_label to reset all volume with this slot */ ++ Mmsg(mdb->cmd, "UPDATE Media SET InChanger=0 WHERE " ++ "Slot=%d AND StorageId=%s", ++ mr->Slot, ++ edit_int64(mr->StorageId, ed1), mr->VolumeName); ++ } ++ Dmsg1(100, "%s\n", mdb->cmd); ++ UPDATE_DB(jcr, mdb, mdb->cmd); + } + } + +Index: src/cats/sql_create.c +=================================================================== +--- src/cats/sql_create.c (revision 7854) ++++ src/cats/sql_create.c (working copy) +@@ -459,14 +459,13 @@ + "WHERE MediaId=%d", dt, mr->MediaId); + stat = UPDATE_DB(jcr, mdb, mdb->cmd); + } ++ /* ++ * Make sure that if InChanger is non-zero any other identical slot ++ * has InChanger zero. ++ */ ++ db_make_inchanger_unique(jcr, mdb, mr); + } + +- /* +- * Make sure that if InChanger is non-zero any other identical slot +- * has InChanger zero. +- */ +- db_make_inchanger_unique(jcr, mdb, mr); +- + db_unlock(mdb); + return stat; + } | ||
[+] | Added | 2.4.3-win32-runscript-unicode-path.patch ^ |
@@ -0,0 +1,289 @@ + + This patch fix #1110 about a problem when executing a program with + Unicode path. + + It can be applied to 2.4.3 (and previous versions) with: + + cd <bacula-source> + patch -p0 <2.4.3-win32-runscript-unicode-path.patch + ./configure <your-options> + make + ... + make install + + +Index: src/win32/compat/compat.cpp +=================================================================== +--- src/win32/compat/compat.cpp (révision 7772) ++++ src/win32/compat/compat.cpp (copie de travail) +@@ -1807,6 +1807,97 @@ + } + + /** ++ * Create the process with UTF8 API ++ */ ++static BOOL ++CreateChildProcessW(const char *comspec, const char *cmdLine, ++ PROCESS_INFORMATION *hProcInfo, ++ HANDLE in, HANDLE out, HANDLE err) ++{ ++ STARTUPINFOW siStartInfo; ++ BOOL bFuncRetn = FALSE; ++ ++ // Set up members of the STARTUPINFO structure. ++ ZeroMemory( &siStartInfo, sizeof(siStartInfo) ); ++ siStartInfo.cb = sizeof(siStartInfo); ++ // setup new process to use supplied handles for stdin,stdout,stderr ++ ++ siStartInfo.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW; ++ siStartInfo.wShowWindow = SW_SHOWMINNOACTIVE; ++ ++ siStartInfo.hStdInput = in; ++ siStartInfo.hStdOutput = out; ++ siStartInfo.hStdError = err; ++ ++ // Convert argument to WCHAR ++ POOLMEM *cmdLine_wchar = get_pool_memory(PM_FNAME); ++ POOLMEM *comspec_wchar = get_pool_memory(PM_FNAME); ++ ++ UTF8_2_wchar(&cmdLine_wchar, cmdLine); ++ UTF8_2_wchar(&comspec_wchar, comspec); ++ ++ // Create the child process. ++ Dmsg2(150, "Calling CreateProcess(%s, %s, ...)\n", comspec_wchar, cmdLine_wchar); ++ ++ // try to execute program ++ bFuncRetn = p_CreateProcessW((WCHAR*)comspec_wchar, ++ (WCHAR*)cmdLine_wchar,// command line ++ NULL, // process security attributes ++ NULL, // primary thread security attributes ++ TRUE, // handles are inherited ++ 0, // creation flags ++ NULL, // use parent's environment ++ NULL, // use parent's current directory ++ &siStartInfo, // STARTUPINFO pointer ++ hProcInfo); // receives PROCESS_INFORMATION ++ ++ free_pool_memory(cmdLine_wchar); ++ free_pool_memory(comspec_wchar); ++ ++ return bFuncRetn; ++} ++ ++ ++/** ++ * Create the process with ANSI API ++ */ ++static BOOL ++CreateChildProcessA(const char *comspec, char *cmdLine, ++ PROCESS_INFORMATION *hProcInfo, ++ HANDLE in, HANDLE out, HANDLE err) ++{ ++ STARTUPINFOA siStartInfo; ++ BOOL bFuncRetn = FALSE; ++ ++ // Set up members of the STARTUPINFO structure. ++ ZeroMemory( &siStartInfo, sizeof(siStartInfo) ); ++ siStartInfo.cb = sizeof(siStartInfo); ++ // setup new process to use supplied handles for stdin,stdout,stderr ++ siStartInfo.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW; ++ siStartInfo.wShowWindow = SW_SHOWMINNOACTIVE; ++ ++ siStartInfo.hStdInput = in; ++ siStartInfo.hStdOutput = out; ++ siStartInfo.hStdError = err; ++ ++ // Create the child process. ++ Dmsg2(150, "Calling CreateProcess(%s, %s, ...)\n", comspec, cmdLine); ++ ++ // try to execute program ++ bFuncRetn = p_CreateProcessA(comspec, ++ cmdLine, // command line ++ NULL, // process security attributes ++ NULL, // primary thread security attributes ++ TRUE, // handles are inherited ++ 0, // creation flags ++ NULL, // use parent's environment ++ NULL, // use parent's current directory ++ &siStartInfo,// STARTUPINFO pointer ++ hProcInfo);// receives PROCESS_INFORMATION ++ return bFuncRetn; ++} ++ ++/** + * OK, so it would seem CreateProcess only handles true executables: + * .com or .exe files. So grab $COMSPEC value and pass command line to it. + */ +@@ -1815,44 +1906,30 @@ + { + static const char *comspec = NULL; + PROCESS_INFORMATION piProcInfo; +- STARTUPINFOA siStartInfo; + BOOL bFuncRetn = FALSE; + +- if (comspec == NULL) { ++ if (!p_CreateProcessA || !p_CreateProcessW) ++ return INVALID_HANDLE_VALUE; ++ ++ if (comspec == NULL) + comspec = getenv("COMSPEC"); +- } + if (comspec == NULL) // should never happen + return INVALID_HANDLE_VALUE; + + // Set up members of the PROCESS_INFORMATION structure. + ZeroMemory( &piProcInfo, sizeof(PROCESS_INFORMATION) ); + +- // Set up members of the STARTUPINFO structure. +- +- ZeroMemory( &siStartInfo, sizeof(STARTUPINFO) ); +- siStartInfo.cb = sizeof(STARTUPINFO); +- // setup new process to use supplied handles for stdin,stdout,stderr + // if supplied handles are not used the send a copy of our STD_HANDLE + // as appropriate +- siStartInfo.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW; +- siStartInfo.wShowWindow = SW_SHOWMINNOACTIVE; ++ if (in == INVALID_HANDLE_VALUE) ++ in = GetStdHandle(STD_INPUT_HANDLE); + +- if (in != INVALID_HANDLE_VALUE) +- siStartInfo.hStdInput = in; +- else +- siStartInfo.hStdInput = GetStdHandle(STD_INPUT_HANDLE); ++ if (out == INVALID_HANDLE_VALUE) ++ out = GetStdHandle(STD_OUTPUT_HANDLE); + +- if (out != INVALID_HANDLE_VALUE) +- siStartInfo.hStdOutput = out; +- else +- siStartInfo.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE); +- if (err != INVALID_HANDLE_VALUE) +- siStartInfo.hStdError = err; +- else +- siStartInfo.hStdError = GetStdHandle(STD_ERROR_HANDLE); ++ if (err == INVALID_HANDLE_VALUE) ++ err = GetStdHandle(STD_ERROR_HANDLE); + +- // Create the child process. +- + char *exeFile; + const char *argStart; + +@@ -1860,43 +1937,32 @@ + return INVALID_HANDLE_VALUE; + } + +- int cmdLen = strlen(comspec) + 4 + strlen(exeFile) + strlen(argStart) + 1; ++ POOL_MEM cmdLine(PM_FNAME); ++ Mmsg(cmdLine, "%s /c %s%s", comspec, exeFile, argStart); + +- char *cmdLine = (char *)alloca(cmdLen); +- +- snprintf(cmdLine, cmdLen, "%s /c %s%s", comspec, exeFile, argStart); +- + free(exeFile); + +- Dmsg2(150, "Calling CreateProcess(%s, %s, ...)\n", comspec, cmdLine); ++ if (p_CreateProcessW && p_MultiByteToWideChar) { ++ bFuncRetn = CreateChildProcessW(comspec, cmdLine.c_str(), &piProcInfo, ++ in, out, err); ++ } else { ++ bFuncRetn = CreateChildProcessA(comspec, cmdLine.c_str(), &piProcInfo, ++ in, out, err); ++ } + +- // try to execute program +- bFuncRetn = CreateProcessA(comspec, +- cmdLine, // command line +- NULL, // process security attributes +- NULL, // primary thread security attributes | ||
Added | bacula-2.4.3.tar.gz ^ | |
[+] | Added | bacula-dir.fw ^ |
@@ -0,0 +1,4 @@ +## Description: Bacula Director + +# space separated list of allowed TCP ports +TCP="9101" | ||
[+] | Added | bacula-dir.init ^ |
@@ -0,0 +1,88 @@ +#! /bin/sh + +# Copyright (c) 2005 SUSE Linux AG, Nuernberg, Germany. +# All rights reserved. + +### BEGIN INIT INFO +# Provides: bacula-dir +# Required-Start: $local_fs $remote_fs $network mysql +# Required-Stop: $local_fs $remote_fs $network mysql +# Default-Start: 3 5 +# Default-Stop: 0 1 2 6 +# Short-Description: bacula director +# Description: Bacula network backup system director daemon +### END INIT INFO + +# Shell functions sourced from /etc/rc.status: +# rc_check check and set local and overall rc status +# rc_status check and set local and overall rc status +# rc_status -v ditto but be verbose in local rc status +# rc_status -v -r ditto and clear the local rc status +# rc_failed set local and overall rc status to failed +# rc_failed <num> set local and overall rc status to <num><num> +# rc_reset clear local rc status (overall remains) +# rc_exit exit appropriate to overall rc status + +. /etc/rc.status + +BACULA_FD_BIN=/usr/sbin/bacula-dir +test -x $BACULA_FD_BIN || { echo "$BACULA_FD_BIN not installed"; + if [ "$1" = "stop" ]; then exit 0; + else exit 5; fi; } + + +case "$1" in + start) + echo -n "Starting the Bacula Director daemon" + startproc -q $BACULA_FD_BIN -c /etc/bacula/bacula-dir.conf + + rc_status -v + ;; + + + stop) + echo -n "Shutting down the Bacula Director daemon" + + killproc -TERM $BACULA_FD_BIN + + rc_status -v + ;; + try-restart|condrestart) + if test "$1" = "condrestart"; then + echo "${attn} Use try-restart ${done}(LSB)${attn} rather than condrestart ${warn}(RH)${norm}" + fi + $0 status + if test $? = 0; then + $0 restart + else + rc_reset + fi + rc_status + ;; + restart) + $0 stop + $0 start + + rc_status + ;; + force-reload) + + $0 try-restart + rc_status + ;; + reload) + rc_failed 3 + rc_status -v + ;; + status) + echo -n "Checking for service the Bacula Director daemon" + checkproc $BACULA_FD_BIN + rc_status -v + ;; + *) + echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload}" + exit 1 + ;; +esac +rc_exit + | ||
[+] | Added | bacula-fd.fw ^ |
@@ -0,0 +1,4 @@ +## Description: Bacula File Daemon + +# space separated list of allowed TCP ports +TCP="9102" | ||
[+] | Added | bacula-fd.init ^ |
@@ -0,0 +1,89 @@ +#! /bin/sh + +# Copyright (c) 2005 SUSE Linux AG, Nuernberg, Germany. +# All rights reserved. + + +### BEGIN INIT INFO +# Provides: bacula-fd +# Required-Start: $local_fs $remote_fs $network +# Required-Stop: $local_fs $remote_fs $network +# Default-Start: 3 5 +# Default-Stop: 0 1 2 6 +# Short-Description: bacula file daemon +# Description: Bacula network backup system file daemon +### END INIT INFO + +# Shell functions sourced from /etc/rc.status: +# rc_check check and set local and overall rc status +# rc_status check and set local and overall rc status +# rc_status -v ditto but be verbose in local rc status +# rc_status -v -r ditto and clear the local rc status +# rc_failed set local and overall rc status to failed +# rc_failed <num> set local and overall rc status to <num><num> +# rc_reset clear local rc status (overall remains) +# rc_exit exit appropriate to overall rc status + +. /etc/rc.status + +BACULA_FD_BIN=/usr/sbin/bacula-fd +test -x $BACULA_FD_BIN || { echo "$BACULA_FD_BIN not installed"; + if [ "$1" = "stop" ]; then exit 0; + else exit 5; fi; } + + +case "$1" in + start) + echo -n "Starting the Bacula File daemon" + startproc -q $BACULA_FD_BIN -c /etc/bacula/bacula-fd.conf + + rc_status -v + ;; + + + stop) + echo -n "Shutting down the Bacula File daemon" + + killproc -TERM $BACULA_FD_BIN + + rc_status -v + ;; + try-restart|condrestart) + if test "$1" = "condrestart"; then + echo "${attn} Use try-restart ${done}(LSB)${attn} rather than condrestart ${warn}(RH)${norm}" + fi + $0 status + if test $? = 0; then + $0 restart + else + rc_reset + fi + rc_status + ;; + restart) + $0 stop + $0 start + + rc_status + ;; + force-reload) + + $0 try-restart + rc_status + ;; + reload) + rc_failed 3 + rc_status -v + ;; + status) + echo -n "Checking for service the Bacula File daemon" + checkproc $BACULA_FD_BIN + rc_status -v + ;; + *) + echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload}" + exit 1 + ;; +esac +rc_exit + | ||
[+] | Added | bacula-sd.fw ^ |
@@ -0,0 +1,4 @@ +## Description: Bacula Storage Daemon + +# space separated list of allowed TCP ports +TCP="9103" | ||
[+] | Added | bacula-sd.init ^ |
@@ -0,0 +1,88 @@ +#! /bin/sh + +# Copyright (c) 2005 SUSE Linux AG, Nuernberg, Germany. +# All rights reserved. + +### BEGIN INIT INFO +# Provides: bacula-sd +# Required-Start: $local_fs $remote_fs $network +# Required-Stop: $local_fs $remote_fs $network +# Default-Start: 3 5 +# Default-Stop: 0 1 2 6 +# Short-Description: bacula storage daemon +# Description: Bacula network backup system storage daemon +### END INIT INFO + +# Shell functions sourced from /etc/rc.status: +# rc_check check and set local and overall rc status +# rc_status check and set local and overall rc status +# rc_status -v ditto but be verbose in local rc status +# rc_status -v -r ditto and clear the local rc status +# rc_failed set local and overall rc status to failed +# rc_failed <num> set local and overall rc status to <num><num> +# rc_reset clear local rc status (overall remains) +# rc_exit exit appropriate to overall rc status + +. /etc/rc.status + +BACULA_SD_BIN=/usr/sbin/bacula-sd +test -x $BACULA_SD_BIN || { echo "$BACULA_SD_BIN not installed"; + if [ "$1" = "stop" ]; then exit 0; + else exit 5; fi; } + + +case "$1" in + start) + echo -n "Starting the Bacula Storage daemon" + startproc -q $BACULA_SD_BIN -c /etc/bacula/bacula-sd.conf + + rc_status -v + ;; + + + stop) + echo -n "Shutting down the Bacula Storage daemon" + + killproc -TERM $BACULA_SD_BIN + + rc_status -v + ;; + try-restart|condrestart) + if test "$1" = "condrestart"; then + echo "${attn} Use try-restart ${done}(LSB)${attn} rather than condrestart ${warn}(RH)${norm}" + fi + $0 status + if test $? = 0; then + $0 restart + else + rc_reset + fi + rc_status + ;; + restart) + $0 stop + $0 start + + rc_status + ;; + force-reload) + + $0 try-restart + rc_status + ;; + reload) + rc_failed 3 + rc_status -v + ;; + status) + echo -n "Checking for service the Bacula Storage daemon" + checkproc $BACULA_SD_BIN + rc_status -v + ;; + *) + echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload}" + exit 1 + ;; +esac +rc_exit + |