convert to systemd

This commit is contained in:
Tom "spot" Callaway 2011-09-08 12:31:35 -04:00
parent 86f931bae0
commit 99bb2e4ea2
5 changed files with 118 additions and 72 deletions

17
bacula-checkconf Normal file
View File

@ -0,0 +1,17 @@
#!/bin/sh
# Check if we still have our @@PLACEHOLDERS@@ in the config.
# If yes, refuse to start, the user has never touched the config.
if [ $# -ne 1 ]; then
echo "Usage: $0 [configfile]"
exit 1
fi
grep -q '^[^#].*_PASSWORD@@' $1
if [ $? -eq 0 ]; then
echo "Error: Default password in config"
exit 6
fi
exit 0

17
bacula-dir.service Normal file
View File

@ -0,0 +1,17 @@
[Unit]
Description=Bacula-Director, the Backup-server
Requires=syslog.target network.target
After=network.target
[Service]
Environment=CONFIG=/etc/bacula/bacula-dir.conf
Environment=DIR_USER=bacula
Environment=DIR_GROUP=bacula
EnvironmentFile=-/etc/sysconfig/bacula-dir
ExecStartPre=/usr/sbin/bacula-checkconf $CONFIG
ExecStart=/usr/sbin/bacula-dir -f -c $CONFIG -u $DIR_USER -g $DIR_GROUP
StandardOutput=syslog
Restart=restart-always
[Install]
WantedBy=multi-user.target

18
bacula-fd.service Normal file
View File

@ -0,0 +1,18 @@
[Unit]
Description=Bacula-FileDaemon, a Backup-client
Requires=syslog.target network.target
After=network.target
[Service]
Environment=CONFIG=/etc/bacula/bacula-fd.conf
Environment=FD_USER=root
Environment=FD_GROUP=root
EnvironmentFile=-/etc/sysconfig/bacula-fd
ExecStartPre=/usr/sbin/bacula-checkconf $CONFIG
ExecStart=/usr/sbin/bacula-fd -f -c $CONFIG -u $FD_USER -g $FD_GROUP
IOSchedulingClass=idle
StandardOutput=syslog
Restart=restart-always
[Install]
WantedBy=multi-user.target

17
bacula-sd.service Normal file
View File

@ -0,0 +1,17 @@
[Unit]
Description=Bacula-StorageDaemon, the storage-server
Requires=syslog.target network.target
After=network.target
[Service]
Environment=CONFIG=/etc/bacula/bacula-sd.conf
Environment=SD_USER=bacula
Environment=SD_GROUP=disk
EnvironmentFile=-/etc/sysconfig/bacula-sd
ExecStartPre=/usr/sbin/bacula-checkconf $CONFIG
ExecStart=/usr/sbin/bacula-sd -f -c $CONFIG -u $SD_USER -g $SD_GROUP
StandardOutput=syslog
Restart=restart-always
[Install]
WantedBy=multi-user.target

View File

@ -8,7 +8,7 @@
Summary: Cross platform network backup for Linux, Unix, Mac and Windows Summary: Cross platform network backup for Linux, Unix, Mac and Windows
Name: bacula Name: bacula
Version: 5.0.3 Version: 5.0.3
Release: 9%{?dist} Release: 10%{?dist}
# See LICENSE for details # See LICENSE for details
License: GPLv2 with exceptions License: GPLv2 with exceptions
Group: System Environment/Daemons Group: System Environment/Daemons
@ -19,17 +19,16 @@ Source1: http://download.sourceforge.net/bacula/bacula-docs-%{docs_version}.tar.
Source4: bacula-wxconsole.desktop Source4: bacula-wxconsole.desktop
Source5: bacula-traymonitor.desktop Source5: bacula-traymonitor.desktop
Source6: bacula.logrotate Source6: bacula.logrotate
Source7: bacula-fd.init Source7: bacula-fd.service
Source8: bacula-dir.init Source8: bacula-dir.service
Source9: bacula-sd.init Source9: bacula-sd.service
#Source10: http://download.sourceforge.net/bacula/bacula-gui-%{gui_version}.tar.gz #Source10: http://download.sourceforge.net/bacula/bacula-gui-%{gui_version}.tar.gz
#Source11: bacula-web.apache #Source11: bacula-web.apache
Source12: bacula-bat.desktop Source12: bacula-bat.desktop
Source13: bacula-traymonitor.console_apps Source13: bacula-traymonitor.console_apps
Source14: bacula-wxconsole.console_apps Source14: bacula-wxconsole.console_apps
Source15: bacula-fd.sysconfig Source15: bacula-checkconf
Source16: bacula-dir.sysconfig
Source17: bacula-sd.sysconfig
#Patch0: bacula-director-configuration.patch #Patch0: bacula-director-configuration.patch
Patch1: bacula-config.patch Patch1: bacula-config.patch
#Patch2: bacula-wxconsole.patch #Patch2: bacula-wxconsole.patch
@ -66,6 +65,7 @@ BuildRequires: desktop-file-utils, python-devel, sqlite-devel, sed,
BuildRequires: libacl-devel, latex2html, tetex-latex, tetex, ghostscript BuildRequires: libacl-devel, latex2html, tetex-latex, tetex, ghostscript
BuildRequires: dvipdfm, qwt-devel BuildRequires: dvipdfm, qwt-devel
BuildRequires: tcp_wrappers-devel BuildRequires: tcp_wrappers-devel
BuildRequires: systemd-units
%description %description
Bacula is a set of programs that allow you to manage the backup, Bacula is a set of programs that allow you to manage the backup,
@ -135,6 +135,7 @@ Requires: bacula-common = %{version}-%{release}
Requires: logwatch Requires: logwatch
Requires(pre): fedora-usermgmt Requires(pre): fedora-usermgmt
Requires(postun): fedora-usermgmt Requires(postun): fedora-usermgmt
Requires(post): systemd-sysv
%description director-common %description director-common
Bacula is a set of programs that allow you to manage the backup, Bacula is a set of programs that allow you to manage the backup,
@ -152,10 +153,7 @@ bacula-director-sqlite or bacula-director-postgresql.
Summary: Bacula backup client Summary: Bacula backup client
Group: System Environment/Daemons Group: System Environment/Daemons
Requires: bacula-common = %{version}-%{release} Requires: bacula-common = %{version}-%{release}
Requires(post): /sbin/chkconfig Requires(post): systemd-sysv
Requires(preun): /sbin/chkconfig
Requires(preun): /sbin/service
Requires(postun): /sbin/service
%description client %description client
Bacula is a set of programs that allow you to manage the backup, Bacula is a set of programs that allow you to manage the backup,
@ -171,6 +169,7 @@ Summary: Common Bacula storage daemon files
Group: System Environment/Daemons Group: System Environment/Daemons
Requires: bacula-storage = %{version}-%{release} Requires: bacula-storage = %{version}-%{release}
Requires: bacula-common = %{version}-%{release} Requires: bacula-common = %{version}-%{release}
Requires(post): systemd-sysv
%description storage-common %description storage-common
Bacula is a set of programs that allow you to manage the backup, Bacula is a set of programs that allow you to manage the backup,
@ -615,17 +614,12 @@ install -m 755 -D bacula-sqlite/scripts/logwatch/applybaculadate %{buildroot}%{_
install -m 644 -D bacula-sqlite/scripts/logwatch/logfile.bacula.conf %{buildroot}%{_sysconfdir}/logwatch/conf/logfiles/bacula.conf install -m 644 -D bacula-sqlite/scripts/logwatch/logfile.bacula.conf %{buildroot}%{_sysconfdir}/logwatch/conf/logfiles/bacula.conf
install -m 644 -D bacula-sqlite/scripts/logwatch/services.bacula.conf %{buildroot}%{_sysconfdir}/logwatch/conf/services/bacula.conf install -m 644 -D bacula-sqlite/scripts/logwatch/services.bacula.conf %{buildroot}%{_sysconfdir}/logwatch/conf/services/bacula.conf
# Systemd unit files
# Initscripts mkdir -p ${buildroot}%{_unitdir}
install -m 755 -D %{SOURCE7} %{buildroot}%{_initrddir}/bacula-fd install -m 755 -D %{SOURCE7} %{buildroot}%{_unitdir}/bacula-fd.service
install -m 755 -D %{SOURCE8} %{buildroot}%{_initrddir}/bacula-dir install -m 755 -D %{SOURCE8} %{buildroot}%{_unitdir}/bacula-dir.service
install -m 755 -D %{SOURCE9} %{buildroot}%{_initrddir}/bacula-sd install -m 755 -D %{SOURCE9} %{buildroot}%{_unitdir}/bacula-sd.service
install -m 755 -D %{SOURCE15} %{buildroot}%{_sbindir}/bacula-checkconf
# Sysconfig
install -m 644 -D %{SOURCE15} %{buildroot}%{_sysconfdir}/sysconfig/bacula-fd
install -m 644 -D %{SOURCE16} %{buildroot}%{_sysconfdir}/sysconfig/bacula-dir
install -m 644 -D %{SOURCE17} %{buildroot}%{_sysconfdir}/sysconfig/bacula-sd
# Wipe backup files from the multiple make install calls # Wipe backup files from the multiple make install calls
@ -748,55 +742,37 @@ if [ "$1" = 0 ]; then
/usr/sbin/alternatives --remove bacula-sd /usr/sbin/bcopy.postgresql /usr/sbin/alternatives --remove bacula-sd /usr/sbin/bcopy.postgresql
fi fi
%post client %triggerun client -- bacula-client < 5.0.3-10
/sbin/chkconfig --add bacula-fd # Save the current service runlevel info
# User must manually run systemd-sysv-convert --apply bacula-fd
# to migrate them to systemd targets
/usr/bin/systemd-sysv-convert --save bacula-fd >/dev/null 2>&1 ||:
# Run these because the SysV package being removed won't do them
/sbin/chkconfig --del bacula-fd >/dev/null 2>&1 || :
/bin/systemctl try-restart bacula-fd.service >/dev/null 2>&1 || :
%preun client %triggerun director-common -- bacula-director-common < 5.0.3-10
if [ "$1" = 0 ]; then # Save the current service runlevel info
/sbin/service bacula-fd stop >/dev/null 2>&1 || : # User must manually run systemd-sysv-convert --apply bacula-dir
/sbin/chkconfig --del bacula-fd # to migrate them to systemd targets
fi /usr/bin/systemd-sysv-convert --save bacula-dir >/dev/null 2>&1 ||:
# Run these because the SysV package being removed won't do them
/sbin/chkconfig --del bacula-dir >/dev/null 2>&1 || :
/bin/systemctl try-restart bacula-dir.service >/dev/null 2>&1 || :
%postun client %triggerun storage-common -- bacula-storage-common < 5.0.3-10
if [ "$1" -ge "1" ]; then # Save the current service runlevel info
/sbin/service bacula-fd condrestart >/dev/null 2>&1 || : # User must manually run systemd-sysv-convert --apply bacula-sd
fi # to migrate them to systemd targets
/usr/bin/systemd-sysv-convert --save bacula-sd >/dev/null 2>&1 ||:
# Run these because the SysV package being removed won't do them
%post director-common /sbin/chkconfig --del bacula-sd >/dev/null 2>&1 || :
/sbin/chkconfig --add bacula-dir /bin/systemctl try-restart bacula-sd.service >/dev/null 2>&1 || :
%preun director-common
if [ "$1" = 0 ]; then
/sbin/service bacula-dir stop >/dev/null 2>&1 || :
/sbin/chkconfig --del bacula-dir
fi
%postun director-common
if [ "$1" -ge "1" ]; then
/sbin/service bacula-dir condrestart >/dev/null 2>&1 || :
fi
%post storage-common
/sbin/chkconfig --add bacula-sd
%preun storage-common
if [ "$1" = 0 ]; then
/sbin/service bacula-sd stop >/dev/null 2>&1 || :
/sbin/chkconfig --del bacula-sd
fi
%postun storage-common
if [ "$1" -ge "1" ]; then
/sbin/service bacula-sd condrestart >/dev/null 2>&1 || :
fi
%files common %files common
@ -821,13 +797,13 @@ fi
/usr/libexec/bacula/mtx-changer.conf /usr/libexec/bacula/mtx-changer.conf
%{_libexecdir}/bacula/bacula_config %{_libexecdir}/bacula/bacula_config
%{_libexecdir}/bacula/btraceback.mdb %{_libexecdir}/bacula/btraceback.mdb
%{_sbindir}/bacula-checkconf
%files client %files client
%defattr(-,root,root,-) %defattr(-,root,root,-)
%{_sbindir}/bacula-fd %{_sbindir}/bacula-fd
%{_initrddir}/bacula-fd %{_unitdir}/bacula-fd.service
%config(noreplace) %{_sysconfdir}/bacula/bacula-fd.conf %config(noreplace) %{_sysconfdir}/bacula/bacula-fd.conf
%config(noreplace) %{_sysconfdir}/sysconfig/bacula-fd
%{_mandir}/man8/bacula-fd.8* %{_mandir}/man8/bacula-fd.8*
@ -882,10 +858,9 @@ fi
%config(noreplace) %{_sysconfdir}/bacula/query.sql %config(noreplace) %{_sysconfdir}/bacula/query.sql
%config %{_sysconfdir}/logwatch/conf/logfiles/bacula.conf %config %{_sysconfdir}/logwatch/conf/logfiles/bacula.conf
%config %{_sysconfdir}/logwatch/conf/services/bacula.conf %config %{_sysconfdir}/logwatch/conf/services/bacula.conf
%config(noreplace) %{_sysconfdir}/sysconfig/bacula-dir
%{_sysconfdir}/logwatch/scripts/services/bacula %{_sysconfdir}/logwatch/scripts/services/bacula
%{_sysconfdir}/logwatch/scripts/shared/applybaculadate %{_sysconfdir}/logwatch/scripts/shared/applybaculadate
%{_initrddir}/bacula-dir %{_unitdir}/bacula-dir.service
%{_sbindir}/bregex %{_sbindir}/bregex
%{_sbindir}/bwild %{_sbindir}/bwild
%{_mandir}/man8/dbcheck.8* %{_mandir}/man8/dbcheck.8*
@ -959,8 +934,7 @@ fi
%{_sbindir}/bls %{_sbindir}/bls
%{_sbindir}/btape %{_sbindir}/btape
%config(noreplace) %{_sysconfdir}/bacula/bacula-sd.conf %config(noreplace) %{_sysconfdir}/bacula/bacula-sd.conf
%config(noreplace) %{_sysconfdir}/sysconfig/bacula-sd %{_unitdir}/bacula-sd.service
%{_initrddir}/bacula-sd
%{_libexecdir}/bacula/disk-changer %{_libexecdir}/bacula/disk-changer
%{_libexecdir}/bacula/dvd-handler %{_libexecdir}/bacula/dvd-handler
%{_libexecdir}/bacula/mtx-changer %{_libexecdir}/bacula/mtx-changer
@ -1026,6 +1000,9 @@ fi
%changelog %changelog
* Thu Sep 8 2011 Tom Callaway <spot@fedoraproject.org> - 5.0.3-10
- convert to systemd
* Wed Mar 23 2011 Dan Horák <dan@danny.cz> - 5.0.3-9 * Wed Mar 23 2011 Dan Horák <dan@danny.cz> - 5.0.3-9
- rebuilt for mysql 5.5.10 (soname bump in libmysqlclient) - rebuilt for mysql 5.5.10 (soname bump in libmysqlclient)