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

Proposed by Andreas Hasenack
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)
Reviewer Review Type Date Requested Status
Christian Ehrhardt  (community) Approve
Canonical Server Pending
Review via email: mp+389300@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 xenial, with the following extra details:

- 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 9.4ubuntu4.13~ base-files

motd-news-config 9.4ubuntu4.13:
  Breaks/Replaces: base-files (<< 9.4ubuntu4.13)

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

The 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 :

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 :

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/base-files.maintscript with the one line we need would have had no effect as he maintainer scripts have no #DEBHELPER# template and adding it int he SRU might change more than we want. I double checked if these three hooks should be enough - but they match the rm_conffile code well. This adds some noise, but the new lines LGTM - if your testing is good as well that should be fine.

+1 to this (condition, adapt the changelog)

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

> I was wondering at first why the different rm_conffile calls - but I see that
> adding debian/base-files.maintscript with the one line we need would have had
> 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-maintscript-helper manpage which says that for rm_conffile only preinst, postinst and postrm are used

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

changelog fixed

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

Tagging and uploading c91565c6eb7c49f151ab7fff5a1cb9e350224e04

$ git push pkg upload/9.4ubuntu4.13
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.launchpad.net/~usd-import-team/ubuntu/+source/base-files
 * [new tag] upload/9.4ubuntu4.13 -> upload/9.4ubuntu4.13

$ dput ubuntu ../base-files_9.4ubuntu4.13_source.changes
Checking signature on .changes
gpg: ../base-files_9.4ubuntu4.13_source.changes: Valid signature from AC983EB5BF6BCBA9
Checking signature on .dsc
gpg: ../base-files_9.4ubuntu4.13.dsc: Valid signature from AC983EB5BF6BCBA9
Uploading to ubuntu (via ftp to upload.ubuntu.com):
  Uploading base-files_9.4ubuntu4.13.dsc: done.
  Uploading base-files_9.4ubuntu4.13.tar.xz: done.
  Uploading base-files_9.4ubuntu4.13_source.buildinfo: done.
  Uploading base-files_9.4ubuntu4.13_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/xenial-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 d8fb428bfd5b6662e3408bdbb25121e844eb7c78 of that branch:

$ 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.launchpad.net/~usd-import-team/ubuntu/+source/ubuntu-meta
 * [new tag] upload/1.361.5 -> upload/1.361.5

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

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

