Merge ~ahasenack/ubuntu/+source/base-files:focal-motd-news-config-split into ubuntu/+source/base-files:ubuntu/focal-devel

Proposed by Andreas Hasenack
Status: Merged
Approved by: Andreas Hasenack
Approved revision: 6f3fbdb8ed9b84ed92aee611b03ae0bb96f4b7c4
Merged at revision: 6f3fbdb8ed9b84ed92aee611b03ae0bb96f4b7c4
Proposed branch: ~ahasenack/ubuntu/+source/base-files:focal-motd-news-config-split
Merge into: ubuntu/+source/base-files:ubuntu/focal-devel
Diff against target: 252 lines (+137/-11)
8 files modified
debian/base-files.maintscript (+1/-0)
debian/changelog (+33/-0)
debian/control (+14/-1)
debian/motd-news-config.install (+1/-0)
debian/motd-news-config.postinst (+55/-0)
debian/postinst.in (+13/-0)
debian/rules (+0/-1)
motd/50-motd-news (+20/-9)
Reviewer Review Type Date Requested Status
Christian Ehrhardt  (community) Approve
Canonical Server Pending
Review via email: mp+388848@code.launchpad.net

Description of the change

Same as https://code.launchpad.net/~ahasenack/ubuntu/+source/base-files/+git/base-files/+merge/388835, but for focal, with the following extra details:

- backport the switch to wget, and follow-up fixes that landed in groovy
- versions for breaks/replaces are the focal ones:

ubuntu-server 1.450.2:
  Depends: motd-news-config

base-files 11ubuntu5.2:
  Breaks: ubuntu-server (<< 1.450.2)
  rm_conffile /etc/default/motd-news 11ubuntu5.2~ base-files

motd-news-config 11ubuntu5.2:
  Breaks/Replaces: base-files (<< 11ubuntu5.2)

PPA: https://launchpad.net/~ahasenack/+archive/ubuntu/zomg-5/

Linked bugs have the SRU template filled out.

To post a comment you must log in.
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

This is ready for review

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

I just realized that we will hit the base-files rm_conffile again and again - as the one in groovy has the groovy version listed. But that should be no problem - it will find the file already removed and be ok with it.

I re-read the changes and agree that they match what we got into Bionic and they LGTM.
+1

review: Approve
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Now that groovy has these packages, let me try a release upgrade just to be sure

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

I pushed a change I found out while testing the groovy package: motd-news-config has to have priority set to optional, otherwise it will inherit base-files' which is "required" and do-release-upgrade will install it regardless of dependencies.

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

So many details, I'm glad for your thorough testing on this.
The additional change LGTM as well - re-approve.

I guess this needs to be added in Groovy as well then?

review: Approve
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

It's uploaded to groovy already

On Mon, Aug 17, 2020, 03:34 Christian Ehrhardt  <
<email address hidden>> wrote:

> Review: Approve
>
> So many details, I'm glad for your thorough testing on this.
> The additional change LGTM as well - re-approve.
>
> I guess this needs to be added in Groovy as well then?
> --
>
> https://code.launchpad.net/~ahasenack/ubuntu/+source/base-files/+git/base-files/+merge/388848
> You are the owner of
> ~ahasenack/ubuntu/+source/base-files:focal-motd-news-config-split.
>
> Launchpad-Message-Rationale: Owner
> Launchpad-Message-For: ahasenack
> Launchpad-Notification-Type: code-review
> Launchpad-Branch:
> ~ahasenack/ubuntu/+source/base-files/+git/base-files:focal-motd-news-config-split
>

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

I had to rebase to fix the commit message of commit 93ca11572a83a9c6efc8fd8dcfafb21cb4bbd207 which was mentioning the wrong ubuntu-server version to break on (the contents of the commit were correct, it was just the message):

commit 93ca11572a83a9c6efc8fd8dcfafb21cb4bbd207
Author: Andreas Hasenack <email address hidden>
Date: Tue Jul 28 15:36:04 2020 -0300

        - d/control: break on ubuntu-server << 1.453 to force an upgrade if
          it is installed, which will pull motd-news-config and the conffile
          back in

Became:

