LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File smbtatools.spec of Package smbtatools (Project home:BenniBrunner)

#
# spec file for package smbtatools
#
# Copyright (c) 2012 SUSE LINUX Products 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/
#


Name:           smbtatools
BuildRequires:  cairo-devel
BuildRequires:  cmake
BuildRequires:  curl-devel
BuildRequires:  libdbi-devel
BuildRequires:  libqt4-devel
BuildRequires:  libsmbclient-devel
BuildRequires:  libtalloc-devel
BuildRequires:  ncurses-devel
BuildRequires:  pango-devel

%if 0%{?suse_version}
BuildRecommends:  libiniparser-devel sqlite3-devel
%endif

%if 0%{defined fedora}
BuildRequires:  iniparser-devel
%endif

Version:        1.2.6
Release:        0
Summary:        Tools for configuration and query of SMB Traffic Analyzer
License:        GPL-3.0+
Group:          Productivity/Networking/Samba
Url:            http://github.com/hhetter/smbtatools
Source0:        %{name}-%{version}.tar.bz2
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
The smbtatools contain utility programs helping the end user to query the database that is created by the smbtad program. smbtatools is part of the SMB Traffic Analyzer project, which allows to create statistics about the data flow on a Samba network. For more information, please see: http://holger123.wordpress.com/smb-traffic-analyzer/

%package websmbta
Summary:        Webfrontend for smbtaquery
Group:          Productivity/Networking/Samba
# 12.2 stuff only
%if 0%{?suse_version} > 1210
BuildRequires:  apache2
BuildRequires:  ruby
BuildRequires:  rubygem-bcrypt-ruby
BuildRequires:  rubygem-bundler
BuildRequires:  rubygem-passenger-apache2
BuildRequires:  rubygem-rails-3_2
BuildRequires:  rubygem-sqlite3

Requires:       apache2
Requires:       ruby
Requires:       rubygem-bcrypt-ruby
Requires:       rubygem-bundler
Requires:       rubygem-passenger-apache2
Requires:       rubygem-rails-3_2
Requires:       rubygem-sqlite3
%endif
Requires:       smbtatools

%description websmbta
A Ruby-on-Rails3 based webfrontend for smbtaquery.
Authors:
--------
    Benjamin Brunner <bbrunner@suse.de>
    

%prep
%setup -q

%build
if test ! -e "build"; then
  %{__mkdir} build
fi

pushd build
cmake \
  -DCMAKE_C_FLAGS:STRING="%{optflags}" \
  -DCMAKE_CXX_FLAGS:STRING="%{optflags}" \
  -DCMAKE_SKIP_RPATH=ON \
  -DCMAKE_BUILD_TYPE=RelWithDebInfo \
  -DCMAKE_INSTALL_PREFIX=%{_prefix} \
  -DSYSCONF_INSTALL_DIR=%{_sysconfdir} \
%if %{_lib} == lib64
  -DLIB_SUFFIX=64 \
%endif
  %{_builddir}/%{name}-%{version}
%__make %{?jobs:-j%jobs} VERBOSE=1
popd build

%install
pushd build
%if 0%{?suse_version}
%makeinstall
%else
make DESTDIR=%{buildroot} install
%endif
popd build
mkdir -p $RPM_BUILD_ROOT/srv/www/htdocs
%__cp -r $RPM_BUILD_DIR/smbtatools-%{version}/src/websmbta $RPM_BUILD_ROOT/srv/www/htdocs
cd $RPM_BUILD_ROOT/srv/www/htdocs/websmbta
# run this only in 12.2
%if 0%{?suse_version} > 1210
rake db:create RAILS_ENV=production
rake db:migrate RAILS_ENV=production
%endif
cd -
# remove unneded git helper files
find $RPM_BUILD_ROOT/srv/www/htdocs/websmbta -name .git* -exec rm {} \;
# install config file
%if 0%{?suse_version} > 1210
mkdir -p $RPM_BUILD_ROOT/etc/apache2/vhosts.d
cp $RPM_BUILD_ROOT/srv/www/htdocs/websmbta/websmbta.vhost.conf $RPM_BUILD_ROOT/etc/apache2/vhosts.d/websmbta.conf
%endif

%post websmbta
count=$(grep -c ^NameVirt /etc/apache2/listen.conf)
export count
if [ $count -eq 0 ]; then
        echo "NameVirtualHost *:80" >> /etc/apache2/listen.conf
fi

%clean
%__rm -rf %{buildroot}

%files
%defattr(-,root,root)
%dir /usr/share/smbtatools
%{_bindir}/smbtaquery
%{_bindir}/smbtamonitor*
%{_bindir}/smbtatorture
%{_bindir}/rrddriver
%{_bindir}/smbtatorturesrv

%{_mandir}/man?/smbtaquery.*
%{_mandir}/man?/smbtamonitor.*
%{_mandir}/man?/smbtatorture.*

/usr/share/smbtatools/*

%doc doc/gfx/*.png

%files websmbta
%defattr(-,root,root)
%dir /srv/www/htdocs/websmbta
%config /etc/apache2/vhosts.d/websmbta.conf
/srv/www/htdocs/websmbta/*
%attr( 660, root, www) /srv/www/htdocs/websmbta/db/production.sqlite3

%changelog