cron: Quietly abort if the package was removed

Message ID 20261026200122.551196-1-valter.jansons@gmail.com
State New
Headers
Series cron: Quietly abort if the package was removed |

Commit Message

Valters Jansons 26 Oct 2026, 8:01 p.m. UTC
Previously, Debian was not installing the cron job. Now packaging it up
and alerts about the risk of `/usr/bin/location` not being available.

The scenario for this is that `/etc` contains configuration files, so
running `apt remove location` would leave the cron job hanging. If it is
a standard system with systemd, then the cron job expects systemd to
manage everything. However, if the system doesn't have systemd, then the
cron job will try to run a non-existant binary every day. This should be
gracefully handled.
---
 src/cron/location-update.in | 5 +++++
 1 file changed, 5 insertions(+)
  

Patch

diff --git a/src/cron/location-update.in b/src/cron/location-update.in
index 6b1ebdc..8b7d23e 100644
--- a/src/cron/location-update.in
+++ b/src/cron/location-update.in
@@ -22,5 +22,10 @@  if [ -d /run/systemd/system ]; then
 	exit 0
 fi
 
+# Quietly abort if the package has been removed but not purged
+if [ ! -x @bindir@/location ]; then
+	exit 0
+fi
+
 # Call the location database updater
 exec @bindir@/location update