File qtsmbstatus.spec of Package qtsmbstatus
#
# spec file for package qtsmbstatus
#
# 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/
#
Name: qtsmbstatus
Version: 2.3.1
Release: 0
Summary: A GUI for smbstatus with Qt
License: GPL-2.0
Group: Productivity/Networking/Samba
Url: http://qtsmbstatus.free.fr
Source0: http://qtsmbstatus.free.fr/files/%{name}-%{version}.tar.gz
Source1: %{name}-rpmlintrc
BuildRequires: libqt4-devel
BuildRequires: libqt4-linguist
BuildRequires: pam-devel
BuildRequires: update-desktop-files
Recommends: %{name}-lang
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
QtSmbstatus is a GUI (graphical user interface) for smbstatus. It is meant to
provide the possibility of administering remote machines. QtSmbstatus was designed
as a client/server system secured with SSL. A login and password is required to
log on to server (PAM). The server's application ought to be installed with
samba-server.
%package lang
Summary: Language files for %{name}
Group: Productivity/Networking/Samba
%description lang
A GUI for smbstatus with Qt: Language files
%package light
Summary: A GUI for smbstatus with Qt (light version)
Group: Productivity/Networking/Samba
Recommends: %{name}-lang
%description light
QtSmbstatus light client without network support
%package server
Summary: A GUI for smbstatus with Qt (Server)
Group: Productivity/Networking/Samba
Requires: samba
Requires(pre): hostname
Requires(pre): openssl
%description server
A GUI for smbstatus with Qt: qsmbstatusd, the server
%prep
%setup -q
sed -e 's/lrelease-qt4/lrelease/g' -i client/client.pro
%build
qmake QMAKE_CFLAGS="%{optflags}" QMAKE_CXXFLAGS="%{optflags}"
make %{?_smp_mflags}
%install
# client
install -D -m 755 client/bin/%{name} %{buildroot}/%{_bindir}/%{name}
install -D -m 644 client/%{name}.xpm %{buildroot}/%{_datadir}/pixmaps/%{name}.xpm
install -D -m 644 client/%{name}.desktop %{buildroot}/%{_datadir}/applications/%{name}.desktop
install -D -m 644 client/%{name}.7.gz %{buildroot}/%{_mandir}/man7/%{name}.7.gz
%suse_update_desktop_file -r %{name} Network Monitor
# light client
install -D -m 755 light/bin/%{name}l %{buildroot}/%{_bindir}/%{name}l
install -D -m 644 light/%{name}l.xpm %{buildroot}/%{_datadir}/pixmaps/%{name}l.xpm
install -D -m 644 light/%{name}l.desktop %{buildroot}/%{_datadir}/applications/%{name}l.desktop
install -D -m 644 light/%{name}l.7.gz %{buildroot}/%{_mandir}/man7/%{name}l.7.gz
%suse_update_desktop_file -r %{name}l Network Monitor
# lang
pushd client/tr
for i in *.qm; do
install -D -m 644 $i %{buildroot}/%{_datadir}/%{name}/$i
done
popd
# server
install -D -m 755 server/bin/%{name}d %{buildroot}/%{_bindir}/%{name}d
install -D -m 644 server/pam.d/%{name}d %{buildroot}/%{_sysconfdir}/pam.d/%{name}d
install -D -m 644 server%{_sysconfdir}/%{name}d.conf %{buildroot}/%{_sysconfdir}/%{name}d/%{name}d.conf
install -D -m 644 server%{_sysconfdir}/%{name}d.users %{buildroot}/%{_sysconfdir}/%{name}d/%{name}d.users
install -D -m 644 server/%{name}d.7.gz %{buildroot}/%{_mandir}/man7/%{name}d.7.gz
# create systemd service
mkdir -pv %{buildroot}/%{_unitdir}
tee %{buildroot}/%{_unitdir}/%{name}.service << "EOF"
[Unit]
Description=Graphical user interface for smbstatus - server part
Wants=smb.service
After=smb.service
[Service]
ExecStart=%{_bindir}/%{name}d
KillSignal=SIGQUIT
[Install]
WantedBy=multi-user.target
EOF
mkdir %{buildroot}%{_sbindir}
pushd %{buildroot}%{_sbindir}
ln -s service rc%{name}
popd
%pre server
%service_add_pre %{name}.service
%post server
# create key and certificate files
if [ ! -f %{_sysconfdir}/%{name}d/privkey.pem ] ; then
%{_bindir}/openssl genrsa -rand \
/proc/apm:/proc/cpuinfo:/proc/dma:/proc/filesystems:/proc/interrupts:/proc/ioports:/proc/pci:/proc/rtc:/proc/uptime \
2048 > %{_sysconfdir}/%{name}d/privkey.pem 2> /dev/null
fi
FQDN=`hostname`
if [ "x${FQDN}" = "x" ]; then
FQDN=localhost.localdomain
fi
if [ ! -f %{_sysconfdir}/%{name}d/server.pem ] ; then
cat << EOF | %{_bindir}/openssl req -new -x509 -key %{_sysconfdir}/%{name}d/privkey.pem \
-out %{_sysconfdir}/%{name}d/server.pem -days 365 2>/dev/null
--
SomeState
SomeCity
SomeOrganization
SomeOrganizationalUnit
${FQDN}
root@${FQDN}
EOF
fi
%service_add_post %{name}.service
%preun server
%service_del_preun %{name}.service
%postun server
%service_del_postun %{name}.service
%files
%defattr(-,root,root)
%doc changelog COPYING README README-ES README-FR
%{_bindir}/%{name}
%{_datadir}/pixmaps/%{name}.xpm
%{_datadir}/applications/%{name}.desktop
%{_mandir}/man7/%{name}.7%{ext_man}
%files light
%defattr(-,root,root)
%{_bindir}/%{name}l
%{_datadir}/pixmaps/%{name}l.xpm
%{_datadir}/applications/%{name}l.desktop
%{_mandir}/man7/%{name}l.7%{ext_man}
%files lang
%defattr(-,root,root)
%dir %{_datadir}/%{name}
%{_datadir}/%{name}/*.qm
%files server
%defattr(-,root,root)
%{_bindir}/%{name}d
%{_sbindir}/rc%{name}
%{_unitdir}/%{name}.service
%config%{_sysconfdir}/pam.d/%{name}d
%dir %{_sysconfdir}/%{name}d
%config %{_sysconfdir}/%{name}d/%{name}d.conf
%config %{_sysconfdir}/%{name}d/%{name}d.users
%ghost %attr(0600,root,root) %config(noreplace) %{_sysconfdir}/%{name}d/privkey.pem
%ghost %attr(0644,root,root) %config(noreplace) %{_sysconfdir}/%{name}d/server.pem
%{_mandir}/man7/%{name}d.7%{ext_man}
%changelog