# # spec file for package grommunio-admin-api # # Copyright (c) 2023 SUSE LLC # # 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 https://bugs.opensuse.org/ # %if 0%{?centos_version} %global _unpackaged_files_terminate_build 0 %endif %define __python /usr/bin/python3 %{?sle15_python_module_pythons} %define skip_python2 1 # hey old suse %define _libexecdir %_prefix/libexec Name: grommunio-admin-api Version: 1.17.4.2d980ab Release: 0 Summary: Backend for grommunio management License: AGPL-3.0-or-later Group: Productivity/Networking/Email/Servers URL: https://grommunio.com/ #Git-Clone: https://github.com/grommunio/admin-api Source: %name-%version.tar.xz BuildRequires: cmake BuildRequires: polkit BuildRequires: python-rpm-macros BuildRequires: group(grommunio) BuildRequires: pkgconfig(systemd) BuildRequires: user(grommunio) BuildArch: noarch Requires(pre): user(grommunio) Requires(pre): group(grommunio) Requires(post): coreutils Requires(post): openssl Requires(post): user(grommunio) Requires(post): group(gromox) Requires: grommunio-admin-common Requires: nginx Requires: polkit %if 0%{?suse_version} BuildRequires: %{python_module PyYAML} # %%primary_python not available in Leap yet Requires: %(echo %{python_module argcomplete} | perl -pe 's{.* }{}g') Requires: %(echo %{python_module cryptography} | perl -pe 's{.* }{}g') Requires: %(echo %{python_module Flask} | perl -pe 's{.* }{}g') Requires: %(echo %{python_module jsonschema} | perl -pe 's{.* }{}g') Requires: %(echo %{python_module ldap3} | perl -pe 's{.* }{}g') Requires: %(echo %{python_module mattermostdriver} | perl -pe 's{.* }{}g') Requires: %(echo %{python_module multidict} | perl -pe 's{.* }{}g') Requires: %(echo %{python_module mysqlclient} | perl -pe 's{.* }{}g') Requires: %(echo %{python_module openapi-core} | perl -pe 's{.* }{}g') >= 0.12.0 Requires: %(echo %{python_module openapi-schema-validator} | perl -pe 's{.* }{}g') Requires: %(echo %{python_module openapi-spec-validator} | perl -pe 's{.* }{}g') Requires: %(echo %{python_module psutil} | perl -pe 's{.* }{}g') Requires: %(echo %{python_module pyexmdb} | perl -pe 's{.* }{}g') >= 1.10.0 Requires: %(echo %{python_module redis} | perl -pe 's{.* }{}g') Requires: %(echo %{python_module requests} | perl -pe 's{.* }{}g') Requires: %(echo %{python_module sqlalchemy} | perl -pe 's{.* }{}g') Requires: %(echo %{python_module systemd} | perl -pe 's{.* }{}g') Requires: %(echo %{python_module dnspython} | perl -pe 's{.* }{}g') Requires: %(echo %{python_module PyJWT} | perl -pe 's{.* }{}g') Requires: %(echo %{python_module PyYAML} | perl -pe 's{.* }{}g') Requires: %(echo %{python_module websockets} | perl -pe 's{.* }{}g') Requires: uwsgi Requires: uwsgi-python3 Suggests: %(echo %{python_module termcolor} | perl -pe 's{.* }{}g') %else BuildRequires: python3-pyyaml Requires: python3-Flask Requires: python3-argcomplete Requires: python3-cryptography Requires: python3-dns Requires: python3-isodate Requires: python3-jsonschema Requires: python3-jwt Requires: python3-lazy-object-proxy Requires: python3-ldap3 >= 2.6 Requires: python3-mattermostdriver Requires: python3-more-itertools Requires: python3-multidict Requires: python3-mysqlclient Requires: python3-openapi-core >= 0.12.0 Requires: python3-openapi-schema-validator Requires: python3-openapi-spec-validator Requires: python3-parse Requires: python3-psutil Requires: python3-pyexmdb >= 1.10.0 Requires: python3-pyyaml Requires: python3-redis Requires: python3-requests Requires: python3-sqlalchemy Requires: python3-systemd Requires: python3-uwsgidecorators Requires: uwsgi Requires: uwsgi-plugin-python3 Suggests: python3-termcolor %endif %description The grommunio admin-api provides a state-of-the-art REST-interface for operations with the grommunio software suite. The primary grommunio client grommunio admin-web uses admin-api for data retrieval, and for administrative tasks, such as creating, deleting and modifying users. %prep %autosetup -p1 %build %if 0%{?suse_version} >= 1550 || 0%{?sle_version} >= 150500 base="$PWD" %{python_expand # %define __builddir b%$python_bin_suffix %cmake -DPython3_EXECUTABLE=%{_bindir}/python%$python_bin_suffix %cmake_build cd "$base" } %else %cmake %cmake_build %endif %install %if 0%{?suse_version} >= 1550 || 0%{?sle_version} >= 150500 base="$PWD" %{python_expand # %define __builddir b%$python_bin_suffix %cmake_install cd "$base" perl -i -lpe 's{#!/usr/bin/env python.*}{#!/usr/bin/python'"%{$python_bin_suffix}"'}g' %buildroot/%_datadir/%name/*.py } %else %cmake_install %endif %global services grommunio-admin-api.service grommunio-admin-api.socket %pre %if 0%{?service_add_pre:1} %service_add_pre %services %endif %post for i in gromox systemd-journal; do getent group "$i" >/dev/null || groupadd -r "$i" usermod grommunio -aG "$i" || : done %tmpfiles_create grommunio-admin-api.conf %if 0%{?service_add_post:1} %service_add_post %services %else %systemd_post %services %endif if ! test -x /usr/bin/systemctl; then exit 0 fi if [ ! -e /etc/grommunio-admin-api/jwt-privkey.pem ] || [ ! -e /etc/grommunio-admin-api/jwt-pubkey.pem ] ; then rm -f /etc/grommunio-admin-api/jwt-{priv,pub}key.pem openssl genrsa -out /etc/grommunio-admin-api/jwt-privkey.pem 4096 || : openssl rsa -in /etc/grommunio-admin-api/jwt-privkey.pem -outform PEM -pubout -out /etc/grommunio-admin-api/jwt-pubkey.pem || : chown grommunio:grommunio /etc/grommunio-admin-api/jwt-privkey.pem \ /etc/grommunio-admin-api/jwt-pubkey.pem || : fi %preun %if 0%{?service_del_preun:1} %service_del_preun %services %else %systemd_preun %services %endif %postun %if 0%{?service_del_postun:1} %service_del_postun %services %else %systemd_postun_with_restart %services %endif %files %dir %_sysconfdir/grommunio-admin-api %dir %attr(0750, grommunio, grommunio) %_sysconfdir/grommunio-admin-api/conf.d %dir %_sysconfdir/grommunio-admin-common %dir %attr(0750, grommunio, grommunio) %_sysconfdir/grommunio-admin-common/license %if 0%{?suse_version} %attr(0750,root,root) %dir %_sysconfdir/sudoers.d %endif %attr(0440,root,root) %_sysconfdir/sudoers.d/grommunio-sudo %dir %attr(0700, grommunio, grommunio) %_sharedstatedir/%name %_datadir/bash-completion/ %_datadir/polkit-1/rules.d/*.rules %dir %_datadir/grommunio-admin-common %dir %_datadir/grommunio-admin-common/nginx.d %_datadir/grommunio-admin-common/nginx.d/api.conf %_datadir/grommunio-admin-common/portrait.jpg %_datadir/grommunio-admin-api/ %_unitdir/* %_sbindir/grommunio-admin %_tmpfilesdir/*.conf %_mandir/man*/*.[0-9]* %ghost %dir /run/grommunio %license LICENSE.txt %changelog