]> git.sur5r.net Git - bacula/bacula/commitdiff
baculum: Update example Spec file
authorMarcin Haba <marcin.haba@bacula.pl>
Sat, 28 Mar 2015 17:10:05 +0000 (18:10 +0100)
committerMarcin Haba <marcin.haba@bacula.pl>
Sat, 28 Mar 2015 17:10:05 +0000 (18:10 +0100)
gui/baculum/examples/rpm/baculum.spec

index 220a2bdf67faf7c290bd6d97552809f29f0bf1d6..9e9b0ecf4fac9a60071f1b8689b2c49333199618 100644 (file)
@@ -1,11 +1,12 @@
-Summary:       Baculum WebGUI tool for Bacula Community program
+Summary:       WebGUI tool for Bacula Community program
 Name:          baculum
-Version:       7.0.20150317git
-Release:       1%{?dist}
+Version:       7.0.6
+Release:       0.1.a%{?dist}
 License:       AGPLv3
 Group:         Applications/Internet
-Source:                %{name}-%{version}.tar.gz
-URL:           http://bacula.org
+URL:           http://bacula.org/
+Source0:       http://www.bacula.org/downloads/baculum/baculum-7.0.6a.tar.gz
+BuildRequires: systemd-units
 Requires:      lighttpd
 Requires:      lighttpd-fastcgi
 Requires:      bacula-console
@@ -17,8 +18,8 @@ Requires:     php-mysqlnd
 Requires:      php-pdo
 Requires:      php-pgsql
 Requires:      php-xml
-Requires(post):        /sbin/chkconfig
-Requires(preun):/sbin/service, /sbin/chkconfig
+Requires(post):        /sbin/chkconfig, policycoreutils-python
+Requires(preun):/sbin/service, /sbin/chkconfig, policycoreutils-python
 BuildArch: noarch
 
 %description
@@ -27,6 +28,18 @@ By using Baculum is possible to execute backup/restore operations, monitor
 current Bacula jobs, media management and others. Baculum has integrated web
 console that communicates with Bacula bconsole program.
 
+%package selinux
+Summary:               SELinux module for Baculum WebGUI tool
+Requires:              %name = %version-%release
+Group:                 Applications/Internet
+Requires(post):                policycoreutils-python
+Requires(preun):       policycoreutils-python
+
+%description selinux
+This package provides an SELinux module for Baculum WebGUI tool.
+You should install this package if you are using SELinux, that Baculum
+can be run in enforcing mode.
+
 %prep
 %autosetup
 
@@ -34,36 +47,76 @@ console that communicates with Bacula bconsole program.
 
 %files
 %defattr(-,lighttpd,lighttpd)
-%attr(-,lighttpd,lighttpd) /usr/share/baculum/htdocs
-%attr(-,lighttpd,lighttpd) /etc/baculum
-%attr(755,root,root) /etc/rc.d/init.d/baculum
-%config /etc/sysconfig/baculum
+%attr(-,lighttpd,lighttpd) %{_localstatedir}/cache/%{name}/
+%attr(750,lighttpd,lighttpd) %{_var}/log/%{name}/
+%{_unitdir}/baculum.service
+%{_datadir}/%{name}/
+%config %{_sysconfdir}/%{name}/%{name}.lighttpd.conf
+%config(noreplace) %{_sysconfdir}/%{name}/%{name}.users
+%license LICENSE
+%doc AUTHORS INSTALL README
 
-%doc AUTHORS INSTALL README LICENSE
+%files selinux
+%defattr(-,lighttpd,lighttpd)
 
 %install
-mkdir -p %{buildroot}/usr/share/baculum/htdocs
-mkdir -p %{buildroot}/etc/baculum
-mkdir -p %{buildroot}/etc/sysconfig
-mkdir -p %{buildroot}/etc/rc.d/init.d
-
-cp -ra assets framework protected themes index.php AUTHORS INSTALL LICENSE README index.php %{buildroot}/usr/share/baculum/htdocs
-install -m 640 examples/rpm/baculum.lighttpd.conf %{buildroot}/etc/baculum/
-install -m 600 examples/rpm/baculum.users %{buildroot}/etc/baculum/
-install -m 755 examples/rpm/baculum.startup %{buildroot}/etc/rc.d/init.d/baculum
-install -m 644 examples/rpm/baculum.sysconfig %{buildroot}/etc/sysconfig/baculum
+mkdir -p %{buildroot}%{_datadir}/%{name}/htdocs
+mkdir -p %{buildroot}%{_sysconfdir}/%{name}
+mkdir -p %{buildroot}%{_unitdir}
+mkdir -p %{buildroot}%{_localstatedir}/cache/%{name}
+mkdir -p %{buildroot}%{_var}/log/%{name}
 
