Merge ~ahasenack/ubuntu/+source/base-files:focal-handle-was-removed-1895302 into ubuntu/+source/base-files:ubuntu/devel

Proposed by Andreas Hasenack
Status: Superseded
Proposed branch: ~ahasenack/ubuntu/+source/base-files:focal-handle-was-removed-1895302
Merge into: ubuntu/+source/base-files:ubuntu/devel
Diff against target: 234 lines (+95/-0) (has conflicts)
9 files modified
debian/base-files.maintscript (+4/-0)
debian/changelog (+40/-0)
debian/control (+9/-0)
debian/motd-news-config.postinst (+8/-0)
debian/postinst.in (+12/-0)
etc/issue (+4/-0)
etc/issue.net (+4/-0)
etc/lsb-release (+6/-0)
etc/os-release (+8/-0)
Conflict in debian/base-files.maintscript
Conflict in debian/changelog
Conflict in debian/control
Conflict in debian/motd-news-config.postinst
Conflict in debian/postinst.in
Conflict in etc/issue
Conflict in etc/issue.net
Conflict in etc/lsb-release
Conflict in etc/os-release
Reviewer Review Type Date Requested Status
Canonical Server Core Reviewers Pending
Canonical Server Pending
Review via email: mp+390765@code.launchpad.net

This proposal has been superseded by a proposal from 2020-09-15.

Description of the change

Handle the creation and removal of the /etc/default/motd-news.wasremoved file in maintainer scripts.

I have two choices here:
a) handle the creation and removal of that file (this MP)
b) give up trying to handle that file, and just cleanup: https://git.launchpad.net/~ahasenack/ubuntu/+source/base-files/commit/?h=groovy-drop-wasremoved&id=1c8983d04fdadf831976cbe42259a4b9b5b79d0b

To recap, the idea behind /e/d/motd-news.wasremoved was to handle the case where:
- user had base-files and ubuntu-server from before the split, meaning /e/d/motd-news is a config file part of base-files
- motd-news is enabled (ENABLED=1 in /e/d/motd-news)
- in an erroneous attempt to disable the service, the user removes the /e/d/motd-news file. ENABLED doesn't get set, and the motd-news script just exits

In the above scenario, without the .wasremoved feature, if the user upgraded to the updated packages with the spit, then /e/d/motd-news would be reinstated because it's now part of the motd-news-config package. This would re-enable the motd-news feature, something we want to be careful about.

The implementation suffers from some problems, though:
- a fresh install of base-files, like done via debootstrap, will create the .wasremoved file. If you then install motd-news-config (via apt install ubuntu-server, for example), the motd-news-config postinst fill find the .wasremoved file, see it's a fresh install of motd-news-config, and disable motd-news. This is the current situation in the groovy lxd images, for example
- if you just have base-files installed, no motd-news-config, and then reinstall or upgrade base-files, the .wasremoved will be created

To address those, this MP (choice (a)) does:
- motd-news-config postinst: always remove the .wasremoved file in configure if found, regardless if /etc/default/motd-news was sed'ed or not, or if we are upgrading or on a first install
- base-files postinst: guard the creation of .wasremoved with:
  - Only during an upgrade
  - Only if ubuntu-server is installed (via a dpkg -l check)

If a user again decides to erroneously disable motd-news by removing /e/d/motd-news, then an upgrade of base-files, motd-news-config and ubuntu-server will go through the creation and removal of the .wasremoved file, but no new /e/d/motd-news config file will be created or changed, and motd-news will at least remain disabled. But it's extra unnecessary churn, as the corner case it handles only happens when upgrading from before the motd-news-config split.

The dpkg -l check for ubuntu-server relies on ubuntu-server depending (and not just recommending) on motd-news-config. I'm a bit afraid of the dpkg -l call in base-files' postinst:
- Locking issues?
- I'm checking for ^i, should I be looking for other cases? Other flags?
- At least dpkg is already installed, as I see other calls to it in the same postinst

