# # SPEC file for mmDbDaemon # # Noumenia (C) 2019 www.noumenia.gr # # License: GPLv3 # https://opensource.org/license/gpl-3-0/ # %global gitlab_owner noumenia %global gitlab_name mmDbDaemon %global gitlab_version 1.8 %global gitlab_commit 14a3d7a1143459e9919466e09d940ebf5174ae0a %global composer_vendor noumenia %global composer_project mmdbdaemon # "php": ">=7.2.0" %global php_min_ver 7.2.0 %{!?phpdir: %global phpdir %{_datadir}/php} %{!?licensedir: %global licensedir %{_datadir}/licenses} Name: %{gitlab_name} Version: %{gitlab_version} Release: 1%{?dist} Summary: mmDbDaemon is a memory-resident MaxMind Database reader implementation in PHP License: GPLv3 URL: https://gitlab.com/noumenia/mmdbdaemon Source0: %{name}-%{gitlab_version}-%{gitlab_commit}.tar.gz BuildArch: noarch # required for the _unitdir macro BuildRequires: systemd-rpm-macros # composer.json Requires: php(language) >= %{php_min_ver} Requires: php-iconv Requires: php-posix Requires: php-sockets Requires: php-maxmind-db-reader Requires: php-fedora-autoloader # composer Provides: php-composer(%{composer_vendor}/%{composer_project}) = %{version} # weak dependency Recommends: geolite2-city %description Instead of loading the MaxMind database over and over again for multiple queries, mmDbDaemon offers a simple way to run queries on a persistent memory-resident object that forks separate processes in parallel and re-using the same database. %prep %setup -qn %{gitlab_name}-%{gitlab_commit} %install # systemd service mkdir -p %{buildroot}%{_unitdir}/ cp -rp mmdbdaemon.service %{buildroot}%{_unitdir}/ chmod 0644 %{buildroot}%{_unitdir}/mmdbdaemon.service # the daemon executable mkdir -p %{buildroot}%{_sbindir}/ cp -rp mmdbdaemon %{buildroot}%{_sbindir}/ # libraries mkdir -p %{buildroot}%{phpdir}/%{name}/ cp -rp controller %{buildroot}%{phpdir}/%{name}/ cp -rp interface %{buildroot}%{phpdir}/%{name}/ cp -rp library %{buildroot}%{phpdir}/%{name}/ # documentation mkdir -p %{buildroot}%{_docdir}/%{name}/ cp -rp CHANGELOG.md %{buildroot}%{_docdir}/%{name}/ cp -rp composer.json %{buildroot}%{_docdir}/%{name}/ cp -rp README.md %{buildroot}%{_docdir}/%{name}/ # license mkdir -p %{buildroot}%{licensedir}/%{name}/ cp -rp LICENSE %{buildroot}%{licensedir}/%{name}/ # run directory mkdir -p %{buildroot}%{_rundir}/mmDbDaemon %pre # group getent group mmdbdaemon >/dev/null || groupadd -r mmdbdaemon # user getent passwd mmdbdaemon >/dev/null || useradd -r -g mmdbdaemon -d "/run/mmDbDaemon" -M -s /sbin/nologin -c "mmDbDaemon daemon" mmdbdaemon exit 0 %post if [ $1 -eq 1 ]; then # initial installation systemctl daemon-reload &>/dev/null || : systemctl preset mmdbdaemon.service &>/dev/null || : fi %preun if [ $1 -eq 0 ]; then # package removal, not upgrade systemctl --no-reload disable mmdbdaemon.service &>/dev/null || : systemctl stop mmdbdaemon.service &>/dev/null || : userdel mmdbdaemon fi %postun systemctl daemon-reload &>/dev/null || : if [ $1 -ge 1 ]; then # package upgrade, not uninstall systemctl try-restart mmdbdaemon.service &>/dev/null || : fi %files # default attributes %defattr(644,root,root,755) # license %license LICENSE # docs %doc CHANGELOG.md README.md composer.json # library %{phpdir}/mmDbDaemon/ # executable %attr(0755,root,root) %{_sbindir}/mmdbdaemon # systemd service %attr(0644,root,root) %{_unitdir}/mmdbdaemon.service # run directory %dir %attr(0755,mmdbdaemon,mmdbdaemon) %{_rundir}/mmDbDaemon %changelog * Mon Sep 18 2023 Maria Ksanthi - 1.1-1 - Initial package