+cp -ra framework protected themes index.php AUTHORS INSTALL LICENSE README %{buildroot}%{_datadir}/%{name}/htdocs
+ln -s  %{_localstatedir}/cache/%{name} %{buildroot}%{_datadir}/%{name}/htdocs/assets
+ln -s  %{_localstatedir}/cache/%{name} %{buildroot}%{_datadir}/%{name}/htdocs/protected/runtime
+install -m 640 examples/rpm/baculum.lighttpd.conf %{buildroot}%{_sysconfdir}/%{name}/
+install -m 600 examples/rpm/baculum.users %{buildroot}%{_sysconfdir}/%{name}/%{name}.users
+install -m 644 examples/rpm/baculum.service %{buildroot}%{_unitdir}/
 
 %post
-/sbin/chkconfig --add /etc/rc.d/init.d/baculum
-[ -e /usr/share/baculum/htdocs/protected/Data/baculum.users ] || ln -s /etc/baculum/baculum.users /usr/share/baculum/htdocs/protected/Data/baculum.users
+[ -e %{_datadir}/baculum/htdocs/protected/Data/baculum.users ] ||
+    ln -s %{_sysconfdir}/baculum/baculum.users %{_datadir}/%{name}/htdocs/protected/Data/baculum.users
+[ -e %{_datadir}/baculum/htdocs/assets ] ||
+    ln -s %{_localstatedir}/cache/%{name} %{_datadir}/%{name}/htdocs/assets
+[ -e %{_datadir}/baculum/htdocs/protected/runtime ] ||
+    ln -s %{_localstatedir}/cache/%{name} %{_datadir}/%{name}/htdocs/protected/runtime
+
+%systemd_post baculum.service
+
+%post selinux
+if [ $1 -le 1 ] ; then
+    semanage port -a -t http_port_t -p tcp 9095
+    semanage fcontext -a -t httpd_cache_t '%{_localstatedir}/cache/%{name}(/.*)?' 2>/dev/null || :
+    restorecon -R %{_localstatedir}/cache/%{name} || :
+    semanage fcontext -a -t httpd_sys_rw_content_t '%{_datadir}/%{name}/htdocs/protected/Data(/.*)?' 2>/dev/null || :
+    restorecon '%{_datadir}/%{name}/htdocs/protected/Data' || :
+    chcon -t httpd_user_content_rw_t '%{_datadir}/%{name}/htdocs/protected/Data/baculum.users' || :
+    chcon -t httpd_user_content_rw_t '%{_sysconfdir}/%{name}/baculum.users' || :
+    setsebool -P httpd_can_network_connect 1 || :
+fi
 
 %preun
+%systemd_preun baculum.service
+if [ $1 -lt 1 ] ; then
+    [ ! -e %{_datadir}/%{name}/htdocs/protected/Data/baculum.users ] ||
+       rm %{_datadir}/%{name}/htdocs/protected/Data/baculum.users
+    [ ! -e %{_datadir}/%{name}/htdocs/protected/Data/settings.conf ] ||
+       rm %{_datadir}/%{name}/htdocs/protected/Data/settings.conf
+    [ ! -e %{_datadir}/%{name}/htdocs/protected/Data/baculum.log ] ||
+       rm %{_datadir}/%{name}/htdocs/protected/Data/baculum*.log
+fi
+
+%postun
+%systemd_postun_with_restart baculum.service
+
+%postun selinux
 if [ $1 -eq 0 ] ; then
-    /sbin/service baculum stop
-    /sbin/chkconfig --del baculum
+    semanage port -d -t http_port_t -p tcp 9095
+    semanage fcontext -d -t httpd_sys_rw_content_t '%{_datadir}/%{name}/htdocs/protected/Data(/.*)?' 2>/dev/null || :
+    semanage fcontext -d -t httpd_cache_t '%{_localstatedir}/cache/%{name}(/.*)?' 2>/dev/null || :
+    setsebool -P httpd_can_network_connect 0 || :
 fi
 
 %changelog
- * Wed Mar 18 2015 Marcin Haba <marcin.haba@bacula.pl> - 7.0.20150317git
+ * Tue Mar 24 2015 Marcin Haba <marcin.haba@bacula.pl> - 7.0.6-0.1.a
  - Spec create
\ No newline at end of file