File epoptes.spec of Package epoptes

# spec file for package epoptes
# Copyright (c) 2012 CyberOrg Info
# 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
Name:           epoptes
Version:        0
Release:        1
License:        GPL-2.0+
Summary:        Computer lab management tool
Group:          System/X11/Utilities
Source:         %{name}-%{version}.tar.xz
Source1:        epoptes-rpmlintrc
Source2:        epoptes.service
Source3:        epoptes-client.service
Source4:        epoptes.sysconfig
Source5:        epoptes-client.sysconfig
%if 0%{?suse_version}
Source20:       epoptes-SuSEfirewall2
Patch0:         epoptes-client-workaround-multiseat-broadcasting.patch
Patch3:         epoptes-client-x11vnc-wrapper.patch
Patch4:         epoptes_config.py_sysconfig_support.patch
Patch5:         epoptes-client_sysconfig_support.patch
BuildRequires:  intltool
BuildRequires:  openssl
BuildRequires:  python3-devel
BuildRequires:  python3-distutils-extra
BuildRequires:  systemd
BuildRequires:  pwdutils
BuildRequires:  update-desktop-files
BuildRequires:  libfaketime
Requires:       gdk-pixbuf-loader-rsvg
Requires:       python-gtk
Requires:       python-notify
Requires:       python-Twisted
# WARNING: This is much more a python-Twisted dependency than a Epoptes one.
Requires:       python-service_identity
Requires:       typelib-1_0-Notify-0_7
Requires:       python3-netifaces
Requires:       pwdutils
Requires:       libfaketime
Requires:       tightvnc
Requires:       iperf
Requires:       openssl
Requires:       python-pycha
Requires:       python-netifaces
Requires:       socat
Requires:       x11vnc
Requires:       xset
Requires:       xwininfo
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch

Epoptes (Επόπτης  - a Greek word for overseer) is an open source computer lab
management and monitoring tool. It allows for screen broadcasting and
monitoring, remote command execution, message sending, imposing restrictions
like screen locking or sound muting the clients and much more!

Visit for more information.

%package client
Summary:        Epoptes client
Requires:       gdk-pixbuf-loader-rsvg
Requires:       python-gtk
Requires:       iperf
Requires:       screen
Requires:       socat
Requires:       tightvnc
Requires:       x11vnc
Requires:       xset
Requires:       xwininfo
Requires:       python3-cairo

%description client
This is a client part of Epoptes Computer lab management tool

%define __sysconfdir %{_sysconfdir}/%{name}

%setup -q -n %{name}-%{version}
# %%patch0 -p0
%patch3 -p0
# %%patch4 -p0
%patch5 -p0

for file in $(find . -type f -name "*.py" ); do
	sed -i "s|/usr/bin/env python|%{_bindir}/python|g" $file


./ install --root=%{buildroot} --prefix=%{_prefix}
# ui files do not get installed automatically
mkdir -p %{buildroot}%{_datadir}/%{name}
for f in $(ls epoptes/ui/gtk/*.ui); do
  %__install -m 644 $f %{buildroot}%{_datadir}/%{name}/${f#epoptes/ui/gtk/}
find %{buildroot} \( -name \*.a -o -name \*.la -o -name \*.orig \) -print0 | xargs -0 rm -f
mkdir -p %{buildroot}%{_fillupdir}
%__install -m 644 %{SOURCE4} %{buildroot}%{_fillupdir}/sysconfig.%{name}
%__install -m 644 %{SOURCE5} %{buildroot}%{_fillupdir}/sysconfig.%{name}-client
mkdir -p %{buildroot}%{_unitdir}
%__install -m 644 %{SOURCE2} %{buildroot}%{_unitdir}
%__install -m 644 %{SOURCE3} %{buildroot}%{_unitdir}
install -Dm644 %{SOURCE20} %{buildroot}%{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/%{name}
%find_lang %{name}

%__rm -rf %{buildroot}

%service_add_pre %{name}.service

%pre client
%service_add_pre %{name}-client.service

%{fillup_only -n %{name}}
if ! getent group %{name} >/dev/null; then
    groupadd --system %{name}

if ! [ -f %{__sysconfdir}/server.key ] || ! [ -f %{__sysconfdir}/server.crt ] || ! [ -s %{__sysconfdir}/server.crt ]; then
    if ! [ -d %{__sysconfdir} ]; then
        %{__mkdir_p} %{__sysconfdir}
    faketime '1970-01-01 00:00:00 UTC' openssl req -batch -x509 -nodes -newkey rsa:1024 -days $(($(date --utc +%s) / 86400 + 3652)) -keyout %{__sysconfdir}/server.key -out %{__sysconfdir}/server.crt ||
    openssl req -batch -x509 -nodes -newkey rsa:1024 -days $(($(date --utc +%s) / 86400 + 3652)) -keyout %{__sysconfdir}/server.key -out %{__sysconfdir}/server.crt
    chmod 600 %{__sysconfdir}/server.key

%service_add_post %{name}.service

%post client
%{fillup_only -n %{name}-client}
%service_add_post %{name}-client.service

%service_del_preun %{name}.service

%preun client
%service_del_preun %{name}-client.service

%service_del_postun %{name}.service

%postun client
%service_del_postun %{name}-client.service

%files -f %{name}.lang
%defattr(-, root, root)
%config(noreplace) %{_fillupdir}/sysconfig.%{name}
%config %{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/%{name}
# %%{python_sitelib}/
%dir %{_datadir}/doc/%{name}

%files client
%defattr(-, root, root)
%config(noreplace) %{_fillupdir}/sysconfig.%{name}-client
%attr(755, -, -) %{_datadir}/%{name}-client/x11vnc-wrapper

openSUSE Build Service is sponsored by