commit aea9fbc7ccacfe5e3e6cffd518a1b7fc98421d7f
Author: Andreas Hasenack <email address hidden>
Date: Tue Jul 28 15:36:04 2020 -0300

        - d/control: break on ubuntu-server << 1.450.2 to force an upgrade if
          it is installed, which will pull motd-news-config and the conffile
          back in

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Tagging and uploading 6f3fbdb8ed9b84ed92aee611b03ae0bb96f4b7c4

$ git push pkg upload/11ubuntu5.2
Enumerating objects: 50, done.
Counting objects: 100% (50/50), done.
Delta compression using up to 4 threads
Compressing objects: 100% (31/31), done.
Writing objects: 100% (42/42), 6.75 KiB | 3.38 MiB/s, done.
Total 42 (delta 28), reused 12 (delta 10)
remote: Checking connectivity: 42, done.
To ssh://git.launchpad.net/~usd-import-team/ubuntu/+source/base-files
 * [new tag] upload/11ubuntu5.2 -> upload/11ubuntu5.2

$ dput ubuntu ../base-files_11ubuntu5.2_source.changes
Checking signature on .changes
gpg: ../base-files_11ubuntu5.2_source.changes: Valid signature from AC983EB5BF6BCBA9
Checking signature on .dsc
gpg: ../base-files_11ubuntu5.2.dsc: Valid signature from AC983EB5BF6BCBA9
Uploading to ubuntu (via ftp to upload.ubuntu.com):
  Uploading base-files_11ubuntu5.2.dsc: done.
  Uploading base-files_11ubuntu5.2.tar.xz: done.
  Uploading base-files_11ubuntu5.2_source.buildinfo: done.
  Uploading base-files_11ubuntu5.2_source.changes: done.
Successfully uploaded packages.

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Also uploading https://code.launchpad.net/~ahasenack/ubuntu/+source/ubuntu-meta/+git/ubuntu-meta/+ref/focal-ubuntu-server-motd-news

The seed change will also happen, but since it involves a new package, the update script from ubuntu-meta won't pick it up, so I have to add the dep manually.

Tagging and uploading 53462aae9d19ec2e1d19f233d02514c27e09af1d of that branch:
$ git push pkg upload/1.450.2
Enumerating objects: 13, done.
Counting objects: 100% (13/13), done.
Delta compression using up to 4 threads
Compressing objects: 100% (9/9), done.
Writing objects: 100% (9/9), 1.19 KiB | 41.00 KiB/s, done.
Total 9 (delta 5), reused 0 (delta 0)
remote: Checking connectivity: 9, done.
To ssh://git.launchpad.net/~usd-import-team/ubuntu/+source/ubuntu-meta
 * [new tag] upload/1.450.2 -> upload/1.450.2

$ dput ubuntu ../ubuntu-meta_1.450.2_source.changes
Checking signature on .changes
gpg: ../ubuntu-meta_1.450.2_source.changes: Valid signature from AC983EB5BF6BCBA9
Checking signature on .dsc
gpg: ../ubuntu-meta_1.450.2.dsc: Valid signature from AC983EB5BF6BCBA9
Uploading to ubuntu (via ftp to upload.ubuntu.com):
  Uploading ubuntu-meta_1.450.2.dsc: done.
  Uploading ubuntu-meta_1.450.2.tar.xz: done.
  Uploading ubuntu-meta_1.450.2_source.buildinfo: done.
  Uploading ubuntu-meta_1.450.2_source.changes: done.