If we find other issues in these maintainer scripts regarding the motd-news-config split, or introduce new ones with these changes, it will get harder and harder to fix each time. That's why I also have to consider simply giving up and living with the corner case we tried to handle in the beginning, and that is this diff: https://git.launchpad.net/~ahasenack/ubuntu/+source/base-files/commit/?h=groovy-drop-wasremoved&id=1c8983d04fdadf831976cbe42259a4b9b5b79d0b Just note that in this case, the corner case scenario will leave motd-news enabled when it was supposed to be disabled.

I have PPAs for both scenarios, with groovy and focal packages (just not yet bionic or xenial):

Give up handling of .wasremoved: https://launchpad.net/~ahasenack/+archive/ubuntu/motd-news-drop-wasremoved/

Try to fix handling of .wasremoved: https://launchpad.net/~ahasenack/+archive/ubuntu/motd-news-wasremoved-handling/

May the best one win :)

To post a comment you must log in.

Unmerged commits

8a66e5c... by Andreas Hasenack

changelog

6fcd366... by Andreas Hasenack

  * d/motd-news-config.postinst: always remove /e/d/motd-news.wasremoved
    if present

9b68a73... by Andreas Hasenack

  * d/postinst.in: re-arrange the cascading conditionals around the
    creation of the .wasremoved file for better clarity

03931a2... by Andreas Hasenack

  * d/postinst.in: check if ubuntu-server is installed before creating
    the .wasremoved file

6f3fbdb... by Andreas Hasenack

  * d/control: set priority to optional for motd-news-config to avoid
    having it pulled in by the release upgrader

1c5b4b9... by Andreas Hasenack

changelog

