From 5b81769b799036aecfd869204bf2b1ef2f072dd9 Mon Sep 17 00:00:00 2001 From: Marek Blaha Date: Tue, 6 Feb 2024 12:10:58 +0100 Subject: [PATCH] automatic: Use only one systemd timer I found multiple timers misleading. Let's try to return back to one timer that respects config file settings without using command line arguments to override some options. In case the users need it we can add convenience timers (notifyonly / download / install) later. --- .../systemd/system/dnf-automatic-download.service | 11 ----------- .../lib/systemd/system/dnf-automatic-download.timer | 12 ------------ .../systemd/system/dnf-automatic-notifyonly.service | 11 ----------- .../systemd/system/dnf-automatic-notifyonly.timer | 12 ------------ .../usr/lib/systemd/system/dnf-automatic.service | 12 +----------- .../usr/lib/systemd/system/dnf-automatic.timer | 13 +------------ ...matic-install.service => dnf5-automatic.service} | 4 ++-- ...automatic-install.timer => dnf5-automatic.timer} | 2 +- dnf5.spec | 8 ++------ 9 files changed, 7 insertions(+), 78 deletions(-) delete mode 100644 dnf5-plugins/automatic_plugin/config/usr/lib/systemd/system/dnf-automatic-download.service delete mode 100644 dnf5-plugins/automatic_plugin/config/usr/lib/systemd/system/dnf-automatic-download.timer delete mode 100644 dnf5-plugins/automatic_plugin/config/usr/lib/systemd/system/dnf-automatic-notifyonly.service delete mode 100644 dnf5-plugins/automatic_plugin/config/usr/lib/systemd/system/dnf-automatic-notifyonly.timer mode change 100644 => 120000 dnf5-plugins/automatic_plugin/config/usr/lib/systemd/system/dnf-automatic.service mode change 100644 => 120000 dnf5-plugins/automatic_plugin/config/usr/lib/systemd/system/dnf-automatic.timer rename dnf5-plugins/automatic_plugin/config/usr/lib/systemd/system/{dnf-automatic-install.service => dnf5-automatic.service} (54%) rename dnf5-plugins/automatic_plugin/config/usr/lib/systemd/system/{dnf-automatic-install.timer => dnf5-automatic.timer} (81%) diff --git a/dnf5-plugins/automatic_plugin/config/usr/lib/systemd/system/dnf-automatic-download.service b/dnf5-plugins/automatic_plugin/config/usr/lib/systemd/system/dnf-automatic-download.service deleted file mode 100644 index 5be2c7dc9..000000000 --- a/dnf5-plugins/automatic_plugin/config/usr/lib/systemd/system/dnf-automatic-download.service +++ /dev/null @@ -1,11 +0,0 @@ -[Unit] -Description=dnf automatic download updates -ConditionPathExists=!/run/ostree-booted -After=network-online.target - -[Service] -Type=oneshot -Nice=19 -IOSchedulingClass=2 -IOSchedulingPriority=7 -ExecStart=/usr/bin/dnf5 automatic /etc/dnf/automatic.conf --timer --downloadupdates --no-installupdates diff --git a/dnf5-plugins/automatic_plugin/config/usr/lib/systemd/system/dnf-automatic-download.timer b/dnf5-plugins/automatic_plugin/config/usr/lib/systemd/system/dnf-automatic-download.timer deleted file mode 100644 index fca405809..000000000 --- a/dnf5-plugins/automatic_plugin/config/usr/lib/systemd/system/dnf-automatic-download.timer +++ /dev/null @@ -1,12 +0,0 @@ -[Unit] -Description=dnf-automatic-download timer -ConditionPathExists=!/run/ostree-booted -Wants=network-online.target - -[Timer] -OnCalendar=*-*-* 6:00 -RandomizedDelaySec=60m -Persistent=true - -[Install] -WantedBy=timers.target diff --git a/dnf5-plugins/automatic_plugin/config/usr/lib/systemd/system/dnf-automatic-notifyonly.service b/dnf5-plugins/automatic_plugin/config/usr/lib/systemd/system/dnf-automatic-notifyonly.service deleted file mode 100644 index 78c2c2beb..000000000 --- a/dnf5-plugins/automatic_plugin/config/usr/lib/systemd/system/dnf-automatic-notifyonly.service +++ /dev/null @@ -1,11 +0,0 @@ -[Unit] -Description=dnf automatic notification of updates -ConditionPathExists=!/run/ostree-booted -After=network-online.target - -[Service] -Type=oneshot -Nice=19 -IOSchedulingClass=2 -IOSchedulingPriority=7 -ExecStart=/usr/bin/dnf5 automatic /etc/dnf/automatic.conf --timer --no-installupdates --no-downloadupdates diff --git a/dnf5-plugins/automatic_plugin/config/usr/lib/systemd/system/dnf-automatic-notifyonly.timer b/dnf5-plugins/automatic_plugin/config/usr/lib/systemd/system/dnf-automatic-notifyonly.timer deleted file mode 100644 index 398386a8f..000000000 --- a/dnf5-plugins/automatic_plugin/config/usr/lib/systemd/system/dnf-automatic-notifyonly.timer +++ /dev/null @@ -1,12 +0,0 @@ -[Unit] -Description=dnf-automatic-notifyonly timer -ConditionPathExists=!/run/ostree-booted -Wants=network-online.target - -[Timer] -OnCalendar=*-*-* 6:00 -RandomizedDelaySec=60m -Persistent=true - -[Install] -WantedBy=timers.target diff --git a/dnf5-plugins/automatic_plugin/config/usr/lib/systemd/system/dnf-automatic.service b/dnf5-plugins/automatic_plugin/config/usr/lib/systemd/system/dnf-automatic.service deleted file mode 100644 index 2e92aadf0..000000000 --- a/dnf5-plugins/automatic_plugin/config/usr/lib/systemd/system/dnf-automatic.service +++ /dev/null @@ -1,11 +0,0 @@ -[Unit] -Description=dnf automatic -ConditionPathExists=!/run/ostree-booted -After=network-online.target - -[Service] -Type=oneshot -Nice=19 -IOSchedulingClass=2 -IOSchedulingPriority=7 -ExecStart=/usr/bin/dnf5 automatic /etc/dnf/automatic.conf --timer diff --git a/dnf5-plugins/automatic_plugin/config/usr/lib/systemd/system/dnf-automatic.service b/dnf5-plugins/automatic_plugin/config/usr/lib/systemd/system/dnf-automatic.service new file mode 120000 index 000000000..f5779c9ab --- /dev/null +++ b/dnf5-plugins/automatic_plugin/config/usr/lib/systemd/system/dnf-automatic.service @@ -0,0 +1 @@ +dnf5-automatic.service \ No newline at end of file diff --git a/dnf5-plugins/automatic_plugin/config/usr/lib/systemd/system/dnf-automatic.timer b/dnf5-plugins/automatic_plugin/config/usr/lib/systemd/system/dnf-automatic.timer deleted file mode 100644 index 4930fdf4d..000000000 --- a/dnf5-plugins/automatic_plugin/config/usr/lib/systemd/system/dnf-automatic.timer +++ /dev/null @@ -1,12 +0,0 @@ -[Unit] -Description=dnf-automatic timer -ConditionPathExists=!/run/ostree-booted -Wants=network-online.target - -[Timer] -OnCalendar=*-*-* 6:00 -RandomizedDelaySec=60m -Persistent=true - -[Install] -WantedBy=timers.target diff --git a/dnf5-plugins/automatic_plugin/config/usr/lib/systemd/system/dnf-automatic.timer b/dnf5-plugins/automatic_plugin/config/usr/lib/systemd/system/dnf-automatic.timer new file mode 120000 index 000000000..b9332dc02 --- /dev/null +++ b/dnf5-plugins/automatic_plugin/config/usr/lib/systemd/system/dnf-automatic.timer @@ -0,0 +1 @@ +dnf5-automatic.timer \ No newline at end of file diff --git a/dnf5-plugins/automatic_plugin/config/usr/lib/systemd/system/dnf-automatic-install.service b/dnf5-plugins/automatic_plugin/config/usr/lib/systemd/system/dnf5-automatic.service similarity index 54% rename from dnf5-plugins/automatic_plugin/config/usr/lib/systemd/system/dnf-automatic-install.service rename to dnf5-plugins/automatic_plugin/config/usr/lib/systemd/system/dnf5-automatic.service index ba7a9c569..19332cd9d 100644 --- a/dnf5-plugins/automatic_plugin/config/usr/lib/systemd/system/dnf-automatic-install.service +++ b/dnf5-plugins/automatic_plugin/config/usr/lib/systemd/system/dnf5-automatic.service @@ -1,5 +1,5 @@ [Unit] -Description=dnf automatic install updates +Description=dnf5 automatic ConditionPathExists=!/run/ostree-booted After=network-online.target @@ -8,4 +8,4 @@ Type=oneshot Nice=19 IOSchedulingClass=2 IOSchedulingPriority=7 -ExecStart=/usr/bin/dnf5 automatic /etc/dnf/automatic.conf --timer --installupdates +ExecStart=/usr/bin/dnf5 automatic --timer diff --git a/dnf5-plugins/automatic_plugin/config/usr/lib/systemd/system/dnf-automatic-install.timer b/dnf5-plugins/automatic_plugin/config/usr/lib/systemd/system/dnf5-automatic.timer similarity index 81% rename from dnf5-plugins/automatic_plugin/config/usr/lib/systemd/system/dnf-automatic-install.timer rename to dnf5-plugins/automatic_plugin/config/usr/lib/systemd/system/dnf5-automatic.timer index 394153a81..4930fdf4d 100644 --- a/dnf5-plugins/automatic_plugin/config/usr/lib/systemd/system/dnf-automatic-install.timer +++ b/dnf5-plugins/automatic_plugin/config/usr/lib/systemd/system/dnf5-automatic.timer @@ -1,5 +1,5 @@ [Unit] -Description=dnf-automatic-install timer +Description=dnf-automatic timer ConditionPathExists=!/run/ostree-booted Wants=network-online.target diff --git a/dnf5.spec b/dnf5.spec index 680d61497..7a9a7cc10 100644 --- a/dnf5.spec +++ b/dnf5.spec @@ -705,12 +705,8 @@ automatically and regularly from systemd timers, cron jobs or similar. %files plugin-automatic -f dnf5-plugin-automatic.lang %ghost %{_sysconfdir}/motd.d/dnf5-automatic %{_libdir}/dnf5/plugins/automatic_cmd_plugin.so -%{_unitdir}/dnf-automatic-download.service -%{_unitdir}/dnf-automatic-download.timer -%{_unitdir}/dnf-automatic-install.service -%{_unitdir}/dnf-automatic-install.timer -%{_unitdir}/dnf-automatic-notifyonly.service -%{_unitdir}/dnf-automatic-notifyonly.timer +%{_unitdir}/dnf5-automatic.service +%{_unitdir}/dnf5-automatic.timer %{_unitdir}/dnf-automatic.service %{_unitdir}/dnf-automatic.timer %if %{with dnf5_obsoletes_dnf}