File otobo.spec of Package otobo
#
# spec file for package otobo
#
# Copyright (c) 2023 SUSE LLC
# Copyright (c) 2023 Scorpio IT, Deidesheim, DE
#
# 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/
#
#Compat macro for new _fillupdir macro introduced in Nov 2017
%if ! %{defined _fillupdir}
%define _fillupdir /var/adm/fillup-templates
%endif
Name: otobo
%define otobo_ver 10.1.8
%define itsm_ver 10.1.3
%define itsm_min 10
%define otobo_root /srv/%{name}
%define otobodoc_dir_files AUTHORS* CHANGES* COPYING* CREDITS LICENSE README* doc
%define otobodocs CHANGES* doc
Summary: The Open Ticket Request System
License: GPL-3.0-or-later
Group: Productivity/Networking/Email/Utilities
Version: %{otobo_ver}
Release: 0
URL: https://otobo.de/
Source: https://ftp.otobo.org/pub/%{name}/%{name}-%{otobo_ver}.tar.gz
Source1: itsm-%{itsm_ver}.tar.bz2
Source2: %{name}.rpmlintrc
# Used to update the itsm package
Source11: sysconfig.%{name}
Source12: %{name}.README.en
Source13: %{name}.README.de
Source14: itsm.README.en
Source15: itsm.README.de
Source16: ZZZAuto.pm
Source20: %{name}.service
Source21: %{name}.service.helper.sh
#
Source99: itsm-update.sh
# PATCH-FIX-OPENSUSE -- VARS for conf and fix for apache >= 2.4
Patch1: %{name}-httpd_conf.patch
# PATCH-FIX-OPENSUSE -- don't test write permissions on bin/
Patch2: otobo-perm_test.patch
BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Requires(pre): coreutils
Requires(pre): shadow
Requires(post): %fillup_prereq
Requires(post): apache2
Requires(post): coreutils
Requires(post): sed
Requires(post): shadow
BuildRequires: fdupes
BuildRequires: pwdutils
#
%if 0%{?suse_version} >= 1210
BuildRequires: pkgconfig(systemd)
%{?systemd_ordering}
%define has_systemd 1
%endif
#
Requires: apache2-mod_perl
Requires: elasticsearch
Requires: fetchmail
Requires: mysql
Requires: mysql-client
Requires: perl
Requires: procmail
Requires: perl(Archive::Tar)
Requires: perl(Archive::Zip)
Requires: perl(Const::Fast)
Requires: perl(Convert::BinHex)
Requires: perl(CGI::PSGI)
Requires: perl(DBD::mysql)
Requires: perl(DBI)
Requires: perl(DBIx::Connector)
Requires: perl(Date::Format)
Requires: perl(DateTime)
Requires: perl(Digest::SHA)
Requires: perl(File::chmod)
Requires: perl(LWP::UserAgent)
Requires: perl(List::AllUtils)
Requires: perl(List::Util::XS)
Requires: perl(Moo)
Requires: perl(Net::DNS) >= 0.60
# fix for BUG gh#14357
Requires: perl(Net::SMTP) >= 3.11
Requires: perl(Net::SMTP::SSL)
Requires: perl(Path::Class)
Requires: perl(Plack)
Requires: perl(Plack::Middleware::Header)
Requires: perl(Plack::Middleware::ReverseProxy)
Requires: perl(Template)
Requires: perl(Template::Stash::XS)
Requires: perl(Text::Trim)
Requires: perl(Time::HiRes)
Requires: perl(Time::Piece)
Requires: perl(Try::Tiny)
Requires: perl(Unicode::Collate)
Requires: perl(XML::LibXML)
Requires: perl(YAML::XS)
#
Recommends: perl(Apache::DBI)
Recommends: perl(Apache2::Reload)
Recommends: perl(Authen::SASL)
Recommends: perl(Crypt::Eksblowfish::Bcrypt)
Recommends: perl(Crypt::SSLeay)
Recommends: perl(GD)
Recommends: perl(GD::Graph)
Recommends: perl(GD::Text)
Recommends: perl(IO::Socket::SSL)
Recommends: perl(JSON::XS)
Recommends: perl(Mail::IMAPClient) >= 3.22
Recommends: perl(ModPerl::Util)
Recommends: perl(Net::SSL)
Recommends: perl(PDF::API2) >= 0.73
Recommends: perl(SOAP::Lite)
Recommends: perl(Sub::Exporter)
Recommends: perl(Text::CSV_XS)
Recommends: perl(XML::LibXSLT)
Recommends: perl(XML::Parser)
#
Suggests: perl(Authen::NTML)
Suggests: perl(DBD::ODBC)
Suggests: perl(DBD::Oracle)
Suggests: perl(DBD::Pg)
Suggests: perl(Encode::HanExtra) >= 0.23
Suggests: perl(Net::LDAP)
#
### Framework -> Crypt::SMIME
Recommends: ca-certificates
%if "%_vendor" == "suse"
%define VENDOR SUSE
%else
%define VENDOR %_vendor
%endif
%description
OTOBO is a Ticket Request System with many features to manage
customer telephone calls and e-mails.
Feature list: see README
Authors list: see CREDITS
%package doc
Summary: OTOBO Documentation
Group: Documentation/Other
%description doc
This package contains the README, Changes and docs for OTOBO
Authors list: see CREDITS
%package -n otobo-itsm
Summary: ITIL focused IT service management
Group: Productivity/Networking/Email/Utilities
Version: %{itsm_ver}
Release: 0
Requires: %{name} >= %{itsm_ver}
Provides: OTOBO::ITSM
Provides: itsm = %{itsm_ver}
%description itsm
OTOBO::ITSM implements ITIL focused IT service management.
You need a OTOBO %{otobo_ver} (https://otobo.de/) installation.
Make sure your database accepts packages over 5 MB in size. A MySQL database
for example accepts packages up to 1 MB by default. In this case, the value for
max_allowed_packet must be increased. The recommended maximum size accepted is
20 MB.
for INSTALL see INSTALL-%{itsm_min}.ITSM
please see README.itsm for further details, which comes with otobo package
Required OTOBO::ITSM modules can be found under %{otobo_root}/itsm
Authors list: see CREDITS
%prep
%setup -q -n %{name}-%{otobo_ver} -a 1
%patch1
%patch2
### Is this critical ? (https://bugs.otrs.org/show_bug.cgi?id=12889)
# rpmlint: pem-certificate /srv/otrs/Kernel/cpan-lib/Mozilla/CA/cacert.pem
#rm -f Kernel/cpan-lib/Mozilla/CA/cacert.pem
rm -f CONTRIBUTING.md INSTALL.md UPDATING.md
### UPGRADING.SUSE
#cp %{S:17} .
# fix @OTOBO_ROOT@
#sed -i -e "s,@OTOBO_ROOT@,%{otobo_root},g" UPGRADING.SUSE
### ZZZAuto.pm for OTOBO::ITSM
pushd Kernel/Config/Files
cp %{S:16} .
# fix @OTOBO_ROOT@
sed -i -e "s,@OTOBO_ROOT@,%{otobo_root},g" ZZZAuto.pm
popd
# remove unwanted files (Installed (but unpackaged) file(s) found:)
rm -rf \
.dockerignore \
.github \
.otobo-ci.yml \
Kernel/Config.pm.docker.dist \
cpanfile* \
hooks \
%{name}.*
# remove not needed devel files from bin
rm -rf \
bin/devel
# remove not needed files from scripts
rm -rf \
scripts/*.spec \
scripts/auto_build \
scripts/redhat-* \
scripts/suse-*rc*otobo*
# scripts/test [Kernel::System::Package::_FileInstall]
# fix old otobo_root (/opt)
sed -i -e "s,/opt/%{name},%{otobo_root},g" \
bin/Cron.sh \
i18n/otobo/otobo.*.po \
Kernel/Config/Defaults.pm \
Kernel/Config/Files/XML/Daemon.xml \
Kernel/Config/Files/XML/Framework.xml \
Kernel/Config.pm.dist \
Kernel/Language/*.pm \
Kernel/Modules/AdminDynamicFieldText.pm \
Kernel/Output/HTML/Templates/Standard/AdminGenericInterfaceTransportHTTPSOAP.tt \
Kernel/System/SysConfig.pm \
Kernel/System/ACL/DB/ACL.pm \
Kernel/System/Environment.pm \
Kernel/System/ProcessManagement/DB/Process.pm \
Kernel/System/UnitTest/Helper.pm \
scripts/apache2-perl-preload_otobo_psgi.pl
### rpmlint
# wrong-file-end-of-line-encoding
#perl -p -i -e "s|\r\n|\n|" itsm-%{itsm_ver}/INSTALL-%{itsm_min}.ITSM
# env-script-interpreter
for i in $(grep -R "/usr/bin/env perl" * | awk -F':' '{print $1}'); do
sed -i -e "s,/usr/bin/env perl,/usr/bin/perl," "${i}"
done
%build
# copy config file
cp -a Kernel/Config.pm.dist Kernel/Config.pm
# copy all crontab dist files
for file in var/cron/*.dist; do
mv $file var/cron/$(basename $file .dist)
done
%install
export DESTROOT="%{otobo_root}/"
install -d %{buildroot}/${DESTROOT}
install -d %{buildroot}/%{_sbindir}
# install OTOBO base system
cp -a . %{buildroot}/${DESTROOT}
# remove SECURITY.md
rm -f %{buildroot}/${DESTROOT}/SECURITY.md
for configFile in .fetchmailrc .mailfilter .procmailrc; do
touch %{buildroot}/${DESTROOT}/${configFile}
done
touch %{buildroot}${DESTROOT}var/log/TicketCounter.log
# install README
for lang in en de; do
cp -p "%{_sourcedir}/%{name}.README.${lang}" "README.%{VENDOR}.${lang}"
cp -p "%{_sourcedir}/itsm.README.${lang}" "README.itsm.%{VENDOR}.${lang}"
done
# fix @OTOBO_ROOT@ in README.*
for r in $(ls -1 README.*); do
sed -i -e "s,@OTOBO_ROOT@,%{otobo_root},g" $r
done
# remove files that are part of the docdir
pushd %{buildroot}/${DESTROOT}
rm -rf %{otobodoc_dir_files}
install -d doc
popd
# sysconfig
install -D -m 0644 %{S:11} %{buildroot}%{_fillupdir}/sysconfig.%{name}
# fix @OTOBO_ROOT@
sed -i -e "s,@OTOBO_ROOT@,%{otobo_root},g" %{buildroot}%{_fillupdir}/sysconfig.%{name}
# systemd
install -D -m 0644 %{S:20} %{buildroot}/%{_unitdir}/%{name}.service
ln -fs %{_sbindir}/service %{buildroot}/%{_sbindir}/rc%{name}
install -D -m 0755 %{S:21} %{buildroot}/%{_bindir}/%{name}.service.helper.sh
# fix @OTOBO_ROOT@
sed -i -e "s,@OTOBO_ROOT@,%{otobo_root},g" "%{buildroot}/%{_unitdir}/%{name}.service"
sed -i -e "s,@OTOBO_ROOT@,%{otobo_root},g" "%{buildroot}/%{_bindir}/%{name}.service.helper.sh"
otobo_apache_conf="scripts/apache2-httpd.include.conf"
install -D -m 0644 ${otobo_apache_conf} %{buildroot}/etc/apache2/conf.d/%{name}.conf
rm -f %{buildroot}/%{otobo_root}/scripts/apache*.conf
# fix @OTOBO_ROOT@
sed -i -e "s,@OTOBO_ROOT@,%{otobo_root},g" %{buildroot}/etc/apache2/conf.d/%{name}.conf
# OTOBO::ITSM
# rename itsm-%{itsm_ver} to itsm
pushd %{buildroot}/${DESTROOT}
mv itsm-%{itsm_ver} itsm
popd
%if 0%{?suse_version} > 1020
%fdupes %{buildroot}/%{otobo_root}/scripts/test
%fdupes %{buildroot}/%{otobo_root}/var
%fdupes %{buildroot}/%{otobo_root}/Kernel/cpan-lib
%endif
%pre
# add new group otobo
if [ -z "`%{_bindir}/getent group %{name} 2>/dev/null`" ]; then
# is it parallel install to otrs ?
if [ -z "`%{_bindir}/getent group otrs 2>/dev/null`" ]; then
%{_sbindir}/groupadd -g 88 -r %{name}
else
%{_sbindir}/groupadd -g 88 -o -r %{name}
fi
fi
# add new user otobo
if [ -z "`%{_bindir}/getent passwd %{name} 2>/dev/null`" ]; then
# is it parallel install to otrs ?
if [ -z "`%{_bindir}/getent passwd otrs 2>/dev/null`" ]; then
%{_sbindir}/useradd -c "OTOBO User" -d %{otobo_root} -G %{name},www -g %{name} -u 88 -r -s /bin/false %{name}
else
%{_sbindir}/useradd -c "OTOBO User" -d %{otobo_root} -G %{name},www -g %{name} -o -u 88 -r -s /bin/false %{name}
# set group otobo as main group for otrs
%{_sbindir}/usermod -G %{name},www -g %{name} otrs
fi
fi
# add group otobo to wwwrun user
%{_sbindir}/usermod -a -G %{name} wwwrun
%service_add_pre %{name}.service
%preun
%service_del_preun %{name}.service
%post
%{fillup_only -n otobo}
%service_add_post %{name}.service
#
%if 0%{?suse_version}
/usr/sbin/a2enmod deflate >/dev/null
/usr/sbin/a2enmod filter >/dev/null
/usr/sbin/a2enmod headers >/dev/null
/usr/sbin/a2enmod perl >/dev/null
/usr/sbin/a2enmod version >/dev/null
%endif
# if rpm is not in update mode
if ! [ $1 -gt 1 ]; then
if [ -z "${YAST_IS_RUNNING}" ]; then
if [ -n "$LC_ALL" ]; then
lang="$LC_ALL"
elif [ -n "$LC_MESSAGE" ]; then
lang="$LC_MESSAGE"
elif [ -n "$LANG" ]; then
lang="$LANG"
else
lang=
fi
echo
case "$lang" in
de_*)
echo "Hinweise zur Erstkonfiguration von OTOBO finden Sie in"
echo "/usr/share/doc/packages/otobo/README.%{VENDOR}.de"
;;
*)
echo "About the initial setup of OTOBO, please read"
echo "/usr/share/doc/packages/otobo/README.%{VENDOR}.en"
;;
esac
echo
fi
fi
exit 0
%postun
%service_del_postun %{name}.service
%files
%defattr(-,root,root,-)
%doc AUTHORS.md CHANGES.md README* SECURITY.md
%license COPYING* LICENSE
%{otobo_root}/ARCHIVE
%{otobo_root}/RELEASE
%{otobo_root}/.bash_completion
%dir %{_sysconfdir}/apache2
%dir %{_sysconfdir}/apache2/conf.d
%config(noreplace) %{_sysconfdir}/apache2/conf.d/%{name}.conf
# systemd
%{_fillupdir}/sysconfig.%{name}
%{_unitdir}/%{name}.service
%{_bindir}/%{name}.service.helper.sh
%{_sbindir}/rc%{name}
# Custom
%{otobo_root}/Custom/README
# i18n
%dir %{otobo_root}/i18n
%{otobo_root}/i18n/*
# scripts/*
%{otobo_root}/scripts/DBUpdate-to-10.1.pl
%{otobo_root}/scripts/DBUpdateTo10_1
%{otobo_root}/scripts/DBUpdateTo10_1.pm
%{otobo_root}/scripts/contrib
%{otobo_root}/scripts/database
%{otobo_root}/scripts/elasticsearch
%{otobo_root}/scripts/nginx
%{otobo_root}/scripts/tools
%{otobo_root}/scripts/webservices
%{otobo_root}/scripts/*.pl
%exclude %{otobo_root}/scripts/vim
# var/cron
%dir %{otobo_root}/var/cron
%config(noreplace) %attr(644,%{name},www) %{otobo_root}/var/cron/*
# var/fonts
%{otobo_root}/var/fonts
# var/processes
%{otobo_root}/var/processes
# var/webservices
%{otobo_root}/var/webservices
###############
## {root,www}
###############
#defattr(0770,root,www,0775)
%defattr(0750,root,www,0750)
# bin
%dir %{otobo_root}/bin
%{otobo_root}/bin/*.pl
%dir %{otobo_root}/bin/cgi-bin
%{otobo_root}/bin/cgi-bin/*.pl
%{otobo_root}/bin/Cron.sh
#dir %{otobo_root}/bin/mojo-bin
#{otobo_root}/bin/mojo-bin/dbviewer.conf
#{otobo_root}/bin/mojo-bin/dbviewer.pl
%dir %{otobo_root}/bin/psgi-bin/
%{otobo_root}/bin/psgi-bin/*.psgi
%exclude %{otobo_root}/bin/%{name}.SetPermissions.pl
###############
## {otobo,otobo}
###############
# otobo HOME
%defattr(-,%{name},%{name})
%dir %{otobo_root}
%ghost %config(noreplace) %{otobo_root}/.fetchmailrc
%ghost %config(noreplace) %{otobo_root}/.mailfilter
%ghost %config(noreplace) %{otobo_root}/.procmailrc
%{otobo_root}/.fetchmailrc.dist
%{otobo_root}/.mailfilter.dist
%{otobo_root}/.procmailrc.dist
%{otobo_root}/.screenrc
###############
## {otobo,www}
###############
%defattr(0644,%{name},www,0775)
# var
%dir %{otobo_root}/var
%{otobo_root}/var/logo-%{name}.png
# var/log
%dir %attr(0770,%{name},www) %{otobo_root}/var/log
%attr(660,%{name},www) %{otobo_root}/var/log/.keep
%ghost %config(noreplace) %attr(660,%{name},www) %{otobo_root}/var/log/TicketCounter.log
# var/sessions
%dir %attr(0770,%{name},www) %{otobo_root}/var/sessions
%attr(660,%{name},www) %{otobo_root}/var/sessions/.keep
# var/spool
%dir %attr(0770,%{name},www) %{otobo_root}/var/spool
%attr(660,%{name},www) %{otobo_root}/var/spool/.keep
###############
## {wwwrun,www}
###############
%defattr(0750,wwwrun,www,0750)
# bin
%exclude %{otobo_root}/bin/docker
%defattr(0644,wwwrun,www,0755)
# Custom
%dir %{otobo_root}/Custom
# doc (is empty), [Kernel::System::Package::_FileInstall]
%dir %{otobo_root}/doc
# scripts/*
%dir %{otobo_root}/scripts
# scripts/test, [Kernel::System::Package::_FileInstall]
%dir %{otobo_root}/scripts/test
%{otobo_root}/scripts/test/*
# var/httpd, [Kernel::System::Package::_FileInstall]
%{otobo_root}/var/httpd
# var/stats
%dir %{otobo_root}/var/stats
%{otobo_root}/var/stats/*
%defattr(0664,wwwrun,www,0775)
# Kernel DIR
%dir %{otobo_root}/Kernel
%dir %{otobo_root}/Kernel/Autoload
%{otobo_root}/Kernel/Autoload/Test.pm
%{otobo_root}/Kernel/Autoload/Znuny4OTOBOPasswordPolicy.pm
%config(noreplace) %attr(0640,wwwrun,www) %{otobo_root}/Kernel/Config.pm
%{otobo_root}/Kernel/Config.pm.dist
%{otobo_root}/Kernel/Config.pod.dist
%dir %{otobo_root}/Kernel/Config
%{otobo_root}/Kernel/Config/Defaults.pm
%dir %{otobo_root}/Kernel/Config/Files
%dir %{otobo_root}/Kernel/Config/Files/XML/
%{otobo_root}/Kernel/Config/Files/XML/*.xml
%{otobo_root}/Kernel/GenericInterface
%{otobo_root}/Kernel/cpan-lib
%dir %{otobo_root}/Kernel/Language
%config(noreplace) %{otobo_root}/Kernel/Language/*.pm
%{otobo_root}/Kernel/Language.pm
%{otobo_root}/Kernel/Modules/
%dir %{otobo_root}/Kernel/Output
%dir %{otobo_root}/Kernel/Output/HTML
%{otobo_root}/Kernel/Output/HTML/*
%{otobo_root}/Kernel/Output/JavaScript
%dir %{otobo_root}/Kernel/Output/PDF
%{otobo_root}/Kernel/Output/PDF/*
%dir %{otobo_root}/Kernel/Output/Template
%{otobo_root}/Kernel/Output/Template/*
%{otobo_root}/Kernel/System/
%files doc
%defattr(644,root,root,755)
%doc %{otobodocs}
%files itsm
%defattr(-,root,root,-)
%doc COPYING* README.itsm*
%{otobo_root}/itsm
%config(noreplace) %attr(0664,wwwrun,www) %{otobo_root}/Kernel/Config/Files/ZZZAuto.pm
%changelog