Successfully uploaded packages.

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Seeds changed for focal in 113992ddf60c5573fc23ca173a6c4ca44058a943 after ok from steve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/debian/base-files.maintscript b/debian/base-files.maintscript
0new file mode 1006440new file mode 100644
index 0000000..a0cdd9a
--- /dev/null
+++ b/debian/base-files.maintscript
@@ -0,0 +1 @@
1rm_conffile /etc/default/motd-news 11ubuntu5.2~ base-files
diff --git a/debian/changelog b/debian/changelog
index 601311f..40b6cd2 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,36 @@
1base-files (11ubuntu5.2) focal; urgency=medium
2
3 [ Andreas Hasenack ]
4 * motd/50-motd-news: don't include uptime in the user-agent string
5 (LP: #1886572)
6 * Move the /etc/default/motd-news conffile to the motd-news-config
7 package (LP: #1888575):
8 - d/base-files.maintscript: remove /etc/default/motd-news config file
9 on upgrade
10 - d/control: break on ubuntu-server << 1.450.2 to force an upgrade if
11 it is installed, which will pull motd-news-config and the conffile
12 back in
13 - d/motd-news-config.postinst:
14 + handle the upgrade case where the motd-news config file was
15 changed while it belonged to base-files
16 + disable motd-news if the config file was removed by hand before
17 the upgrade
18 - d/postinst.in: signal the motd-news-config package if the
19 motd-news config file was removed manually before the upgrade
20 - d/control: new motd-news-config package, carrying the
21 configuration file for the /etc/update-motd.d/50-motd-news script.
22 - d/rules, d/motd-news-config.install: /e/d/motd-news is in the
23 motd-news-config package now
24
25 [ Steve Langasek ]
26 * motd/50-motd-news: use wget instead of curl, since wget is standard but
27 curl is optional (LP: #1888572):
28 - This changes the timeout behavior slightly because wget does not have
29 an exact equivalent to curl's --max-time argument, we are using
30 --timeout instead.
31
32 -- Andreas Hasenack <andreas@canonical.com> Mon, 17 Aug 2020 10:31:58 -0300
33
1base-files (11ubuntu5.1) focal; urgency=medium34base-files (11ubuntu5.1) focal; urgency=medium
235
3 * /etc/issue, /etc/issue.net, /etc/lsb-release, /etc/os-release: Bump36 * /etc/issue, /etc/issue.net, /etc/lsb-release, /etc/os-release: Bump
diff --git a/debian/control b/debian/control
index c90938a..d172bc1 100644
--- a/debian/control
+++ b/debian/control
@@ -14,7 +14,8 @@ Depends: ${misc:Depends}, ${shlibs:Depends}, libcrypt1 (>= 1:4.4.10-10ubuntu3)
14Essential: yes14Essential: yes
15Priority: required15Priority: required
16Replaces: base, miscutils, dpkg (<= 1.15.0)16Replaces: base, miscutils, dpkg (<= 1.15.0)
17Breaks: debian-security-support (<< 2019.04.25), initscripts (<< 2.88dsf-13.3), sendfile (<< 2.1b.20080616-5.2~)17Breaks: debian-security-support (<< 2019.04.25), initscripts (<< 2.88dsf-13.3), sendfile (<< 2.1b.20080616-5.2~),
18 ubuntu-server (<< 1.450.2)
18Multi-Arch: foreign19Multi-Arch: foreign
19Description: Debian base system miscellaneous files20Description: Debian base system miscellaneous files
20 This package contains the basic filesystem hierarchy of a Debian system, and21 This package contains the basic filesystem hierarchy of a Debian system, and
@@ -28,3 +29,15 @@ Section: debian-installer
28Architecture: all29Architecture: all
29Priority: extra30Priority: extra
30Description: LSB release information31Description: LSB release information
32
33Package: motd-news-config
34Architecture: all
35Priority: optional
36Breaks: base-files (<< 11ubuntu5.2)
37Replaces: base-files (<< 11ubuntu5.2)
38Depends: ${shlibs:Depends}, ${misc:Depends}
39Description: Configuration for motd-news shipped in base-files
40 This package contains the configuration read by the motd-news script
41 shipped in the base-files package.
42 .
43 Install this package if you want motd-news to be enabled.
diff --git a/debian/motd-news-config.install b/debian/motd-news-config.install
31new file mode 10064444new file mode 100644
index 0000000..876b3b8
--- /dev/null
+++ b/debian/motd-news-config.install
@@ -0,0 +1 @@
1debian/motd-news etc/default
diff --git a/debian/motd-news-config.postinst b/debian/motd-news-config.postinst
0new file mode 1006442new file mode 100644
index 0000000..a73427f
--- /dev/null
+++ b/debian/motd-news-config.postinst
@@ -0,0 +1,55 @@
1#!/bin/sh
2# postinst script for motd-news-config
3#
4# see: dh_installdeb(1)
5
6set -e
7
8# summary of how this script can be called:
9# * <postinst> `configure' <most-recently-configured-version>
10# * <old-postinst> `abort-upgrade' <new version>
11# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
12# <new-version>
13# * <postinst> `abort-remove'
14# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
15# <failed-install-package> <version> `removing'
16# <conflicting-package> <version>
17# for details, see https://www.debian.org/doc/debian-policy/ or
18# the debian-policy package
19
20
21case "$1" in
22 configure)
23 # only run on new installs, $2 will be empty then
24 if [ -z "$2" ]; then
25 # /e/d/motd-news was moved from pkg:base-files to this package.
26 # base-files runs rm_conffile which, if it was modified, leaves
27 # /e/d/motd-news.dpkg-bak around. We want to preserve that *changed*
28 # config file in this migration, and this is something that
29 # rm_conffile is not handling. In that case, let's put the backup
30 # file back in place
31 if [ -e /etc/default/motd-news.dpkg-bak ]; then
32 mv /etc/default/motd-news.dpkg-bak /etc/default/motd-news
33 fi
34 if [ -e /etc/default/motd-news.wasremoved ] && [ -e /etc/default/motd-news ]; then
35 sed -i -e 's/^ENABLED=1/# Changed by motd-news-config.postinst:\n# config file was manually removed - disable the service\nENABLED=0/' /etc/default/motd-news
36 rm /etc/default/motd-news.wasremoved
37 fi
38 fi
39 ;;
40
41 abort-upgrade|abort-remove|abort-deconfigure)
42 ;;
43
44 *)
45 echo "postinst called with unknown argument \`$1'" >&2
46 exit 1
47 ;;
48esac
49
50# dh_installdeb will replace this with shell code automatically
51# generated by other debhelper scripts.
52
53#DEBHELPER#
54
55exit 0
diff --git a/debian/postinst.in b/debian/postinst.in
index 69435e3..c347a62 100644
--- a/debian/postinst.in
+++ b/debian/postinst.in
@@ -125,4 +125,17 @@ if [ "$1" = "configure" ] && [ "$2" != "" ]; then
125 fi125 fi
126fi126fi
127127
128# special case of having /etc/default/motd-news removed by hand
129# signal the motd-news-config package that this happened, so that
130# it does not put back the file with default contents which would
131# re-enable motd-news
132motd_news_config="/etc/default/motd-news"
133if [ ! -e ${motd_news_config} ]; then
134 if [ ! -e ${motd_news_config}.dpkg-remove ]; then
135 if [ ! -e ${motd_news_config}.dpkg-backup ]; then
136 touch ${motd_news_config}.wasremoved
137 fi
138 fi
139fi
140
128#DEBHELPER#141#DEBHELPER#
diff --git a/debian/rules b/debian/rules
index 9f0f164..4340bf7 100755
--- a/debian/rules
+++ b/debian/rules
@@ -25,7 +25,6 @@ override_dh_auto_build: locale-check
25override_dh_auto_install:25override_dh_auto_install:
26 install -p -m 644 etc/* $(DESTDIR)/etc26 install -p -m 644 etc/* $(DESTDIR)/etc
27 install -p -m 755 motd/* $(DESTDIR)/etc/update-motd.d27 install -p -m 755 motd/* $(DESTDIR)/etc/update-motd.d
28 install -p -m 644 debian/motd-news $(DESTDIR)/etc/default
29 install -p -m 644 debian/motd-news.service $(DESTDIR)/lib/systemd/system/28 install -p -m 644 debian/motd-news.service $(DESTDIR)/lib/systemd/system/
30 install -p -m 644 debian/motd-news.timer $(DESTDIR)/lib/systemd/system/29 install -p -m 644 debian/motd-news.timer $(DESTDIR)/lib/systemd/system/
31 install -p -m 644 licenses/* $(DESTDIR)/usr/share/common-licenses30 install -p -m 644 licenses/* $(DESTDIR)/usr/share/common-licenses
diff --git a/motd/50-motd-news b/motd/50-motd-news
index 912e768..4b0b56a 100644
--- a/motd/50-motd-news
+++ b/motd/50-motd-news
@@ -1,10 +1,11 @@
1#!/bin/sh1#!/bin/sh
2#2#
3# 50-motd-news - print the live news from the Ubuntu wire3# 50-motd-news - print the live news from the Ubuntu wire
4# Copyright (C) 2016-2017 Canonical Ltd.4# Copyright (C) 2016-2020 Canonical Ltd.
5# Copyright (C) 2016-2017 Dustin Kirkland5# Copyright (C) 2016-2017 Dustin Kirkland
6#6#
7# Authors: Dustin Kirkland <kirkland@canonical.com>7# Authors: Dustin Kirkland <kirkland@canonical.com>
8# Steve Langasek <steve.langasek@canonical.com>
8#9#
9# This program is free software; you can redistribute it and/or modify10# This program is free software; you can redistribute it and/or modify
10# it under the terms of the GNU General Public License as published by11# it under the terms of the GNU General Public License as published by
@@ -64,6 +65,9 @@ fi
64# If we've made it here, we've been given the --force argument,65# If we've made it here, we've been given the --force argument,
65# probably from the systemd motd-news.service. Let's update...66# probably from the systemd motd-news.service. Let's update...
6667
68# Abort early if wget is missing
69[ -x /usr/bin/wget ] || exit 0
70
67# Generate our temp files, clean up when done71# Generate our temp files, clean up when done
68NEWS=$(mktemp) || exit 172NEWS=$(mktemp) || exit 1
69ERR=$(mktemp) || exit 173ERR=$(mktemp) || exit 1
@@ -73,8 +77,8 @@ trap "rm -f $NEWS $ERR $CLOUD" HUP INT QUIT ILL TRAP KILL BUS TERM
73# Construct a user agent, similar to Firefox/Chrome/Safari/IE to77# Construct a user agent, similar to Firefox/Chrome/Safari/IE to
74# ensure a proper, tailored, accurate message of the day78# ensure a proper, tailored, accurate message of the day
7579
76# Curl browser version, for debug purposes80# wget browser version, for debug purposes
77curl_ver="$(dpkg -l curl | awk '$1 == "ii" { print($3); exit(0); }')"81wget_ver="$(dpkg -l wget | awk '$1 == "ii" { print($3); exit(0); }')"
7882
79# Distribution version, for messages releated to this Ubuntu release83# Distribution version, for messages releated to this Ubuntu release
80. /etc/lsb-release84. /etc/lsb-release
@@ -97,12 +101,8 @@ if [ -x /usr/bin/cloud-id ]; then
97 fi101 fi
98fi102fi
99103
100# Some messages may only be pertinent before or after some amount of uptime
101read up idle < /proc/uptime
102uptime="uptime/$up/$idle"
103
104# Piece together the user agent104# Piece together the user agent
105USER_AGENT="curl/$curl_ver $lsb $platform $cpu $uptime cloud_id/$cloud_id"105USER_AGENT="wget/$wget_ver $lsb $platform $cpu cloud_id/$cloud_id"
106106
107# Loop over any configured URLs107# Loop over any configured URLs
108for u in $URLS; do108for u in $URLS; do
@@ -121,7 +121,18 @@ for u in $URLS; do
121 # If we're forced, set the wait to much higher (1 minute)121 # If we're forced, set the wait to much higher (1 minute)
122 [ "$FORCED" = "1" ] && WAIT=60122 [ "$FORCED" = "1" ] && WAIT=60
123 # Fetch and print the news motd123 # Fetch and print the news motd
124 if curl --connect-timeout "$WAIT" --max-time "$WAIT" -A "$USER_AGENT" -o- "$u" >"$NEWS" 2>"$ERR"; then124 result=0
125 not_found_is_ok=0
126 wget --timeout "$WAIT" -U "$USER_AGENT" -O- --content-on-error "$u" >"$NEWS" 2>"$ERR" || result=$?
127 # from wget's manpage: 8 Server issued an error response.
128 if [ $result -eq 8 ]; then
129 if grep -q "ERROR 404" "$ERR"; then
130 # The server's 404 document is the generic, non cloud-specific, motd-news
131 # content present in the index.txt file
132 not_found_is_ok=1
133 fi
134 fi
135 if [ $result -eq 0 ] || [ $not_found_is_ok -eq 1 ]; then
125 echo136 echo
126 # At most, 10 lines of text, remove control characters, print at most 80 characters per line137 # At most, 10 lines of text, remove control characters, print at most 80 characters per line
127 safe_print "$NEWS"138 safe_print "$NEWS"

Subscribers

People subscribed via source and target branches