]> gitweb.fluxo.info Git - trashman.git/commitdiff
Fix: trashman: debian-backports: improved checks
authorSilvio Rhatto <rhatto@riseup.net>
Mon, 29 Dec 2025 19:51:52 +0000 (16:51 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Mon, 29 Dec 2025 19:51:52 +0000 (16:51 -0300)
share/trashman/debian-backports/unix/linux/debian/check

index 14481990767f769f6a8ffb4efc4ac1025e842a2f..c308118866ec8144a1ec6f0e5462a99a70d824ff 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/env sh
 #
-# Check if nodejs is installed system-wide.
+# Check if debian-backports is installed system-wide.
 #
 
 # Parameters
@@ -13,6 +13,13 @@ SHARE="$1"
 # Custom parameters
 BACKPORTS="/etc/apt/sources.list/backports.list"
 
+# Check if a backports definition is defined elsewhere
+if grep "${VERSION_NAME}-backports" /etc/apt/sources.list | grep -q -v '^#'; then
+  exit 0
+elif grep -R "${VERSION_NAME}-backports" /etc/apt/sources.list.d | grep -q -v '^#'; then
+  exit 0
+fi
+
 # Check if installed
 if [ -e "$BACKPORTS" ]; then
   exit 0
@@ -20,7 +27,7 @@ fi
 
 # Check if not installed
 if [ ! -e "$BACKPORTS" ]; then
-  exit !
+  exit 1
 fi
 
 # Will never run, but it's here to remember that we can check if the package is