summaryrefslogtreecommitdiffstats
path: root/build/rpm_specs
diff options
context:
space:
mode:
authorGeorg Kunz <georg.kunz@ericsson.com>2016-12-31 00:31:33 +0100
committerGeorg Kunz <georg.kunz@ericsson.com>2017-01-09 16:37:17 +0100
commitaf3ffb6f8e93346cfc170d7989c457e5960d2a08 (patch)
treeb5ef1d5dc02d69ea8f00897f2bc34e3417262a30 /build/rpm_specs
parent28850f28aaa80cc71563f4c4698af70da6334f03 (diff)
Including ODL shim server in RPM package
This commit includes the ODL shim layer in the RPM packaging process and installs it as a system services through systemd. Moreover, this commit replaces the systemd scriptlets in the RPM spec file with temporary scripts until systemd is available on the OPNFV build servers. Change-Id: I92349f13d6c49a310279580d611e8500df4938f0 Signed-off-by: Georg Kunz <georg.kunz@ericsson.com>
Diffstat (limited to 'build/rpm_specs')
-rw-r--r--build/rpm_specs/gluon.spec81
1 files changed, 70 insertions, 11 deletions
diff --git a/build/rpm_specs/gluon.spec b/build/rpm_specs/gluon.spec
index 946d415..6e39ab4 100644
--- a/build/rpm_specs/gluon.spec
+++ b/build/rpm_specs/gluon.spec
@@ -13,6 +13,7 @@ Source0: gluon.tar.gz
Url: https://github.com/openstack/gluon
BuildArch: noarch
+# disabled until systemd is available on build servers
#BuildRequires: systemd
Vendor: OpenStack <openstack-dev@lists.openstack.org>
@@ -34,9 +35,10 @@ Requires: python2-oslo-i18n
Requires: python2-wsme
Requires: pytz
-Requires(post): systemd
-Requires(preun): systemd
-Requires(postun): systemd
+# disabled until systemd is available on build servers
+#Requires(post): systemd
+#Requires(preun): systemd
+#Requires(postun): systemd
%description
OpenStack Gluon framework for NFV networking
@@ -59,21 +61,33 @@ ExecStart=/usr/bin/proton-server --config-file /etc/proton/proton.conf --logfile
WantedBy=multi-user.target
EOF
-cat << EOF > %{_builddir}/proton.conf
-[DEFAULT]
-state_path = /var/lib/proton
-EOF
+cat << EOF > %{_builddir}/openstack-proton-shim-server.service
+[Unit]
+Description=OpenStack Proton Shim Server
+After=syslog.target network.target
+[Service]
+Type=simple
+TimeoutStartSec=0
+Restart=always
+User=proton
+ExecStart=/usr/bin/proton-shim-server --config-file /etc/proton/proton-shim.conf --logfile /var/log/proton/shim.log
+
+[Install]
+WantedBy=multi-user.target
+EOF
%install
python setup.py install -O1 --root=%{buildroot} --record=INSTALLED_FILES --prefix=/usr
mkdir -p %{buildroot}/usr/lib/systemd/system
install %{_builddir}/openstack-proton-server.service %{buildroot}/usr/lib/systemd/system
+install %{_builddir}/openstack-proton-shim-server.service %{buildroot}/usr/lib/systemd/system
mkdir -p %{buildroot}%{_sharedstatedir}/proton
mkdir -p %{buildroot}%{_localstatedir}/log/proton
mkdir -p %{buildroot}%{_localstatedir}/run/proton
mkdir -p %{buildroot}%{_sysconfdir}/proton
-install %{_builddir}/proton.conf %{buildroot}%{_sysconfdir}/proton
+install %{_builddir}/%{name}-%{version}/etc/proton/proton.conf.sample %{buildroot}%{_sysconfdir}/proton/proton.conf
+install %{_builddir}/%{name}-%{version}/etc/shim/proton-shim.conf.sample %{buildroot}%{_sysconfdir}/proton/proton-shim.conf
%pre
@@ -83,15 +97,58 @@ if ! getent passwd proton >/dev/null; then
fi
exit 0
+
%post
-%systemd_post openstack-proton-server
+# systemd scriplets disabled until systemd is available on build servers
+#%systemd_post openstack-proton-server
+if [ $1 -eq 1 ] ; then
+ # Initial installation
+ systemctl preset openstack-proton-server >/dev/null 2>&1 || :
+fi
systemctl start openstack-proton-server
+# systemd scriplets disabled until systemd is available on build servers
+#%systemd_post openstack-proton-shim-server
+if [ $1 -eq 1 ] ; then
+ # Initial installation
+ systemctl preset openstack-proton-shim-server >/dev/null 2>&1 || :
+fi
+systemctl start openstack-proton-shim-server
+
+
%preun
-%systemd_preun openstack-proton-server
+# systemd scriplets disabled until systemd is available on build servers
+#%systemd_preun openstack-proton-server
+if [ $1 -eq 0 ] ; then
+ # Package removal, not upgrade
+ systemctl --no-reload disable openstack-proton-server > /dev/null 2>&1 || :
+ systemctl stop openstack-proton-server > /dev/null 2>&1 || :
+fi
+
+#%systemd_preun openstack-proton-shim-server
+if [ $1 -eq 0 ] ; then
+ # Package removal, not upgrade
+ systemctl --no-reload disable openstack-proton-shim-server > /dev/null 2>&1 || :
+ systemctl stop openstack-proton-shim-server > /dev/null 2>&1 || :
+fi
+
%postun
-%systemd_postun_with_restart openstack-proton-server
+# systemd scriplets disabled until systemd is available on build servers
+#%systemd_postun_with_restart openstack-proton-server
+#%systemd_postun_with_restart openstack-proton-shim-server
+systemctl daemon-reload >/dev/null 2>&1 || :
+if [ $1 -ge 1 ] ; then
+ # Package upgrade, not uninstall
+ systemctl try-restart openstack-proton-server >/dev/null 2>&1 || :
+fi
+
+systemctl daemon-reload >/dev/null 2>&1 || :
+if [ $1 -ge 1 ] ; then
+ # Package upgrade, not uninstall
+ systemctl try-restart openstack-proton-shim-server >/dev/null 2>&1 || :
+fi
+
%clean
rm -rf %{buildroot}
@@ -99,8 +156,10 @@ rm -rf %{buildroot}
%files -f INSTALLED_FILES
%defattr(-,root,root)
%attr(644,root,root) /usr/lib/systemd/system/openstack-proton-server.service
+%attr(644,root,root) /usr/lib/systemd/system/openstack-proton-shim-server.service
%dir %attr(700,proton,root) %{_sysconfdir}/proton
%attr(640,proton,root) %{_sysconfdir}/proton/proton.conf
+%attr(640,proton,root) %{_sysconfdir}/proton/proton-shim.conf
%dir %attr(750,proton,root) %{_localstatedir}/log/proton
%dir %attr(750,proton,root) %{_localstatedir}/run/proton
%dir %attr(755,proton,root) %{_sharedstatedir}/proton