Merge ~ahasenack/ubuntu/+source/base-files:xenial-motd-news-config-split into ubuntu/+source/base-files:ubuntu/xenial-devel
- Git
- lp:~ahasenack/ubuntu/+source/base-files
- xenial-motd-news-config-split
- Merge into ubuntu/xenial-devel
Status: | Merged | ||||||||
---|---|---|---|---|---|---|---|---|---|
Approved by: | Andreas Hasenack | ||||||||
Approved revision: | c91565c6eb7c49f151ab7fff5a1cb9e350224e04 | ||||||||
Merged at revision: | c91565c6eb7c49f151ab7fff5a1cb9e350224e04 | ||||||||
Proposed branch: | ~ahasenack/ubuntu/+source/base-files:xenial-motd-news-config-split | ||||||||
Merge into: | ubuntu/+source/base-files:ubuntu/xenial-devel | ||||||||
Diff against target: |
362 lines (+197/-15) 10 files modified
debian/changelog (+35/-0) debian/conffiles (+0/-1) debian/control (+13/-1) debian/motd-news-config.conffiles (+1/-0) debian/motd-news-config.postinst (+50/-0) debian/postinst.in (+19/-0) debian/postrm (+6/-0) debian/preinst (+34/-0) debian/rules (+19/-4) debian/update-motd.d/50-motd-news (+20/-9) |
||||||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Christian Ehrhardt (community) | Approve | ||
Canonical Server | Pending | ||
Review via email: mp+389300@code.launchpad.net |
Commit message
Description of the change
Same as https:/
- backport the switch to wget, and follow-up fixes that landed in groovy
- far from just a detail: the xenial package does not use debhelper, so I had to do many things by hand in d/rules
- versions for breaks/replaces are the xenial ones:
ubuntu-server 1.361.5:
Depends: motd-news-config
base-files 9.4ubuntu4.13:
Breaks: ubuntu-server (<< 1.361.5)
rm_conffile /etc/default/
motd-news-config 9.4ubuntu4.13:
Breaks/Replaces: base-files (<< 9.4ubuntu4.13)
PPA: https:/
The linked bugs have the SRU template filled out.
Andreas Hasenack (ahasenack) wrote : | # |
Christian Ehrhardt (paelzer) wrote : | # |
Change matches what we had in Groovy and soon Focal.
Additional change for priority is good as well.
Versions are good as well for an SRU and the bug LGTM as well.
The breaks and rm_conffile versions are adapted correctly, but we really need to land the meta change at the same time to avoid some updaters to remove packages or even ubuntu-server.
+1 to this in general, but I found one triviality to fix.
The changelog entries got carried over without line-wrap. So you violate the 80 chars in two lines and tools like lintian will hate it.
Fix is trivial enough, you don't need a re-review for the CL changes.
I was wondering at first why the different rm_conffile calls - but I see that adding debian/
+1 to this (condition, adapt the changelog)
Andreas Hasenack (ahasenack) wrote : | # |
> I was wondering at first why the different rm_conffile calls - but I see that
> adding debian/
> no effect as he maintainer scripts have no #DEBHELPER# template
Not just that, debhelper isn't used at all in d/rules. I followed the dpkg-maintscrip
Andreas Hasenack (ahasenack) wrote : | # |
changelog fixed
Andreas Hasenack (ahasenack) wrote : | # |
Tagging and uploading c91565c6eb7c49f
$ git push pkg upload/
Enumerating objects: 64, done.
Counting objects: 100% (64/64), done.
Delta compression using up to 4 threads
Compressing objects: 100% (49/49), done.
Writing objects: 100% (54/54), 8.46 KiB | 2.82 MiB/s, done.
Total 54 (delta 38), reused 7 (delta 4)
To ssh://git.
* [new tag] upload/
$ dput ubuntu ../base-
Checking signature on .changes
gpg: ../base-
Checking signature on .dsc
gpg: ../base-
Uploading to ubuntu (via ftp to upload.ubuntu.com):
Uploading base-files_
Uploading base-files_
Uploading base-files_
Uploading base-files_
Successfully uploaded packages.
Andreas Hasenack (ahasenack) wrote : | # |
Also uploading https:/
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 d8fb428bfd5b666
$ git push pkg upload/1.361.5
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.13 KiB | 46.00 KiB/s, done.
Total 9 (delta 5), reused 0 (delta 0)
To ssh://git.
* [new tag] upload/1.361.5 -> upload/1.361.5
$ dput ubuntu ../ubuntu-
Checking signature on .changes
gpg: ../ubuntu-
Checking signature on .dsc
gpg: ../ubuntu-
Uploading to ubuntu (via ftp to upload.ubuntu.com):
Uploading ubuntu-
Uploading ubuntu-
Uploading ubuntu-
Uploading ubuntu-
Successfully uploaded packages.
Andreas Hasenack (ahasenack) wrote : | # |
Seeds changed for xenial in 2c4f57772b95223
Preview Diff
1 | diff --git a/debian/changelog b/debian/changelog | |||
2 | index 3be5a47..cf951ad 100644 | |||
3 | --- a/debian/changelog | |||
4 | +++ b/debian/changelog | |||
5 | @@ -1,3 +1,38 @@ | |||
6 | 1 | base-files (9.4ubuntu4.13) xenial; urgency=medium | ||
7 | 2 | |||
8 | 3 | [ Andreas Hasenack ] | ||
9 | 4 | * motd/50-motd-news: don't include uptime in the user-agent string | ||
10 | 5 | (LP: #1886572) | ||
11 | 6 | * Move the /etc/default/motd-news conffile to the motd-news-config | ||
12 | 7 | package (LP: #1888575): | ||
13 | 8 | - d/postinst.in, d/postrm, d/preinst: remove /etc/default/motd-news | ||
14 | 9 | config file on base-files upgrade using dpkg-maintscript-helper | ||
15 | 10 | - d/rules: install d/preinst | ||
16 | 11 | - d/control: break on ubuntu-server << 1.361.5 to force an upgrade if | ||
17 | 12 | it is installed, which will pull motd-news-config and the conffile | ||
18 | 13 | back in | ||
19 | 14 | - d/control: new motd-news-config package, carrying the | ||
20 | 15 | configuration file for the /etc/update-motd.d/50-motd-news script. | ||
21 | 16 | - d/motd-news-config.postinst: | ||
22 | 17 | + handle the upgrade case where the motd-news config file was | ||
23 | 18 | changed while it belonged to base-files | ||
24 | 19 | + disable motd-news if the config file was removed by hand before | ||
25 | 20 | the upgrade | ||
26 | 21 | - d/postinst.in: signal the motd-news-config package if the | ||
27 | 22 | motd-news config file was removed manually before the upgrade | ||
28 | 23 | - d/conffiles: remove motd-news | ||
29 | 24 | - d/rules, d/motd-news-config.conffiles: packaging motd-news-config | ||
30 | 25 | without debhelper | ||
31 | 26 | |||
32 | 27 | [ Steve Langasek ] | ||
33 | 28 | * motd/50-motd-news: use wget instead of curl, since wget is standard but | ||
34 | 29 | curl is optional (LP: #1888572): | ||
35 | 30 | - This changes the timeout behavior slightly because wget does not have | ||
36 | 31 | an exact equivalent to curl's --max-time argument, we are using | ||
37 | 32 | --timeout instead. | ||
38 | 33 | |||
39 | 34 | -- Andreas Hasenack <andreas@canonical.com> Mon, 17 Aug 2020 11:19:19 -0300 | ||
40 | 35 | |||
41 | 1 | base-files (9.4ubuntu4.12) xenial; urgency=medium | 36 | base-files (9.4ubuntu4.12) xenial; urgency=medium |
42 | 2 | 37 | ||
43 | 3 | * /etc/issue, /etc/issue.net, /etc/lsb-release, /etc/os-release: Bump | 38 | * /etc/issue, /etc/issue.net, /etc/lsb-release, /etc/os-release: Bump |
44 | diff --git a/debian/conffiles b/debian/conffiles | |||
45 | index 6600468..748ffb5 100644 | |||
46 | --- a/debian/conffiles | |||
47 | +++ b/debian/conffiles | |||
48 | @@ -1,5 +1,4 @@ | |||
49 | 1 | /etc/debian_version | 1 | /etc/debian_version |
50 | 2 | /etc/default/motd-news | ||
51 | 3 | /etc/dpkg/origins/debian | 2 | /etc/dpkg/origins/debian |
52 | 4 | /etc/dpkg/origins/ubuntu | 3 | /etc/dpkg/origins/ubuntu |
53 | 5 | /etc/host.conf | 4 | /etc/host.conf |
54 | diff --git a/debian/control b/debian/control | |||
55 | index 49ad4f0..a8c39a2 100644 | |||
56 | --- a/debian/control | |||
57 | +++ b/debian/control | |||
58 | @@ -12,7 +12,7 @@ Pre-Depends: awk | |||
59 | 12 | Essential: yes | 12 | Essential: yes |
60 | 13 | Priority: required | 13 | Priority: required |
61 | 14 | Replaces: base, miscutils, dpkg (<= 1.15.0) | 14 | Replaces: base, miscutils, dpkg (<= 1.15.0) |
63 | 15 | Breaks: initscripts (<< 2.88dsf-13.3), sendfile (<< 2.1b.20080616-5.2~) | 15 | Breaks: initscripts (<< 2.88dsf-13.3), sendfile (<< 2.1b.20080616-5.2~), ubuntu-server (<< 1.361.5) |
64 | 16 | Multi-Arch: foreign | 16 | Multi-Arch: foreign |
65 | 17 | Description: Debian base system miscellaneous files | 17 | Description: Debian base system miscellaneous files |
66 | 18 | This package contains the basic filesystem hierarchy of a Debian system, and | 18 | This package contains the basic filesystem hierarchy of a Debian system, and |
67 | @@ -25,3 +25,15 @@ Section: debian-installer | |||
68 | 25 | Architecture: all | 25 | Architecture: all |
69 | 26 | Priority: extra | 26 | Priority: extra |
70 | 27 | Description: LSB release information | 27 | Description: LSB release information |
71 | 28 | |||
72 | 29 | Package: motd-news-config | ||
73 | 30 | Architecture: all | ||
74 | 31 | Priority: optional | ||
75 | 32 | Breaks: base-files (<< 9.4ubuntu4.13) | ||
76 | 33 | Replaces: base-files (<< 9.4ubuntu4.13) | ||
77 | 34 | Depends: ${shlibs:Depends}, ${misc:Depends} | ||
78 | 35 | Description: Configuration for motd-news shipped in base-files | ||
79 | 36 | This package contains the configuration read by the motd-news script | ||
80 | 37 | shipped in the base-files package. | ||
81 | 38 | . | ||
82 | 39 | Install this package if you want motd-news to be enabled. | ||
83 | diff --git a/debian/motd-news-config.conffiles b/debian/motd-news-config.conffiles | |||
84 | 28 | new file mode 100644 | 40 | new file mode 100644 |
85 | index 0000000..4109d03 | |||
86 | --- /dev/null | |||
87 | +++ b/debian/motd-news-config.conffiles | |||
88 | @@ -0,0 +1 @@ | |||
89 | 1 | /etc/default/motd-news | ||
90 | diff --git a/debian/motd-news-config.postinst b/debian/motd-news-config.postinst | |||
91 | 0 | new file mode 100644 | 2 | new file mode 100644 |
92 | index 0000000..419d326 | |||
93 | --- /dev/null | |||
94 | +++ b/debian/motd-news-config.postinst | |||
95 | @@ -0,0 +1,50 @@ | |||
96 | 1 | #!/bin/sh | ||
97 | 2 | # postinst script for motd-news-config | ||
98 | 3 | # | ||
99 | 4 | # see: dh_installdeb(1) | ||
100 | 5 | |||
101 | 6 | set -e | ||
102 | 7 | |||
103 | 8 | # summary of how this script can be called: | ||
104 | 9 | # * <postinst> `configure' <most-recently-configured-version> | ||
105 | 10 | # * <old-postinst> `abort-upgrade' <new version> | ||
106 | 11 | # * <conflictor's-postinst> `abort-remove' `in-favour' <package> | ||
107 | 12 | # <new-version> | ||
108 | 13 | # * <postinst> `abort-remove' | ||
109 | 14 | # * <deconfigured's-postinst> `abort-deconfigure' `in-favour' | ||
110 | 15 | # <failed-install-package> <version> `removing' | ||
111 | 16 | # <conflicting-package> <version> | ||
112 | 17 | # for details, see https://www.debian.org/doc/debian-policy/ or | ||
113 | 18 | # the debian-policy package | ||
114 | 19 | |||
115 | 20 | |||
116 | 21 | case "$1" in | ||
117 | 22 | configure) | ||
118 | 23 | # only run on new installs, $2 will be empty then | ||
119 | 24 | if [ -z "$2" ]; then | ||
120 | 25 | # /e/d/motd-news was moved from pkg:base-files to this package. | ||
121 | 26 | # base-files runs rm_conffile which, if it was modified, leaves | ||
122 | 27 | # /e/d/motd-news.dpkg-bak around. We want to preserve that *changed* | ||
123 | 28 | # config file in this migration, and this is something that | ||
124 | 29 | # rm_conffile is not handling. In that case, let's put the backup | ||
125 | 30 | # file back in place | ||
126 | 31 | if [ -e /etc/default/motd-news.dpkg-bak ]; then | ||
127 | 32 | mv /etc/default/motd-news.dpkg-bak /etc/default/motd-news | ||
128 | 33 | fi | ||
129 | 34 | if [ -e /etc/default/motd-news.wasremoved ] && [ -e /etc/default/motd-news ]; then | ||
130 | 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 | ||
131 | 36 | rm /etc/default/motd-news.wasremoved | ||
132 | 37 | fi | ||
133 | 38 | fi | ||
134 | 39 | ;; | ||
135 | 40 | |||
136 | 41 | abort-upgrade|abort-remove|abort-deconfigure) | ||
137 | 42 | ;; | ||
138 | 43 | |||
139 | 44 | *) | ||
140 | 45 | echo "postinst called with unknown argument \`$1'" >&2 | ||
141 | 46 | exit 1 | ||
142 | 47 | ;; | ||
143 | 48 | esac | ||
144 | 49 | |||
145 | 50 | exit 0 | ||
146 | diff --git a/debian/postinst.in b/debian/postinst.in | |||
147 | index db85abf..89ddd29 100644 | |||
148 | --- a/debian/postinst.in | |||
149 | +++ b/debian/postinst.in | |||
150 | @@ -127,6 +127,19 @@ if [ "$1" = "configure" ] && [ "$2" != "" ]; then | |||
151 | 127 | fi | 127 | fi |
152 | 128 | fi | 128 | fi |
153 | 129 | 129 | ||
154 | 130 | # special case of having /etc/default/motd-news removed by hand | ||
155 | 131 | # signal the motd-news-config package that this happened, so that | ||
156 | 132 | # it does not put back the file with default contents which would | ||
157 | 133 | # re-enable motd-news | ||
158 | 134 | motd_news_config="/etc/default/motd-news" | ||
159 | 135 | if [ ! -e ${motd_news_config} ]; then | ||
160 | 136 | if [ ! -e ${motd_news_config}.dpkg-remove ]; then | ||
161 | 137 | if [ ! -e ${motd_news_config}.dpkg-backup ]; then | ||
162 | 138 | touch ${motd_news_config}.wasremoved | ||
163 | 139 | fi | ||
164 | 140 | fi | ||
165 | 141 | fi | ||
166 | 142 | |||
167 | 130 | # Manually inject expected maintainer script contents based on dh_systemd_* | 143 | # Manually inject expected maintainer script contents based on dh_systemd_* |
168 | 131 | 144 | ||
169 | 132 | # This will only remove masks created by d-s-h on package removal. | 145 | # This will only remove masks created by d-s-h on package removal. |
170 | @@ -147,3 +160,9 @@ if [ -d /run/systemd/system ]; then | |||
171 | 147 | systemctl --system daemon-reload >/dev/null || true | 160 | systemctl --system daemon-reload >/dev/null || true |
172 | 148 | deb-systemd-invoke start motd-news.timer >/dev/null || true | 161 | deb-systemd-invoke start motd-news.timer >/dev/null || true |
173 | 149 | fi | 162 | fi |
174 | 163 | |||
175 | 164 | if dpkg-maintscript-helper supports rm_conffile; then | ||
176 | 165 | dpkg-maintscript-helper rm_conffile /etc/default/motd-news 9.4ubuntu4.13~ base-files -- "$@" | ||
177 | 166 | fi | ||
178 | 167 | |||
179 | 168 | exit 0 | ||
180 | diff --git a/debian/postrm b/debian/postrm | |||
181 | index a763f0d..5f1a281 100644 | |||
182 | --- a/debian/postrm | |||
183 | +++ b/debian/postrm | |||
184 | @@ -19,3 +19,9 @@ if [ "$1" = "purge" ]; then | |||
185 | 19 | deb-systemd-helper unmask 'motd-news.timer' >/dev/null || true | 19 | deb-systemd-helper unmask 'motd-news.timer' >/dev/null || true |
186 | 20 | fi | 20 | fi |
187 | 21 | fi | 21 | fi |
188 | 22 | |||
189 | 23 | if dpkg-maintscript-helper supports rm_conffile; then | ||
190 | 24 | dpkg-maintscript-helper rm_conffile /etc/default/motd-news 9.4ubuntu4.13~ base-files -- "$@" | ||
191 | 25 | fi | ||
192 | 26 | |||
193 | 27 | exit 0 | ||
194 | diff --git a/debian/preinst b/debian/preinst | |||
195 | 22 | new file mode 100644 | 28 | new file mode 100644 |
196 | index 0000000..6b96fc1 | |||
197 | --- /dev/null | |||
198 | +++ b/debian/preinst | |||
199 | @@ -0,0 +1,34 @@ | |||
200 | 1 | #!/bin/sh | ||
201 | 2 | # preinst script for base-files | ||
202 | 3 | # | ||
203 | 4 | # see: dh_installdeb(1) | ||
204 | 5 | |||
205 | 6 | set -e | ||
206 | 7 | |||
207 | 8 | # summary of how this script can be called: | ||
208 | 9 | # * <new-preinst> `install' | ||
209 | 10 | # * <new-preinst> `install' <old-version> | ||
210 | 11 | # * <new-preinst> `upgrade' <old-version> | ||
211 | 12 | # * <old-preinst> `abort-upgrade' <new-version> | ||
212 | 13 | # for details, see https://www.debian.org/doc/debian-policy/ or | ||
213 | 14 | # the debian-policy package | ||
214 | 15 | |||
215 | 16 | |||
216 | 17 | case "$1" in | ||
217 | 18 | install|upgrade) | ||
218 | 19 | ;; | ||
219 | 20 | |||
220 | 21 | abort-upgrade) | ||
221 | 22 | ;; | ||
222 | 23 | |||
223 | 24 | *) | ||
224 | 25 | echo "preinst called with unknown argument \`$1'" >&2 | ||
225 | 26 | exit 1 | ||
226 | 27 | ;; | ||
227 | 28 | esac | ||
228 | 29 | |||
229 | 30 | if dpkg-maintscript-helper supports rm_conffile; then | ||
230 | 31 | dpkg-maintscript-helper rm_conffile /etc/default/motd-news 9.4ubuntu4.13~ base-files -- "$@" | ||
231 | 32 | fi | ||
232 | 33 | |||
233 | 34 | exit 0 | ||
234 | diff --git a/debian/rules b/debian/rules | |||
235 | index 0ca88d0..682cbf5 100755 | |||
236 | --- a/debian/rules | |||
237 | +++ b/debian/rules | |||
238 | @@ -25,10 +25,10 @@ build: | |||
239 | 25 | clean: | 25 | clean: |
240 | 26 | rm -f build | 26 | rm -f build |
241 | 27 | rm -f `find . -name "*~"` | 27 | rm -f `find . -name "*~"` |
243 | 28 | rm -rf debian/tmp debian/lsb-release-udeb debian/files* core debian/substvars | 28 | rm -rf debian/tmp debian/lsb-release-udeb debian/files* core debian/substvars debian/motd-news-config |
244 | 29 | 29 | ||
245 | 30 | binary-arch: build | 30 | binary-arch: build |
247 | 31 | rm -rf debian/tmp | 31 | rm -rf debian/tmp debian/motd-news-config |
248 | 32 | install -d debian/tmp/DEBIAN $(docdir) debian/tmp/etc/dpkg/origins | 32 | install -d debian/tmp/DEBIAN $(docdir) debian/tmp/etc/dpkg/origins |
249 | 33 | install -p -m 644 origins/* debian/tmp/etc/dpkg/origins | 33 | install -p -m 644 origins/* debian/tmp/etc/dpkg/origins |
250 | 34 | cd debian/tmp && install -d usr/share/$(package) | 34 | cd debian/tmp && install -d usr/share/$(package) |
251 | @@ -42,7 +42,7 @@ binary-arch: build | |||
252 | 42 | sed -e "s/#VENDORFILE#/$(VENDORFILE)/g" debian/postinst.in \ | 42 | sed -e "s/#VENDORFILE#/$(VENDORFILE)/g" debian/postinst.in \ |
253 | 43 | > debian/tmp/DEBIAN/postinst | 43 | > debian/tmp/DEBIAN/postinst |
254 | 44 | chmod 755 debian/tmp/DEBIAN/postinst | 44 | chmod 755 debian/tmp/DEBIAN/postinst |
256 | 45 | install -m 755 debian/prerm debian/postrm debian/tmp/DEBIAN | 45 | install -m 755 debian/prerm debian/postrm debian/preinst debian/tmp/DEBIAN |
257 | 46 | cd debian && install -m 644 conffiles tmp/DEBIAN | 46 | cd debian && install -m 644 conffiles tmp/DEBIAN |
258 | 47 | cd debian/tmp && install -d `cat ../directory-list` | 47 | cd debian/tmp && install -d `cat ../directory-list` |
259 | 48 | install -p -m 644 share/* debian/tmp/usr/share/base-files | 48 | install -p -m 644 share/* debian/tmp/usr/share/base-files |
260 | @@ -55,7 +55,6 @@ binary-arch: build | |||
261 | 55 | ln -s README $(docdir)/FAQ | 55 | ln -s README $(docdir)/FAQ |
262 | 56 | install -p -m 644 etc/* debian/tmp/etc | 56 | install -p -m 644 etc/* debian/tmp/etc |
263 | 57 | install -p -m 755 debian/update-motd.d/* debian/tmp/etc/update-motd.d | 57 | install -p -m 755 debian/update-motd.d/* debian/tmp/etc/update-motd.d |
264 | 58 | install -p -m 644 debian/motd-news debian/tmp/etc/default | ||
265 | 59 | install -p -m 644 debian/motd-news.service debian/tmp/lib/systemd/system/ | 58 | install -p -m 644 debian/motd-news.service debian/tmp/lib/systemd/system/ |
266 | 60 | install -p -m 644 debian/motd-news.timer debian/tmp/lib/systemd/system/ | 59 | install -p -m 644 debian/motd-news.timer debian/tmp/lib/systemd/system/ |
267 | 61 | ifeq ($(DEB_HOST_GNU_SYSTEM),gnu) | 60 | ifeq ($(DEB_HOST_GNU_SYSTEM),gnu) |
268 | @@ -87,6 +86,22 @@ endif | |||
269 | 87 | xargs -0r touch -h --date='$(BUILD_DATE)' | 86 | xargs -0r touch -h --date='$(BUILD_DATE)' |
270 | 88 | dpkg-deb --build -Zgzip debian/tmp .. | 87 | dpkg-deb --build -Zgzip debian/tmp .. |
271 | 89 | 88 | ||
272 | 89 | # motd-news-config packaging | ||
273 | 90 | install -d debian/motd-news-config/DEBIAN debian/motd-news-config/usr/share/doc/motd-news-config | ||
274 | 91 | install -d debian/motd-news-config/etc/default | ||
275 | 92 | install -m 0644 $(docdir)/changelog.gz $(docdir)/copyright debian/motd-news-config/usr/share/doc/motd-news-config | ||
276 | 93 | cp debian/motd-news-config.postinst debian/motd-news-config/DEBIAN/postinst | ||
277 | 94 | chmod 0755 debian/motd-news-config/DEBIAN/postinst | ||
278 | 95 | install -p -m 644 debian/motd-news debian/motd-news-config/etc/default | ||
279 | 96 | cp debian/motd-news-config.conffiles debian/motd-news-config/DEBIAN/conffiles | ||
280 | 97 | cd debian/motd-news-config && \ | ||
281 | 98 | find usr -type f ! -regex "DEBIAN/.*" -print0 |\ | ||
282 | 99 | LC_ALL=C sort -z | xargs -0r md5sum > DEBIAN/md5sums | ||
283 | 100 | chmod 0644 debian/motd-news-config/DEBIAN/conffiles | ||
284 | 101 | chmod 0644 debian/motd-news-config/DEBIAN/md5sums | ||
285 | 102 | dpkg-gencontrol -pmotd-news-config -Pdebian/motd-news-config | ||
286 | 103 | dpkg-deb --build -Zgzip debian/motd-news-config .. | ||
287 | 104 | |||
288 | 90 | binary-indep: build | 105 | binary-indep: build |
289 | 91 | rm -rf debian/lsb-release-udeb | 106 | rm -rf debian/lsb-release-udeb |
290 | 92 | install -d debian/lsb-release-udeb/DEBIAN debian/lsb-release-udeb/etc | 107 | install -d debian/lsb-release-udeb/DEBIAN debian/lsb-release-udeb/etc |
291 | diff --git a/debian/update-motd.d/50-motd-news b/debian/update-motd.d/50-motd-news | |||
292 | index 08d7f0d..c9d142f 100644 | |||
293 | --- a/debian/update-motd.d/50-motd-news | |||
294 | +++ b/debian/update-motd.d/50-motd-news | |||
295 | @@ -1,10 +1,11 @@ | |||
296 | 1 | #!/bin/sh | 1 | #!/bin/sh |
297 | 2 | # | 2 | # |
298 | 3 | # 50-motd-news - print the live news from the Ubuntu wire | 3 | # 50-motd-news - print the live news from the Ubuntu wire |
300 | 4 | # Copyright (C) 2016-2017 Canonical Ltd. | 4 | # Copyright (C) 2016-2020 Canonical Ltd. |
301 | 5 | # Copyright (C) 2016-2017 Dustin Kirkland | 5 | # Copyright (C) 2016-2017 Dustin Kirkland |
302 | 6 | # | 6 | # |
303 | 7 | # Authors: Dustin Kirkland <kirkland@canonical.com> | 7 | # Authors: Dustin Kirkland <kirkland@canonical.com> |
304 | 8 | # Steve Langasek <steve.langasek@canonical.com> | ||
305 | 8 | # | 9 | # |
306 | 9 | # This program is free software; you can redistribute it and/or modify | 10 | # This program is free software; you can redistribute it and/or modify |
307 | 10 | # it under the terms of the GNU General Public License as published by | 11 | # it under the terms of the GNU General Public License as published by |
308 | @@ -64,6 +65,9 @@ fi | |||
309 | 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, |
310 | 65 | # probably from the systemd motd-news.service. Let's update... | 66 | # probably from the systemd motd-news.service. Let's update... |
311 | 66 | 67 | ||
312 | 68 | # Abort early if wget is missing | ||
313 | 69 | [ -x /usr/bin/wget ] || exit 0 | ||
314 | 70 | |||
315 | 67 | # Generate our temp files, clean up when done | 71 | # Generate our temp files, clean up when done |
316 | 68 | NEWS=$(mktemp) || exit 1 | 72 | NEWS=$(mktemp) || exit 1 |
317 | 69 | ERR=$(mktemp) || exit 1 | 73 | ERR=$(mktemp) || exit 1 |
318 | @@ -73,8 +77,8 @@ trap "rm -f $NEWS $ERR $CLOUD" HUP INT QUIT ILL TRAP KILL BUS TERM | |||
319 | 73 | # Construct a user agent, similar to Firefox/Chrome/Safari/IE to | 77 | # Construct a user agent, similar to Firefox/Chrome/Safari/IE to |
320 | 74 | # ensure a proper, tailored, accurate message of the day | 78 | # ensure a proper, tailored, accurate message of the day |
321 | 75 | 79 | ||
324 | 76 | # Curl browser version, for debug purposes | 80 | # wget browser version, for debug purposes |
325 | 77 | curl_ver="$(dpkg -l curl | awk '$1 == "ii" { print($3); exit(0); }')" | 81 | wget_ver="$(dpkg -l wget | awk '$1 == "ii" { print($3); exit(0); }')" |
326 | 78 | 82 | ||
327 | 79 | # Distribution version, for messages releated to this Ubuntu release | 83 | # Distribution version, for messages releated to this Ubuntu release |
328 | 80 | . /etc/lsb-release | 84 | . /etc/lsb-release |
329 | @@ -97,12 +101,8 @@ if [ -x /usr/bin/cloud-id ]; then | |||
330 | 97 | fi | 101 | fi |
331 | 98 | fi | 102 | fi |
332 | 99 | 103 | ||
333 | 100 | # Some messages may only be pertinent before or after some amount of uptime | ||
334 | 101 | read up idle < /proc/uptime | ||
335 | 102 | uptime="uptime/$up/$idle" | ||
336 | 103 | |||
337 | 104 | # Piece together the user agent | 104 | # Piece together the user agent |
339 | 105 | USER_AGENT="curl/$curl_ver $lsb $platform $cpu $uptime cloud_id/$cloud_id" | 105 | USER_AGENT="wget/$wget_ver $lsb $platform $cpu cloud_id/$cloud_id" |
340 | 106 | 106 | ||
341 | 107 | # Loop over any configured URLs | 107 | # Loop over any configured URLs |
342 | 108 | for u in $URLS; do | 108 | for u in $URLS; do |
343 | @@ -121,7 +121,18 @@ for u in $URLS; do | |||
344 | 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) |
345 | 122 | [ "$FORCED" = "1" ] && WAIT=60 | 122 | [ "$FORCED" = "1" ] && WAIT=60 |
346 | 123 | # Fetch and print the news motd | 123 | # Fetch and print the news motd |
348 | 124 | if curl --connect-timeout "$WAIT" --max-time "$WAIT" -A "$USER_AGENT" -o- "$u" >"$NEWS" 2>"$ERR"; then | 124 | result=0 |
349 | 125 | not_found_is_ok=0 | ||
350 | 126 | wget --timeout "$WAIT" -U "$USER_AGENT" -O- --content-on-error "$u" >"$NEWS" 2>"$ERR" || result=$? | ||
351 | 127 | # from wget's manpage: 8 Server issued an error response. | ||
352 | 128 | if [ $result -eq 8 ]; then | ||
353 | 129 | if grep -q "ERROR 404" "$ERR"; then | ||
354 | 130 | # The server's 404 document is the generic, non cloud-specific, motd-news | ||
355 | 131 | # content present in the index.txt file | ||
356 | 132 | not_found_is_ok=1 | ||
357 | 133 | fi | ||
358 | 134 | fi | ||
359 | 135 | if [ $result -eq 0 ] || [ $not_found_is_ok -eq 1 ]; then | ||
360 | 125 | echo | 136 | echo |
361 | 126 | # At most, 10 lines of text, remove control characters, print at most 80 characters per line | 137 | # At most, 10 lines of text, remove control characters, print at most 80 characters per line |
362 | 127 | safe_print "$NEWS" | 138 | safe_print "$NEWS" |
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.