Package: apticron
Version: 1.1.52
Severity: wishlist

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello,

I was asked at work to modify apticron in order to send "no updates"
reports as it shows that :
 1. apticron is working correctly
 2. there is no problem to send email from the "apticronned" server

Indeed, without this "no updates" mail, you can't say if there is no
updates or if there is a mail problem.

I attached a patch with my modifications in apticron itself and in the
postint script (because I inluded some options in the config file).

I think I'm not the only one who could use this feature.

Regards,
Luc

- -- System Information:
Debian Release: wheezy/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable'), (1, 
'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 3.0.0-1-amd64 (SMP w/8 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages apticron depends on:
ii  apt                    0.8.16~exp11
ii  bsd-mailx [mailx]      8.1.2-0.20111106cvs-1
ii  cron                   3.0pl1-120
ii  debconf [debconf-2.0]  1.5.41
ii  dpkg                   1.16.1.2
ii  ucf                    3.0025+nmu2

Versions of packages apticron recommends:
ii  apt-listchanges  <none>
ii  iproute          20120105-1

apticron suggests no packages.

- -- debconf information excluded

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iQIcBAEBAgAGBQJPHoRUAAoJEOqGjhLQJX48eioP/3M8QlgAANh24fk9fhsR96eJ
vNctm1LocdEV2AIBv0BtEBYxvOKcE1z3AGgwsx9w3+btfysvQQRM/J8M8M48KXw+
JPN3O7GdsACkDejZFQlrvkqz2Dpr2gXiwlof0Jib1ZgvOy5fBcEAOQvYlsg3ROp0
LANE4VuNBlHE5HGxIufnVjWL4iZHdm6xZysaU02lzGKZ9zKm0IBogGoUr5WeGvxQ
Ft5VgXFqAIeo5n5rhvMVzW7tUw6Tk9MP0a3XP8AoqPaU32t0sf8tsNP6ldghF++2
1+dxkwDWadlSNUyVe7tqUi2Kwy1kroC8ojsPRfJa9+8ASYx26xiq1pRj5idWNxVc
Ld6OpOgnchMEJPOIdDDbdVic/l3z/CcBI96THA8UN+bGvjakIBA3H3txH9LedqzU
4PynK3/yNsQBLPBTVJHkXfC+Pb/D3Nwnvlv+rfDjNdumYa330bQGWCo575Fx8/W2
yCbP0w0Vl63EvSH7DOBhGrd1G/q62NZv1P9mMDu+c7LIRK4t7F6fdTY0XxCtMzTg
PO1XwAlrgjCgeQRZ9hSlA+8opOLZfS2MtpC119wXiOCbZboik1hITt423gIoEOy+
DcQSID2cDonvyAuAgWHBeJ3mleAGiw0gF6qvn5OlJ59v9ryYImqSvQzMdWSi6flv
/r15cmkXcTvYzyRU0z5k
=cRGK
-----END PGP SIGNATURE-----
diff --git a/apticron b/apticron
index ce1a39c..3ed5d55 100755
--- a/apticron
+++ b/apticron
@@ -151,6 +151,13 @@ else
 	MAILX_SUBJECT="$NUM_PACKAGES $DISTRIB_ID package update(s) for $SYSTEM"
 fi
 
+# Custom no update subject
+if [ -n "$CUSTOM_NO_UPDATES_SUBJECT" ] ; then
+	MAILX_NO_UPDATE_SUBJECT=$(eval "echo \"${CUSTOM_NO_UPDATES_SUBJECT}\"")
+else
+	MAILX_NO_UPDATE_SUBJECT="No updates for $SYSTEM"
+fi
+
 # packages already reported won't be reported again if DIFF_ONLY option is marked
 LAST_RUN_FILE="/var/lib/apticron/last_run"
 if [ "$DIFF_ONLY" = "1" ] && [ -e "$LAST_RUN_FILE" ]; then
@@ -262,6 +269,13 @@ EOF
 
    ) 2>&1 | Mailx -s "$MAILX_SUBJECT" $EMAIL
 
+elif  [ "$NOTIFY_NO_UPDATES" = "1" ] ; then
+  (
+        /bin/cat <<EOF
+No new packages today.
+EOF
+
+   ) 2>&1 | Mailx -s "$MAILX_NO_UPDATE_SUBJECT" $EMAIL
 fi
 
 # updating the last_run file
diff --git a/debian/postinst b/debian/postinst
index da665e9..c960c80 100755
--- a/debian/postinst
+++ b/debian/postinst
@@ -103,6 +103,12 @@ EMAIL="$EMAIL"
 # NOTIFY_NEW="0"
 
 #
+# Set NOTIFY_NO_UPDATES="0" if you don't want to be notified when there is no
+# new versions. Set to 1 could assure you that apticron works well.
+#
+# NOTIFY_NO_UPDATES="0"
+
+#
 # Set CUSTOM_SUBJECT if you want to replace the default subject used in
 # the notification e-mails. This may help filtering/sorting client-side e-mail.
 # If you want to use internal vars please use single quotes here. Ex:
@@ -110,6 +116,14 @@ EMAIL="$EMAIL"
 #
 # CUSTOM_SUBJECT=""
 
+# Set CUSTOM_NO_UPDATES_SUBJECT if you want to replace the default subject used
+# in the no update notification e-mails. This may help filtering/sorting
+# client-side e-mail.
+# If you want to use internal vars please use single quotes here. Ex:
+# \$CUSTOM_NO_UPDATES_SUBJECT='[apticron] \$SYSTEM: no updates'
+#
+# CUSTOM_NO_UPDATES_SUBJECT=""
+
 #
 # Set CUSTOM_FROM if you want to replace the default sender by changing the
 # 'From:' field used in the notification e-mails. Your default sender will

Reply via email to