Merge ~renanrodrigo/update-notifier:file-based-motd-disable-noble into update-notifier:master

Proposed by Renan Rodrigo
Status: Merged
Merged at revision: 43f963f3e1140bda29d4fb17124541a01ca0f14f
Proposed branch: ~renanrodrigo/update-notifier:file-based-motd-disable-noble
Merge into: update-notifier:master
Diff against target: 63 lines (+18/-17)
2 files modified
data/update-motd-updates-available (+12/-17)
debian/changelog (+6/-0)
Reviewer Review Type Date Requested Status
Nick Rosbrook Approve
Review via email: mp+461703@code.launchpad.net

Description of the change

update-motd: use a marker file to hide esm updates information

Instead of a flag passed to the script, check for the existence of a marker file. This implements the same control level for any caller of the update-motd script.

To post a comment you must log in.
Revision history for this message
Renan Rodrigo (renanrodrigo) wrote :

The marker file could live in /var/lib/update-notifier/ instead of /var/lib/ubuntu-advantage/. In my initial idea, we would also make use of this file in the Pro Client. Now I see there is no need to (as I baked it into the udpate-motd-updates-available script itself...). Please let me know if you think it's better to check for a file in the update-notifier folder instead.

Revision history for this message
Nick Rosbrook (enr0n) wrote :

I left a couple comments inline.

review: Needs Fixing
Revision history for this message
Renan Rodrigo (renanrodrigo) :
Revision history for this message
Renan Rodrigo (renanrodrigo) wrote :

Changes made. Will soon update the other branches too.

Revision history for this message
Nick Rosbrook (enr0n) wrote :

LGTM. Thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/data/update-motd-updates-available b/data/update-motd-updates-available
2index 8148654..5f3e9b5 100755
3--- a/data/update-motd-updates-available
4+++ b/data/update-motd-updates-available
5@@ -2,25 +2,14 @@
6 #
7 # helper for update-motd
8
9-NEED_UPDATE_CHECK="no"
10 NO_ESM_MESSAGES=""
11
12-while [[ $# -gt 0 ]]; do
13- case $1 in
14- # poor mans force
15- --force)
16- NEED_UPDATE_CHECK="yes"
17- shift
18- ;;
19- --no-esm-messages)
20- NO_ESM_MESSAGES="--no-esm-messages"
21- shift
22- ;;
23- *)
24- shift
25- ;;
26- esac
27-done
28+# poor mans force
29+if [ "$1" = "--force" ]; then
30+ NEED_UPDATE_CHECK=yes
31+else
32+ NEED_UPDATE_CHECK=no
33+fi
34
35 # check time when we did the last update check
36 stamp="/var/lib/update-notifier/updates-available"
37@@ -59,6 +48,12 @@ tmpfile=""
38 trap cleanup EXIT
39 tmpfile=$(mktemp -p $(dirname "$stamp"))
40
41+# should we hide esm-related information in the output
42+no_esm_file="/var/lib/update-notifier/hide-esm-in-motd"
43+if [ -e "$no_esm_file" ]; then
44+ NO_ESM_MESSAGES="--no-esm-messages"
45+fi
46+
47 # output something for update-motd
48 if [ "$NEED_UPDATE_CHECK" = "yes" ]; then
49 {
50diff --git a/debian/changelog b/debian/changelog
51index 0e8e1f6..c8c71e9 100644
52--- a/debian/changelog
53+++ b/debian/changelog
54@@ -1,3 +1,9 @@
55+update-notifier (3.192.68) noble; urgency=medium
56+
57+ * update-motd: use a marker file to hide ESM messages (LP: #2015420)
58+
59+ -- Renan Rodrigo Barbosa <renanrodrigo@canonical.com> Mon, 04 Mar 2024 07:18:35 -0300
60+
61 update-notifier (3.192.67) noble; urgency=medium
62
63 * apt-check: add option to hide ESM messages from the human readable output.

Subscribers

People subscribed via source and target branches