Seeds changed for xenial in 2c4f57772b95223c86ac23afeb7e8034488c95c7 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/changelog b/debian/changelog
index 3be5a47..cf951ad 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,38 @@
1base-files (9.4ubuntu4.13) xenial; 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/postinst.in, d/postrm, d/preinst: remove /etc/default/motd-news
9 config file on base-files upgrade using dpkg-maintscript-helper
10 - d/rules: install d/preinst
11 - d/control: break on ubuntu-server << 1.361.5 to force an upgrade if
12 it is installed, which will pull motd-news-config and the conffile
13 back in
14 - d/control: new motd-news-config package, carrying the
15 configuration file for the /etc/update-motd.d/50-motd-news script.
16 - d/motd-news-config.postinst:
17 + handle the upgrade case where the motd-news config file was
18 changed while it belonged to base-files
19 + disable motd-news if the config file was removed by hand before
20 the upgrade
21 - d/postinst.in: signal the motd-news-config package if the
22 motd-news config file was removed manually before the upgrade
23 - d/conffiles: remove motd-news
24 - d/rules, d/motd-news-config.conffiles: packaging motd-news-config
25 without debhelper
26
27 [ Steve Langasek ]
28 * motd/50-motd-news: use wget instead of curl, since wget is standard but
29 curl is optional (LP: #1888572):
30 - This changes the timeout behavior slightly because wget does not have
31 an exact equivalent to curl's --max-time argument, we are using
32 --timeout instead.
33
34 -- Andreas Hasenack <andreas@canonical.com> Mon, 17 Aug 2020 11:19:19 -0300
35
1base-files (9.4ubuntu4.12) xenial; urgency=medium36base-files (9.4ubuntu4.12) xenial; urgency=medium
237
3 * /etc/issue, /etc/issue.net, /etc/lsb-release, /etc/os-release: Bump38 * /etc/issue, /etc/issue.net, /etc/lsb-release, /etc/os-release: Bump
diff --git a/debian/conffiles b/debian/conffiles
index 6600468..748ffb5 100644
--- a/debian/conffiles
+++ b/debian/conffiles
@@ -1,5 +1,4 @@
1/etc/debian_version1/etc/debian_version
2/etc/default/motd-news
3/etc/dpkg/origins/debian2/etc/dpkg/origins/debian
4/etc/dpkg/origins/ubuntu3/etc/dpkg/origins/ubuntu
5/etc/host.conf4/etc/host.conf
diff --git a/debian/control b/debian/control
index 49ad4f0..a8c39a2 100644
--- a/debian/control
+++ b/debian/control
@@ -12,7 +12,7 @@ Pre-Depends: awk
12Essential: yes12Essential: yes
13Priority: required13Priority: required
14Replaces: base, miscutils, dpkg (<= 1.15.0)14Replaces: base, miscutils, dpkg (<= 1.15.0)
15Breaks: initscripts (<< 2.88dsf-13.3), sendfile (<< 2.1b.20080616-5.2~)15Breaks: initscripts (<< 2.88dsf-13.3), sendfile (<< 2.1b.20080616-5.2~), ubuntu-server (<< 1.361.5)
16Multi-Arch: foreign16Multi-Arch: foreign
17Description: Debian base system miscellaneous files17Description: Debian base system miscellaneous files
18 This package contains the basic filesystem hierarchy of a Debian system, and18 This package contains the basic filesystem hierarchy of a Debian system, and
@@ -25,3 +25,15 @@ Section: debian-installer
25Architecture: all25Architecture: all
26Priority: extra26Priority: extra
27Description: LSB release information27Description: LSB release information
28
29Package: motd-news-config
30Architecture: all
31Priority: optional
32Breaks: base-files (<< 9.4ubuntu4.13)
33Replaces: base-files (<< 9.4ubuntu4.13)
34Depends: ${shlibs:Depends}, ${misc:Depends}
35Description: Configuration for motd-news shipped in base-files
36 This package contains the configuration read by the motd-news script
37 shipped in the base-files package.
38 .
39 Install this package if you want motd-news to be enabled.
diff --git a/debian/motd-news-config.conffiles b/debian/motd-news-config.conffiles
28new file mode 10064440new file mode 100644
index 0000000..4109d03
--- /dev/null
+++ b/debian/motd-news-config.conffiles
@@ -0,0 +1 @@
1/etc/default/motd-news
diff --git a/debian/motd-news-config.postinst b/debian/motd-news-config.postinst
0new file mode 1006442new file mode 100644
index 0000000..419d326
--- /dev/null
+++ b/debian/motd-news-config.postinst
@@ -0,0 +1,50 @@
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
50exit 0
diff --git a/debian/postinst.in b/debian/postinst.in
index db85abf..89ddd29 100644
--- a/debian/postinst.in
+++ b/debian/postinst.in
@@ -127,6 +127,19 @@ if [ "$1" = "configure" ] && [ "$2" != "" ]; then
127 fi127 fi
128fi128fi
129129
130# special case of having /etc/default/motd-news removed by hand
131# signal the motd-news-config package that this happened, so that
132# it does not put back the file with default contents which would
133# re-enable motd-news
134motd_news_config="/etc/default/motd-news"
135if [ ! -e ${motd_news_config} ]; then
136 if [ ! -e ${motd_news_config}.dpkg-remove ]; then
137 if [ ! -e ${motd_news_config}.dpkg-backup ]; then
138 touch ${motd_news_config}.wasremoved
139 fi
140 fi
141fi
142
130# Manually inject expected maintainer script contents based on dh_systemd_*143# Manually inject expected maintainer script contents based on dh_systemd_*
131144
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.
@@ -147,3 +160,9 @@ if [ -d /run/systemd/system ]; then
147 systemctl --system daemon-reload >/dev/null || true160 systemctl --system daemon-reload >/dev/null || true
148 deb-systemd-invoke start motd-news.timer >/dev/null || true161 deb-systemd-invoke start motd-news.timer >/dev/null || true
149fi162fi
163
164if dpkg-maintscript-helper supports rm_conffile; then
165 dpkg-maintscript-helper rm_conffile /etc/default/motd-news 9.4ubuntu4.13~ base-files -- "$@"
166fi
167
168exit 0
diff --git a/debian/postrm b/debian/postrm
index a763f0d..5f1a281 100644
--- a/debian/postrm
+++ b/debian/postrm
@@ -19,3 +19,9 @@ if [ "$1" = "purge" ]; then
19 deb-systemd-helper unmask 'motd-news.timer' >/dev/null || true19 deb-systemd-helper unmask 'motd-news.timer' >/dev/null || true
20 fi20 fi
21fi21fi
22
23if dpkg-maintscript-helper supports rm_conffile; then
24 dpkg-maintscript-helper rm_conffile /etc/default/motd-news 9.4ubuntu4.13~ base-files -- "$@"
25fi
26
27exit 0
diff --git a/debian/preinst b/debian/preinst
22new file mode 10064428new file mode 100644
index 0000000..6b96fc1
--- /dev/null
+++ b/debian/preinst
@@ -0,0 +1,34 @@
1#!/bin/sh
2# preinst script for base-files
3#
4# see: dh_installdeb(1)
5
6set -e
7
8# summary of how this script can be called:
9# * <new-preinst> `install'
10# * <new-preinst> `install' <old-version>
11# * <new-preinst> `upgrade' <old-version>
12# * <old-preinst> `abort-upgrade' <new-version>
13# for details, see https://www.debian.org/doc/debian-policy/ or
14# the debian-policy package
15
16
17case "$1" in
18 install|upgrade)
19 ;;
20
21 abort-upgrade)
22 ;;
23
24 *)
25 echo "preinst called with unknown argument \`$1'" >&2
26 exit 1
27 ;;
28esac
29
30if dpkg-maintscript-helper supports rm_conffile; then
31 dpkg-maintscript-helper rm_conffile /etc/default/motd-news 9.4ubuntu4.13~ base-files -- "$@"
32fi
33
34exit 0
diff --git a/debian/rules b/debian/rules
index 0ca88d0..682cbf5 100755
--- a/debian/rules
+++ b/debian/rules
@@ -25,10 +25,10 @@ build:
25clean:25clean:
26 rm -f build26 rm -f build
27 rm -f `find . -name "*~"`27 rm -f `find . -name "*~"`
28 rm -rf debian/tmp debian/lsb-release-udeb debian/files* core debian/substvars28 rm -rf debian/tmp debian/lsb-release-udeb debian/files* core debian/substvars debian/motd-news-config
2929
30binary-arch: build30binary-arch: build
31 rm -rf debian/tmp31 rm -rf debian/tmp debian/motd-news-config
32 install -d debian/tmp/DEBIAN $(docdir) debian/tmp/etc/dpkg/origins32 install -d debian/tmp/DEBIAN $(docdir) debian/tmp/etc/dpkg/origins
33 install -p -m 644 origins/* debian/tmp/etc/dpkg/origins33 install -p -m 644 origins/* debian/tmp/etc/dpkg/origins
34 cd debian/tmp && install -d usr/share/$(package)34 cd debian/tmp && install -d usr/share/$(package)
@@ -42,7 +42,7 @@ binary-arch: build
42 sed -e "s/#VENDORFILE#/$(VENDORFILE)/g" debian/postinst.in \42 sed -e "s/#VENDORFILE#/$(VENDORFILE)/g" debian/postinst.in \
43 > debian/tmp/DEBIAN/postinst43 > debian/tmp/DEBIAN/postinst
44 chmod 755 debian/tmp/DEBIAN/postinst44 chmod 755 debian/tmp/DEBIAN/postinst
45 install -m 755 debian/prerm debian/postrm debian/tmp/DEBIAN45 install -m 755 debian/prerm debian/postrm debian/preinst debian/tmp/DEBIAN
46 cd debian && install -m 644 conffiles tmp/DEBIAN46 cd debian && install -m 644 conffiles tmp/DEBIAN
47 cd debian/tmp && install -d `cat ../directory-list`47 cd debian/tmp && install -d `cat ../directory-list`
48 install -p -m 644 share/* debian/tmp/usr/share/base-files48 install -p -m 644 share/* debian/tmp/usr/share/base-files
@@ -55,7 +55,6 @@ binary-arch: build
55 ln -s README $(docdir)/FAQ55 ln -s README $(docdir)/FAQ
56 install -p -m 644 etc/* debian/tmp/etc56 install -p -m 644 etc/* debian/tmp/etc
57 install -p -m 755 debian/update-motd.d/* debian/tmp/etc/update-motd.d57 install -p -m 755 debian/update-motd.d/* debian/tmp/etc/update-motd.d
58 install -p -m 644 debian/motd-news debian/tmp/etc/default
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/
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/
61ifeq ($(DEB_HOST_GNU_SYSTEM),gnu)60ifeq ($(DEB_HOST_GNU_SYSTEM),gnu)
@@ -87,6 +86,22 @@ endif
87 xargs -0r touch -h --date='$(BUILD_DATE)'86 xargs -0r touch -h --date='$(BUILD_DATE)'
88 dpkg-deb --build -Zgzip debian/tmp ..87 dpkg-deb --build -Zgzip debian/tmp ..
8988
89 # motd-news-config packaging
90 install -d debian/motd-news-config/DEBIAN debian/motd-news-config/usr/share/doc/motd-news-config
91 install -d debian/motd-news-config/etc/default
92 install -m 0644 $(docdir)/changelog.gz $(docdir)/copyright debian/motd-news-config/usr/share/doc/motd-news-config
93 cp debian/motd-news-config.postinst debian/motd-news-config/DEBIAN/postinst
94 chmod 0755 debian/motd-news-config/DEBIAN/postinst
95 install -p -m 644 debian/motd-news debian/motd-news-config/etc/default
96 cp debian/motd-news-config.conffiles debian/motd-news-config/DEBIAN/conffiles
97 cd debian/motd-news-config && \
98 find usr -type f ! -regex "DEBIAN/.*" -print0 |\
99 LC_ALL=C sort -z | xargs -0r md5sum > DEBIAN/md5sums
100 chmod 0644 debian/motd-news-config/DEBIAN/conffiles
101 chmod 0644 debian/motd-news-config/DEBIAN/md5sums
102 dpkg-gencontrol -pmotd-news-config -Pdebian/motd-news-config
103 dpkg-deb --build -Zgzip debian/motd-news-config ..
104
90binary-indep: build105binary-indep: build
91 rm -rf debian/lsb-release-udeb106 rm -rf debian/lsb-release-udeb
92 install -d debian/lsb-release-udeb/DEBIAN debian/lsb-release-udeb/etc107 install -d debian/lsb-release-udeb/DEBIAN debian/lsb-release-udeb/etc
diff --git a/debian/update-motd.d/50-motd-news b/debian/update-motd.d/50-motd-news
index 08d7f0d..c9d142f 100644
--- a/debian/update-motd.d/50-motd-news
+++ b/debian/update-motd.d/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