File sca-appliance-broker.spec of Package sca-appliance-broker.2129
#
# spec file for package sca-appliance-broker
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
# neededforbuild
%define sca_common sca
Name: sca-appliance-broker
Summary: Supportconfig Analysis Appliance Broker
License: GPL-2.0
Group: System/Monitoring
Url: https://github.com/g23guy/sca-appliance-broker
Version: 1.3
Release: 0
Source: %{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch
Requires: /usr/bin/dos2unix
Requires: /usr/sbin/mysqld
Requires: apache2
Requires: sca-appliance-common
%description
Monitors inbound supportconfig archives and is responsible for
assigning new and retry archives states for appropriate agent analysis.
Authors:
--------
Jason Record <jrecord@suse.com>
%prep
%setup -q
%build
gzip -9f man/*8
gzip -9f man/*5
%install
pwd;ls -la
rm -rf $RPM_BUILD_ROOT
install -d $RPM_BUILD_ROOT/etc/%{sca_common}
install -d $RPM_BUILD_ROOT/srv/www/htdocs/%{sca_common}
install -d $RPM_BUILD_ROOT/usr/sbin
install -d $RPM_BUILD_ROOT/usr/share/man/man8
install -d $RPM_BUILD_ROOT/usr/share/man/man5
install -d $RPM_BUILD_ROOT/usr/share/doc/packages/%{sca_common}
install -m 444 man/COPYING.GPLv2 $RPM_BUILD_ROOT/usr/share/doc/packages/%{sca_common}
install -m 644 config/*.conf $RPM_BUILD_ROOT/etc/%{sca_common}
install -m 644 config/* $RPM_BUILD_ROOT/usr/share/doc/packages/%{sca_common}
install -m 644 websca/index.html $RPM_BUILD_ROOT/usr/share/doc/packages/%{sca_common}
install -m 640 websca/* $RPM_BUILD_ROOT/srv/www/htdocs/%{sca_common}
install -m 544 bin/* $RPM_BUILD_ROOT/usr/sbin
install -m 644 schema/* $RPM_BUILD_ROOT/usr/share/doc/packages/%{sca_common}
install -m 644 docs/* $RPM_BUILD_ROOT/usr/share/doc/packages/%{sca_common}
install -m 644 man/*.8.gz $RPM_BUILD_ROOT/usr/share/man/man8
install -m 644 man/*.5.gz $RPM_BUILD_ROOT/usr/share/man/man5
%files
%defattr(-,root,root)
%dir /etc/%{sca_common}
%dir /srv/www/htdocs/%{sca_common}
%dir /usr/share/doc/packages/%{sca_common}
/usr/sbin/*
%config /etc/%{sca_common}/*
%doc /usr/share/man/man8/*
%doc /usr/share/man/man5/*
%attr(-,wwwrun,www) /srv/www/htdocs/%{sca_common}
%attr(-,wwwrun,www) /usr/share/doc/packages/%{sca_common}/index.html
%doc /usr/share/doc/packages/%{sca_common}/*
%post
if [[ -s /srv/www/htdocs/index.html ]]; then
if grep -i '<html><body><h1>It works!</h1></body></html>' /srv/www/htdocs/index.html &>/dev/null; then
mv /srv/www/htdocs/index.html /srv/www/htdocs/index.html.sca_orig
cp -a /usr/share/doc/packages/%{sca_common}/index.html /srv/www/htdocs/
else
echo
echo "WARNING: File already exists: /srv/www/htdocs/index.html"
echo " Redirector /usr/share/doc/packages/%{sca_common}/index.html will not be installed."
echo
fi
else
cp -a /usr/share/doc/packages/%{sca_common}/index.html /srv/www/htdocs/
fi
%postun
if [[ -s /srv/www/htdocs/index.html.sca_orig ]]; then
mv /srv/www/htdocs/index.html.sca_orig /srv/www/htdocs/index.html
elif grep -i 'sca/index.php' /srv/www/htdocs/index.html &>/dev/null; then
mv /srv/www/htdocs/index.html /srv/www/htdocs/index.html.sca_redirector
fi
%changelog