Changes of Revision 6
[-] | Changed | bacula.spec |
x 1
2 3 Name: bacula 4 %define _fwdefdir /etc/sysconfig/SuSEfirewall2.d/services 5 -BuildRequires: gcc-c++ libacl-devel mysql-devel openssl-devel readline-devel xorg-x11-devel bc procps iputils 6 +BuildRequires: gcc-c++ libacl-devel mysql-devel openssl-devel readline-devel xorg-x11-devel bc procps iputils postgresql-devel 7 8 %if 0%{?suse_version} 9 -BuildRequires: tcpd-devel 10 +BuildRequires: tcpd-devel postgresql-libs 11 %endif 12 13 %if 0%{?rhel_version} || 0%{?centos_version} || 0%{?fedora_version} 14 BuildRequires: tcp_wrappers 15 %endif 16 + 17 %if 0%{?fedora_version} >= 7 18 BuildRequires: tcp_wrappers-devel 19 %endif 20
21 Summary: Bacula--The Network Backup Solution: Client Part 22 Url: http://www.bacula.org 23 Source0: %{name}-%{version}.tar.bz2 24 +%if 0%{?suse_version} 25 Source10: bacula-dir.init 26 Source11: bacula-fd.init 27 Source12: bacula-sd.init 28 +%endif 29 + 30 +%if 0%{?rhel_version} || 0%{?centos_version} || 0%{?fedora_version} 31 +Source10: bacula-dir.init.rh 32 +Source11: bacula-fd.init.rh 33 +Source12: bacula-sd.init.rh 34 +%endif 35 + 36 Source20: bacula-dir.fw 37 Source21: bacula-fd.fw 38 Source22: bacula-sd.fw 39
40 recover lost or damaged files. This package contains Bacula server 41 daemons. 42 43 + 44 +%package server-mysql 45 +License: GPL v2 or later 46 +Summary: Bacula - The Network Backup Solution - server part - mysql 47 +Group: Productivity/Archiving/Backup 48 +Requires: bacula = %{version} 49 +Conflicts: bacula-server-postgresql 50 +AutoReqProv: on 51 + 52 +%description server-mysql 53 +Binaries of bacula services linked against mysql. 54 + 55 + 56 + 57 +%package server-postgresql 58 +License: GPL v2 or later 59 +Summary: Bacula - The Network Backup Solution - server part - postgresql 60 +Group: Productivity/Archiving/Backup 61 +Requires: bacula = %{version} 62 +Conflicts: bacula-server-mysql 63 +AutoReqProv: on 64 + 65 +%description server-postgresql 66 +Binaries of bacula services linked against postgresql. 67 + 68 + 69 + 70 %package devel 71 Summary: Bacula devel files 72 Group: Productivity/Archiving/Backup 73
74 %patch1 75 76 %build 77 +%install 78 +Build() { 79 CFLAGS="-fno-strict-aliasing $RPM_OPT_FLAGS $(ncurses5-config --cflags)" LDFLAGS="-L/usr/%{_lib}/mysql $(ncurses5-config --libs)" ./configure \ 80 --prefix=%{_prefix} \ 81 --libexecdir=%{_libdir} \ 82
83 --mandir=%{_mandir} \ 84 --sysconfdir=%{_sysconfdir}/bacula \ 85 --with-working-dir=/var/lib/bacula/working \ 86 - --with-mysql \ 87 --with-openssl \ 88 --with-tcp-wrappers 89 +} 90 +# build mysql version 91 +Build --with-mysql 92 make CFLAGS="$RPM_OPT_FLAGS" 93 +make DESTDIR=$RPM_BUILD_ROOT install 94 +mv $RPM_BUILD_ROOT%{_sbindir}/bacula-sd $RPM_BUILD_ROOT%{_sbindir}/bacula-sd.mysql 95 +mv $RPM_BUILD_ROOT%{_sbindir}/bacula-dir $RPM_BUILD_ROOT%{_sbindir}/bacula-dir.mysql 96 +mv $RPM_BUILD_ROOT%{_sbindir}/bcopy $RPM_BUILD_ROOT%{_sbindir}/bcopy.mysql 97 +mv $RPM_BUILD_ROOT%{_sbindir}/bscan $RPM_BUILD_ROOT%{_sbindir}/bscan.mysql 98 99 -%install 100 +# build postgresql version 101 +Build --with-postgresql 102 +make CFLAGS="$RPM_OPT_FLAGS" 103 make DESTDIR=$RPM_BUILD_ROOT install 104 +mv $RPM_BUILD_ROOT%{_sbindir}/bacula-sd $RPM_BUILD_ROOT%{_sbindir}/bacula-sd.postgresql 105 +mv $RPM_BUILD_ROOT%{_sbindir}/bacula-dir $RPM_BUILD_ROOT%{_sbindir}/bacula-dir.postgresql 106 +mv $RPM_BUILD_ROOT%{_sbindir}/bcopy $RPM_BUILD_ROOT%{_sbindir}/bcopy.postgresql 107 +mv $RPM_BUILD_ROOT%{_sbindir}/bscan $RPM_BUILD_ROOT%{_sbindir}/bscan.postgresql 108 + 109 mkdir -p $RPM_BUILD_ROOT/etc/init.d 110 install -m 755 %SOURCE10 $RPM_BUILD_ROOT/etc/init.d/bacula-dir 111 install -m 755 %SOURCE11 $RPM_BUILD_ROOT/etc/init.d/bacula-fd 112
113 %restart_on_update bacula-dir bacula-sd 114 %insserv_cleanup 115 116 +%post server-mysql 117 +if [ -f %{_sbindir}/bacula-dir.mysql ] ;then 118 +ln -s %{_sbindir}/bacula-dir.mysql %{_sbindir}/bacula-dir 119 +fi 120 +if [ -f %{_sbindir}/bacula-sd.mysql ] ; then 121 +ln -s %{_sbindir}/bacula-sd.mysql %{_sbindir}/bacula-sd 122 +fi 123 +if [ -f %{_sbindir}/bscan.mysql ] ; then 124 +ln -s %{_sbindir}/bscan.mysql %{_sbindir}/bscan 125 +fi 126 +if [ -f %{_sbindir}/bcopy.mysql ] ; then 127 +ln -s %{_sbindir}/bcopy.mysql %{_sbindir}/bcopy 128 +fi 129 + 130 + 131 +%post server-postgresql 132 +if [ -f %{_sbindir}/bacula-dir.postgresql ] ;then 133 +ln -s %{_sbindir}/bacula-dir.postgresql %{_sbindir}/bacula-dir 134 +fi 135 +if [ -f %{_sbindir}/bacula-sd.postgresql ] ; then 136 +ln -s %{_sbindir}/bacula-sd.postgresql %{_sbindir}/bacula-sd 137 +fi 138 +if [ -f %{_sbindir}/bscan.postgresql ] ; then 139 +ln -s %{_sbindir}/bscan.postgresql %{_sbindir}/bscan 140 +fi 141 +if [ -f %{_sbindir}/bcopy.postgresql ] ; then 142 +ln -s %{_sbindir}/bcopy.postgresql %{_sbindir}/bcopy 143 +fi 144 + 145 + 146 +%postun server-mysql 147 +%restart_on_update bacula-dir bacula-sd 148 + 149 +%postun server-postgresql 150 +%restart_on_update bacula-dir bacula-sd 151 + 152 +%preun server-mysql 153 +rm -f %{_sbindir}/bacula-dir 154 +rm -f %{_sbindir}/bacula-sd 155 + 156 +%preun server-postgresql 157 +rm -f %{_sbindir}/bacula-dir 158 +rm -f %{_sbindir}/bacula-sd 159 + 160 + 161 %files 162 %defattr(-,root,root) 163 %config /etc/init.d/bacula-fd 164
165 %defattr(-,root,root) 166 %config /etc/init.d/bacula-sd 167 %config /etc/init.d/bacula-dir 168 -%{_sbindir}/* 169 +%{_sbindir}/rcbacula-sd 170 +%{_sbindir}/rcbacula-dir 171 +%exclude %{_sbindir}/bacula-sd* 172 +%exclude %{_sbindir}/bacula-dir* 173 +%exclude %{_sbindir}/bscan* 174 +%exclude %{_sbindir}/bcopy* 175 +%exclude %{_sbindir}/bacula-fd 176 %exclude %{_sbindir}/rcbacula-fd 177 %config(noreplace) /etc/bacula/bacula-dir.conf 178 %config(noreplace) /etc/bacula/bacula-sd.conf 179
180 %dir /var/lib/bacula 181 %dir /var/lib/bacula/working 182 183 +%files server-mysql 184 +%defattr(-,root,root) 185 +%{_sbindir}/bacula-sd.postgresql 186 +%{_sbindir}/bacula-dir.postgresql 187 +%{_sbindir}/bscan.postgresql 188 +%{_sbindir}/bcopy.postgresql 189 + 190 +%files server-postgresql 191 +%defattr(-,root,root) 192 +%{_sbindir}/bacula-sd.mysql 193 +%{_sbindir}/bacula-dir.mysql 194 +%{_sbindir}/bscan.mysql 195 +%{_sbindir}/bcopy.mysql 196 + 197 %files -n libbaccfg1 198 %defattr(-,root,root) 199 %{_libdir}/libbaccfg.so.1.0.0 200 |
||
[+] | Added | bacula-dir.init.rh ^ |
@@ -0,0 +1,128 @@ +#!/bin/bash +# +# bacula-dir This shell script takes care of starting and stopping +# the bacula-dir daemon, the backup director controling +# the backup jobs. +# +# chkconfig: - 80 20 +# description: Bacula-dir is the Backup-server, which is the program \ +# that schedules backups and controls the bacula-client and \ +# the bacula-storage daemons. +# processname: bacula-dir +# config: /etc/bacula/bacula-dir.conf +# pidfile: /var/run/bacula-dir.9101.pid + +# Source function library. +. /etc/init.d/functions + +# Source configuration. +if [ -f /etc/sysconfig/bacula-dir ] ; then + . /etc/sysconfig/bacula-dir +fi + +RETVAL=0 +prog="bacula-dir" +CONFIG="/etc/bacula/bacula-dir.conf" +OPTS="-c $CONFIG" + +checkconf() { + # Check if we still have our @@PLACEHOLDERS@@ in the config. + # If yes, refuse to start, the user has never touched the config. + grep -q '^[^#].*_PASSWORD@@' $CONFIG + if [ $? -eq 0 ]; then + echo -n "Error: Not been configured" + echo_failure + echo + exit 1 + fi +} + + +checkdatabase() { + # First, get the currently selected database backend from the + # alternatives system. + DB=$(LANG=C alternatives --display bacula-dir | grep 'link currently points to' | awk -F. '{ print $2 }') + case "$DB" in + sqlite) + # No check needed to see if the Database is running + ;; + mysql) + # Check if mysqld is running + service mysqld status > /dev/null 2>&1 + if [ $? -ne 0 ]; then + echo -n "Error: MySQL not running" + echo_failure + echo + exit 1 + fi + ;; + postgresql) + # Check if postgresql is running + service postgresql status > /dev/null 2>&1 + if [ $? -ne 0 ]; then + echo -n "Error: PostgreSQL not running" + echo_failure + echo + exit 1 + fi + ;; + *) + echo -n "Error: Unknown database backend" + echo_failure + echo + exit 1 + ;; + esac +} + +start() { + echo -n "Starting $prog: " + checkconf +# Removed for now, as the db might not be on localhost +# checkdatabase + daemon $prog $OPTS + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog + return $RETVAL +} + +stop() { + echo -n "Shutting down $prog: " + killproc $prog + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog + return $RETVAL +} + +case "$1" in + start) + start + ;; + stop) + stop + ;; + status) + status $prog + ;; + restart) + stop + start + RETVAL=$? + ;; + reload) + ;; + condrestart) + if [ -f /var/lock/subsys/$prog ]; then + stop + start + RETVAL=$? + fi + ;; + *) + echo "Usage: $prog {start|stop|status|reload|restart}" + exit 1 + ;; +esac +exit $? | ||
[+] | Added | bacula-fd.init.rh ^ |
@@ -0,0 +1,89 @@ +#!/bin/bash +# +# bacula-fd This shell script takes care of starting and stopping +# the bacula-fd daemon, the backup client enabling bacula +# to backup the local machine. +# +# chkconfig: - 80 20 +# description: Bacula-fd is a Backup-client, which is the program \ +# that enables the bacula-server to backup the local \ +# machine. +# processname: bacula-fd +# config: /etc/bacula/bacula-fd.conf +# pidfile: /var/run/bacula-fd.9102.pid + +# Source function library. +. /etc/init.d/functions + +# Source configuration. +if [ -f /etc/sysconfig/bacula-fd ] ; then + . /etc/sysconfig/bacula-fd +fi + +RETVAL=0 +prog="bacula-fd" +CONFIG="/etc/bacula/bacula-fd.conf" +OPTS="-c $CONFIG" + +checkconf() { + # Check if we still have our @@PLACEHOLDERS@@ in the config. + # If yes, refuse to start, the user has never touched the config. + grep -q '_PASSWORD@@' $CONFIG + if [ $? -eq 0 ]; then + echo -n "Error: Not been configured" + echo_failure + echo + exit 1 + fi +} + + +start() { + echo -n "Starting $prog: " + checkconf + daemon $prog $OPTS + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog + return $RETVAL +} + +stop() { + echo -n "Shutting down $prog: " + killproc $prog + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog + return $RETVAL +} + +case "$1" in + start) + start + ;; + stop) + stop + ;; + status) + status $prog + ;; + restart) + stop + start + RETVAL=$? + ;; + reload) + ;; + condrestart) + if [ -f /var/lock/subsys/$prog ]; then + stop + start + RETVAL=$? + fi + ;; + *) + echo "Usage: $prog {start|stop|status|reload|restart}" + exit 1 + ;; +esac +exit $? | ||
[+] | Added | bacula-sd.init.rh ^ |
@@ -0,0 +1,127 @@ +#!/bin/bash +# +# bacula-sd This shell script takes care of starting and stopping +# the bacula-sd daemon, the storage daemon responsible +# for accessing the backup storage device. +# +# chkconfig: - 80 20 +# description: Bacula-sd is the storage-server, which is the program \ +# that accesses the storage device. +# processname: bacula-sd +# config: /etc/bacula/bacula-sd.conf +# pidfile: /var/run/bacula-dir.9103.pid + +# Source function library. +. /etc/init.d/functions + +# Source configuration. +if [ -f /etc/sysconfig/bacula-sd ] ; then + . /etc/sysconfig/bacula-sd +fi + +RETVAL=0 +prog="bacula-sd" +CONFIG="/etc/bacula/bacula-sd.conf" +OPTS="-c $CONFIG" + +checkconf() { + # Check if we still have our @@PLACEHOLDERS@@ in the config. + # If yes, refuse to start, the user has never touched the config. + grep -q '^[^#].*_PASSWORD@@' $CONFIG + if [ $? -eq 0 ]; then + echo -n "Error: Not been configured" + echo_failure + echo + exit 1 + fi +} + + +checkdatabase() { + # First, get the currently selected database backend from the + # alternatives system. + DB=$(LANG=C alternatives --display bacula-sd | grep 'link currently points to' | awk -F. '{ print $2 }') + case "$DB" in + sqlite) + # No check needed to see if the Database is running + ;; + mysql) + # Check if mysqld is running + service mysqld status > /dev/null 2>&1 + if [ $? -ne 0 ]; then + echo -n "Error: MySQL not running" + echo_failure + echo + exit 1 + fi + ;; + postgresql) + # Check if postgresql is running + service postgresql status > /dev/null 2>&1 + if [ $? -ne 0 ]; then + echo -n "Error: PostgreSQL not running" + echo_failure + echo + exit 1 + fi + ;; + *) + echo -n "Error: Unknown database backend" + echo_failure + echo + exit 1 + ;; + esac +} + +start() { + echo -n "Starting $prog: " + checkconf +# Disabled, the DB does not necessarily run on the same machine +# checkdatabase + daemon $prog $OPTS + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog + return $RETVAL +} + +stop() { + echo -n "Shutting down $prog: " + killproc $prog + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog + return $RETVAL +} + +case "$1" in + start) + start + ;; + stop) + stop + ;; + status) + status $prog + ;; + restart) + stop + start + RETVAL=$? + ;; + reload) + ;; + condrestart) + if [ -f /var/lock/subsys/$prog ]; then + stop + start + RETVAL=$? + fi + ;; + *) + echo "Usage: $prog {start|stop|status|reload|restart}" + exit 1 + ;; +esac +exit $? |