[Bug 2350109] Review Request: systemd-cron - systemd-generator implementing cronie and anacron

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



https://bugzilla.redhat.com/show_bug.cgi?id=2350109



--- Comment #59 from Pramod V U <pramodvu1502@xxxxxxxxx> ---
I will soon file a bugzilla report for cronie, to support alternatives.

But before that, I have to ask: Is this spec-file right? anything to improve?
Hooks for alternative crontab binaries are added...
BUT unfortunately I can't use alternatives mechanism for cron.target and
crond.service; It is meant to allow *one* file to be provided by multiple
packages and allowing you to choose any one.

BTW, why is alternatives needed? `Conflicts: cronie` is already there, so there
won't be another cron implementation anyway.

Can I `Provides: cron` and `Conflicts: cron` (and request all cron
implementations to do the same), to fix this issue?

The spec-file:
```
# Copyright (C) 2023,2025 наб (nabijaczleweli@xxxxxxxxxxxxxxxxxx)
# Copyright (C) 2023 Alexandre Detiste (alexandre@xxxxxxxxxx)
# Copyright (C) 2025 Pramod (pramodvu1502@xxxxxxxxx) (only for this specfile
though)
# SPDX-License-Identifier: MIT

Name:             systemd-cron
Version:          2.5.1
Release:          %{autorelease}
License:          MIT
Summary:          A systemd generator to provide (ana)cron functionality
URL:              https://github.com/systemd-cron/systemd-cron
Source0:          %{url}/archive/v%{version}.tar.gz
Conflicts:        cronie
Conflicts:        cronie-anacron
Requires:         crontabs
Requires:         systemd
Requires:         libmd
Requires(post):   %{_bindir}/update-alternatives
Requires(postun): %{_bindir}/update-alternatives
#Recommends:       %%{_bindir}/sendmail
BuildRequires:    g++
BuildRequires:    libmd-devel
BuildRequires:    systemd-rpm-macros

%description
A systemd generator implementing (ana)cron.
It uses systemd.timer and systemd.service under the hood.

%pre
# Prevent execution of cron.reboot scripts on installation
touch %{_rundir}/crond.reboot

%preun
%systemd_preun cron.target

%post
%systemd_post cron.target

update-alternatives --install %{_bindir}/crontab %{name}
%{_bindir}/crontab.%{name}

# To apply the /var/spool/cron and crontab group to the system on installation
%{_bindir}/systemctl reload-or-restart systemd-sysusers.service
systemd-tmpfiles-setup.service

%postun
%systemd_postun_with_restart cron.target

if [ $1 -eq 0 ] ; then
  update-alternatives --remove %{name} %{_bindir}/crontab.%{name}
fi

%prep
%setup -q

%build
# Don't use the %%configure macro as this is not an autotool script
./configure \
  --with-version="%{version}" \
  --prefix="%{_prefix}" \
  --bindir="%{_bindir}" \
  --datadir="%{_datadir}" \
  --libdir="%{_libdir}" \
  --libexecdir="%{_libexecdir}" \
  --mandir="%{_mandir}" \
  --docdir="%{_docdir}" \
  --unitdir="%{_unitdir}" \
  --generatordir="%{_systemdgeneratordir}" \
  --sysusersdir="%{_sysusersdir}" \
  --enable-runparts=no \
  --enable-minutely=yes \
  --enable-quarterly=yes \
  --enable-semi_annually=yes \
  --enable-boot=no

# Compile
%make_build

%install
%make_install

# Preparing /var/spool/cron using tmpfiles.d
mkdir -p "${RPM_BUILD_ROOT}%{_tmpfilesdir}"
printf "%s\n" "d %{_localstatedir}/spool/cron 1730 root crontab" >>
"${RPM_BUILD_ROOT}%{_tmpfilesdir}/systemd-cron.conf"

# The "crontab" group for /var/spool/cron
printf "%s\n" "g crontab - -" >>
"${RPM_BUILD_ROOT}%{_sysusersdir}/systemd-cron.conf"

# systemd preset as required by fedora
mkdir -p "${RPM_BUILD_ROOT}%{_presetdir}"
printf "%s\n" "enable cron.target" >
"${RPM_BUILD_ROOT}%{_presetdir}/50-systemd-cron.preset"

# Conflict with other cron services to avoid 2 cron implementations from
running
OtherCronServices="crond.service"
mkdir -p "${RPM_BUILD_ROOT}%{_unitdir}/cron.target.d"
printf "%s\n%s\n" "[Unit]" "Conflicts=${OtherCronServices}" >
"${RPM_BUILD_ROOT}%{_unitdir}/cron.target.d/crond-conflict.conf"

# Alternative %%{_bindir}/crontab
mv "${RPM_BUILD_ROOT}%{_bindir}/crontab"
"${RPM_BUILD_ROOT}%{_bindir}/crontab.%{name}"
touch "${RPM_BUILD_ROOT}%{_bindir}/crontab"

# A required directory
mkdir -p "${RPM_BUILD_ROOT}%{_sysconfdir}/cron.d"

%files
%license LICENSE
%doc README.md CHANGELOG

%dir %{_sysconfdir}/cron.d
%dir %{_libexecdir}/systemd-cron
%ghost %{_bindir}/crontab

%{_bindir}/crontab.%{name}
%{_libexecdir}/systemd-cron/mail_for_job
%{_libexecdir}/systemd-cron/boot_delay
%{_libexecdir}/systemd-cron/remove_stale_stamps
%attr(2755, root, crontab) %{_libexecdir}/systemd-cron/crontab_setgid
%{_systemdgeneratordir}/systemd-crontab-generator

%{_presetdir}/50-systemd-cron.preset
%{_unitdir}/cron.target
%{_unitdir}/cron-update.path
%{_unitdir}/cron-update.service
%{_unitdir}/cron-mail@.service
%{_unitdir}/systemd-cron-cleaner.service
%{_unitdir}/systemd-cron-cleaner.timer

%{_sysusersdir}/systemd-cron.conf
%{_tmpfilesdir}/systemd-cron.conf

%{_mandir}/man1/crontab.*
%{_mandir}/man5/crontab.*
%{_mandir}/man5/anacrontab.*
%{_mandir}/man7/systemd.cron.*
%{_mandir}/man8/systemd-crontab-generator.*

%changelog
%autochangelog
```


-- 
You are receiving this mail because:
You are on the CC list for the bug.
You are always notified about changes to this product and component
https://bugzilla.redhat.com/show_bug.cgi?id=2350109

Report this comment as SPAM: https://bugzilla.redhat.com/enter_bug.cgi?product=Bugzilla&format=report-spam&short_desc=Report%20of%20Bug%202350109%23c59

-- 
_______________________________________________
package-review mailing list -- package-review@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to package-review-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/package-review@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue




[Index of Archives]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite Conditions]     [KDE Users]

  Powered by Linux