d06cb18... by Steve Langasek

  [ Steve Langasek ]
  * motd/50-motd-news: use wget instead of curl, since wget is standard but
    curl is optional (LP: #1888572):
    - This changes the timeout behavior slightly because wget does not have
      an exact equivalent to curl's --max-time argument, we are using
      --timeout instead.

c4e4748... by Andreas Hasenack

    - d/rules, d/motd-news-config.install: /e/d/motd-news is in the
      motd-news-config package now

d217183... by Andreas Hasenack

    - d/control: new motd-news-config package, carrying the
      configuration file for the /etc/update-motd.d/50-motd-news script.

78f2dc7... by Andreas Hasenack

    - d/postinst.in: signal the motd-news-config package if the
      motd-news config file was removed manually before the upgrade

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
index 9972f51..b1e3c88 100644
--- a/debian/base-files.maintscript
+++ b/debian/base-files.maintscript
@@ -1 +1,5 @@
1<<<<<<< debian/base-files.maintscript
1rm_conffile /etc/default/motd-news 11ubuntu11~ base-files2rm_conffile /etc/default/motd-news 11ubuntu11~ base-files
3=======
4rm_conffile /etc/default/motd-news 11ubuntu5.2~ base-files
5>>>>>>> debian/base-files.maintscript
diff --git a/debian/changelog b/debian/changelog
index eb44a50..5146861 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,4 @@
1<<<<<<< debian/changelog
1base-files (11ubuntu12) groovy; urgency=medium2base-files (11ubuntu12) groovy; urgency=medium
23
3 * d/control: set priority to optional for motd-news-config to avoid4 * d/control: set priority to optional for motd-news-config to avoid
@@ -7,11 +8,33 @@ base-files (11ubuntu12) groovy; urgency=medium
78
8base-files (11ubuntu11) groovy; urgency=medium9base-files (11ubuntu11) groovy; urgency=medium
910
11=======
12base-files (11ubuntu5.3) focal; urgency=medium
13
14 * d/postinst.in: check if ubuntu-server is installed before creating
15 the .wasremoved file
16 * d/postinst.in: re-arrange the cascading conditionals around the
17 creation of the .wasremoved file for better clarity
18 * d/motd-news-config.postinst: always remove /e/d/motd-news.wasremoved
19 if present
20
21 -- Andreas Hasenack <andreas@canonical.com> Mon, 14 Sep 2020 18:06:37 -0300
22
23base-files (11ubuntu5.2) focal; urgency=medium
24
25 [ Andreas Hasenack ]
26 * motd/50-motd-news: don't include uptime in the user-agent string
27 (LP: #1886572)
28>>>>>>> debian/changelog
10 * Move the /etc/default/motd-news conffile to the motd-news-config29 * Move the /etc/default/motd-news conffile to the motd-news-config
11 package (LP: #1888575):30 package (LP: #1888575):
12 - d/base-files.maintscript: remove /etc/default/motd-news config file31 - d/base-files.maintscript: remove /etc/default/motd-news config file
13 on upgrade32 on upgrade
33<<<<<<< debian/changelog
14 - d/control: break on ubuntu-server << 1.453 to force an upgrade if34 - d/control: break on ubuntu-server << 1.453 to force an upgrade if
35=======
36 - d/control: break on ubuntu-server << 1.450.2 to force an upgrade if
37>>>>>>> debian/changelog
15 it is installed, which will pull motd-news-config and the conffile38 it is installed, which will pull motd-news-config and the conffile
16 back in39 back in
17 - d/motd-news-config.postinst:40 - d/motd-news-config.postinst:
@@ -26,6 +49,7 @@ base-files (11ubuntu11) groovy; urgency=medium
26 - d/rules, d/motd-news-config.install: /e/d/motd-news is in the49 - d/rules, d/motd-news-config.install: /e/d/motd-news is in the
27 motd-news-config package now50 motd-news-config package now
2851
52<<<<<<< debian/changelog
29 -- Andreas Hasenack <andreas@canonical.com> Mon, 10 Aug 2020 21:02:37 +000053 -- Andreas Hasenack <andreas@canonical.com> Mon, 10 Aug 2020 21:02:37 +0000
3054
31base-files (11ubuntu10) groovy; urgency=medium55base-files (11ubuntu10) groovy; urgency=medium
@@ -41,10 +65,16 @@ base-files (11ubuntu9) groovy; urgency=medium
4165
42 * motd/50-motd-news: use wget instead of curl, since wget is standard but66 * motd/50-motd-news: use wget instead of curl, since wget is standard but
43 curl is optional.67 curl is optional.
68=======
69 [ Steve Langasek ]
70 * motd/50-motd-news: use wget instead of curl, since wget is standard but
71 curl is optional (LP: #1888572):
72>>>>>>> debian/changelog
44 - This changes the timeout behavior slightly because wget does not have73 - This changes the timeout behavior slightly because wget does not have
45 an exact equivalent to curl's --max-time argument, we are using74 an exact equivalent to curl's --max-time argument, we are using
46 --timeout instead.75 --timeout instead.
4776
77<<<<<<< debian/changelog
48 -- Steve Langasek <steve.langasek@ubuntu.com> Fri, 10 Jul 2020 09:58:46 -070078 -- Steve Langasek <steve.langasek@ubuntu.com> Fri, 10 Jul 2020 09:58:46 -0700
4979
50base-files (11ubuntu8) groovy; urgency=medium80base-files (11ubuntu8) groovy; urgency=medium
@@ -66,6 +96,16 @@ base-files (11ubuntu6) groovy; urgency=medium
66 * /etc/issue{,.net}, /etc/{lsb,os}-release: Welcome to Groovy Gorilla!96 * /etc/issue{,.net}, /etc/{lsb,os}-release: Welcome to Groovy Gorilla!
6797
68 -- Matthias Klose <doko@ubuntu.com> Fri, 24 Apr 2020 17:11:27 +020098 -- Matthias Klose <doko@ubuntu.com> Fri, 24 Apr 2020 17:11:27 +0200
99=======
100 -- Andreas Hasenack <andreas@canonical.com> Mon, 17 Aug 2020 10:31:58 -0300
101
102base-files (11ubuntu5.1) focal; urgency=medium
103
104 * /etc/issue, /etc/issue.net, /etc/lsb-release, /etc/os-release: Bump
105 version number to 20.04.1 in preparation of the next point release.
106
107 -- Ɓukasz 'sil2100' Zemczak <lukasz.zemczak@ubuntu.com> Wed, 15 Jul 2020 10:59:48 +0200
108>>>>>>> debian/changelog
69109
70base-files (11ubuntu5) focal; urgency=medium110base-files (11ubuntu5) focal; urgency=medium
71111
diff --git a/debian/control b/debian/control
index 1dbf9b9..d87d63a 100644
--- a/debian/control
+++ b/debian/control
@@ -15,7 +15,11 @@ Essential: 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<<<<<<< debian/control
18 ubuntu-server (<< 1.453)19 ubuntu-server (<< 1.453)
20=======
21 ubuntu-server (<< 1.450.2)
22>>>>>>> debian/control
19Multi-Arch: foreign23Multi-Arch: foreign
20Description: Debian base system miscellaneous files24Description: Debian base system miscellaneous files
21 This package contains the basic filesystem hierarchy of a Debian system, and25 This package contains the basic filesystem hierarchy of a Debian system, and
@@ -33,8 +37,13 @@ Description: LSB release information
33Package: motd-news-config37Package: motd-news-config
34Architecture: all38Architecture: all
35Priority: optional39Priority: optional
40<<<<<<< debian/control
36Breaks: base-files (<< 11ubuntu11)41Breaks: base-files (<< 11ubuntu11)
37Replaces: base-files (<< 11ubuntu11)42Replaces: base-files (<< 11ubuntu11)
43=======
44Breaks: base-files (<< 11ubuntu5.2)
45Replaces: base-files (<< 11ubuntu5.2)
46>>>>>>> debian/control
38Depends: ${shlibs:Depends}, ${misc:Depends}47Depends: ${shlibs:Depends}, ${misc:Depends}
39Description: Configuration for motd-news shipped in base-files48Description: Configuration for motd-news shipped in base-files
40 This package contains the configuration read by the motd-news script49 This package contains the configuration read by the motd-news script
diff --git a/debian/motd-news-config.postinst b/debian/motd-news-config.postinst
index a73427f..2b4fafd 100644
--- a/debian/motd-news-config.postinst
+++ b/debian/motd-news-config.postinst
@@ -33,9 +33,17 @@ case "$1" in
33 fi33 fi
34 if [ -e /etc/default/motd-news.wasremoved ] && [ -e /etc/default/motd-news ]; then34 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-news35 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<<<<<<< debian/motd-news-config.postinst
36 rm /etc/default/motd-news.wasremoved37 rm /etc/default/motd-news.wasremoved
37 fi38 fi
38 fi39 fi
40=======
41 fi
42 fi
43 if [ -e /etc/default/motd-news.wasremoved ]; then
44 rm /etc/default/motd-news.wasremoved
45 fi
46>>>>>>> debian/motd-news-config.postinst
39 ;;47 ;;
4048
41 abort-upgrade|abort-remove|abort-deconfigure)49 abort-upgrade|abort-remove|abort-deconfigure)
diff --git a/debian/postinst.in b/debian/postinst.in
index c347a62..c81e89a 100644
--- a/debian/postinst.in
+++ b/debian/postinst.in
@@ -130,12 +130,24 @@ fi
130# it does not put back the file with default contents which would130# it does not put back the file with default contents which would
131# re-enable motd-news131# re-enable motd-news
132motd_news_config="/etc/default/motd-news"132motd_news_config="/etc/default/motd-news"
133<<<<<<< debian/postinst.in
133if [ ! -e ${motd_news_config} ]; then134if [ ! -e ${motd_news_config} ]; then
134 if [ ! -e ${motd_news_config}.dpkg-remove ]; then135 if [ ! -e ${motd_news_config}.dpkg-remove ]; then
135 if [ ! -e ${motd_news_config}.dpkg-backup ]; then136 if [ ! -e ${motd_news_config}.dpkg-backup ]; then
136 touch ${motd_news_config}.wasremoved137 touch ${motd_news_config}.wasremoved
137 fi138 fi
138 fi139 fi
140=======
141if [ "$2" != "" ] && \
142 [ ! -e ${motd_news_config} ] && \
143 [ ! -e ${motd_news_config}.dpkg-remove ] && \
144 [ ! -e ${motd_news_config}.dpkg-backup ]; then
145 # The .wasremoved file only matters if ubuntu-server is installed,
146 # because that's what will pull in motd-news-config
147 if dpkg -l ubuntu-server 2>/dev/null | grep -q ^i; then
148 touch ${motd_news_config}.wasremoved
149 fi
150>>>>>>> debian/postinst.in
139fi151fi
140152
141#DEBHELPER#153#DEBHELPER#
diff --git a/etc/issue b/etc/issue
index 62288be..eb7b599 100644
--- a/etc/issue
+++ b/etc/issue
@@ -1,2 +1,6 @@
1<<<<<<< etc/issue
1Ubuntu Groovy Gorilla (development branch) \n \l2Ubuntu Groovy Gorilla (development branch) \n \l
3=======
4Ubuntu 20.04.1 LTS \n \l
5>>>>>>> etc/issue
26
diff --git a/etc/issue.net b/etc/issue.net
index e86fc46..4b1d230 100644
--- a/etc/issue.net
+++ b/etc/issue.net
@@ -1 +1,5 @@
1<<<<<<< etc/issue.net
1Ubuntu Groovy Gorilla (development branch)2Ubuntu Groovy Gorilla (development branch)
3=======
4Ubuntu 20.04.1 LTS
5>>>>>>> etc/issue.net
diff --git a/etc/lsb-release b/etc/lsb-release
index b08a2f9..83ad511 100644
--- a/etc/lsb-release
+++ b/etc/lsb-release
@@ -1,4 +1,10 @@
1DISTRIB_ID=Ubuntu1DISTRIB_ID=Ubuntu
2<<<<<<< etc/lsb-release
2DISTRIB_RELEASE=20.103DISTRIB_RELEASE=20.10
3DISTRIB_CODENAME=groovy4DISTRIB_CODENAME=groovy
4DISTRIB_DESCRIPTION="Ubuntu Groovy Gorilla (development branch)"5DISTRIB_DESCRIPTION="Ubuntu Groovy Gorilla (development branch)"
6=======
7DISTRIB_RELEASE=20.04
8DISTRIB_CODENAME=focal
9DISTRIB_DESCRIPTION="Ubuntu 20.04.1 LTS"
10>>>>>>> etc/lsb-release
diff --git a/etc/os-release b/etc/os-release
index 3ccc041..aac715d 100644
--- a/etc/os-release
+++ b/etc/os-release
@@ -1,9 +1,17 @@
1NAME="Ubuntu"1NAME="Ubuntu"
2<<<<<<< etc/os-release
2VERSION="20.10 (Groovy Gorilla)"3VERSION="20.10 (Groovy Gorilla)"
3ID=ubuntu4ID=ubuntu
4ID_LIKE=debian5ID_LIKE=debian
5PRETTY_NAME="Ubuntu Groovy Gorilla (development branch)"6PRETTY_NAME="Ubuntu Groovy Gorilla (development branch)"
6VERSION_ID="20.10"7VERSION_ID="20.10"
8=======
9VERSION="20.04.1 LTS (Focal Fossa)"
10ID=ubuntu
11ID_LIKE=debian
12PRETTY_NAME="Ubuntu 20.04.1 LTS"
13VERSION_ID="20.04"
14>>>>>>> etc/os-release
7HOME_URL="https://www.ubuntu.com/"15HOME_URL="https://www.ubuntu.com/"
8SUPPORT_URL="https://help.ubuntu.com/"16SUPPORT_URL="https://help.ubuntu.com/"
9BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"17BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"

Subscribers

People subscribed via source and target branches