diff -Nru base-files-10.1ubuntu2.9/debian/base-files.maintscript base-files-10.1ubuntu2.10/debian/base-files.maintscript --- base-files-10.1ubuntu2.9/debian/base-files.maintscript 2019-09-27 18:24:34.000000000 +0000 +++ base-files-10.1ubuntu2.10/debian/base-files.maintscript 2020-08-13 18:59:47.000000000 +0000 @@ -3,3 +3,5 @@ # Remove the short-lived (within zesty dev cycle) /etc/update-motd.d/50-news file, # which was renamed to /etc/update-motd.d/50-motd-news rm_conffile /etc/update-motd.d/50-news 9.6ubuntu11~ + +rm_conffile /etc/default/motd-news 10.1ubuntu2.10~ base-files diff -Nru base-files-10.1ubuntu2.9/debian/changelog base-files-10.1ubuntu2.10/debian/changelog --- base-files-10.1ubuntu2.9/debian/changelog 2020-08-05 08:14:19.000000000 +0000 +++ base-files-10.1ubuntu2.10/debian/changelog 2020-08-13 18:59:47.000000000 +0000 @@ -1,3 +1,36 @@ +base-files (10.1ubuntu2.10) bionic; urgency=medium + + [ Andreas Hasenack ] + * motd/50-motd-news: don't include uptime in the user-agent string + (LP: #1886572) + * Move the /etc/default/motd-news conffile to the motd-news-config + package (LP: #1888575): + - d/base-files.maintscript: remove /etc/default/motd-news config file + on upgrade + - d/control: break on ubuntu-server << 1.417.5 to force an upgrade if + it is installed, which will pull motd-news-config and the conffile + back in + - d/motd-news-config.postinst: + + handle the upgrade case where the motd-news config file was + changed while it belonged to base-files + + disable motd-news if the config file was removed by hand before + the upgrade + - d/postinst.in: signal the motd-news-config package if the + motd-news config file was removed manually before the upgrade + - d/control: new motd-news-config package, carrying the + configuration file for the /etc/update-motd.d/50-motd-news script. + - d/rules, d/motd-news-config.install: /e/d/motd-news is in the + motd-news-config package now + + [ 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. + + -- Andreas Hasenack Thu, 13 Aug 2020 15:59:47 -0300 + base-files (10.1ubuntu2.9) bionic; urgency=medium * /etc/issue, /etc/issue.net, /etc/lsb-release, /etc/os-release: Bump diff -Nru base-files-10.1ubuntu2.9/debian/control base-files-10.1ubuntu2.10/debian/control --- base-files-10.1ubuntu2.9/debian/control 2019-09-27 18:24:34.000000000 +0000 +++ base-files-10.1ubuntu2.10/debian/control 2020-08-13 18:59:47.000000000 +0000 @@ -14,7 +14,7 @@ Essential: yes Priority: required Replaces: base, miscutils, dpkg (<= 1.15.0) -Breaks: initscripts (<< 2.88dsf-13.3), sendfile (<< 2.1b.20080616-5.2~) +Breaks: initscripts (<< 2.88dsf-13.3), sendfile (<< 2.1b.20080616-5.2~), ubuntu-server (<< 1.417.5) Multi-Arch: foreign Description: Debian base system miscellaneous files This package contains the basic filesystem hierarchy of a Debian system, and @@ -28,3 +28,15 @@ Architecture: all Priority: extra Description: LSB release information + +Package: motd-news-config +Architecture: all +Priority: optional +Breaks: base-files (<< 10.1ubuntu2.10) +Replaces: base-files (<< 10.1ubuntu2.10) +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: Configuration for motd-news shipped in base-files + This package contains the configuration read by the motd-news script + shipped in the base-files package. + . + Install this package if you want motd-news to be enabled. diff -Nru base-files-10.1ubuntu2.9/debian/motd-news-config.install base-files-10.1ubuntu2.10/debian/motd-news-config.install --- base-files-10.1ubuntu2.9/debian/motd-news-config.install 1970-01-01 00:00:00.000000000 +0000 +++ base-files-10.1ubuntu2.10/debian/motd-news-config.install 2020-08-13 18:59:47.000000000 +0000 @@ -0,0 +1 @@ +debian/motd-news etc/default diff -Nru base-files-10.1ubuntu2.9/debian/motd-news-config.postinst base-files-10.1ubuntu2.10/debian/motd-news-config.postinst --- base-files-10.1ubuntu2.9/debian/motd-news-config.postinst 1970-01-01 00:00:00.000000000 +0000 +++ base-files-10.1ubuntu2.10/debian/motd-news-config.postinst 2020-08-13 18:59:47.000000000 +0000 @@ -0,0 +1,55 @@ +#!/bin/sh +# postinst script for motd-news-config +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `configure' +# * `abort-upgrade' +# * `abort-remove' `in-favour' +# +# * `abort-remove' +# * `abort-deconfigure' `in-favour' +# `removing' +# +# for details, see https://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + configure) + # only run on new installs, $2 will be empty then + if [ -z "$2" ]; then + # /e/d/motd-news was moved from pkg:base-files to this package. + # base-files runs rm_conffile which, if it was modified, leaves + # /e/d/motd-news.dpkg-bak around. We want to preserve that *changed* + # config file in this migration, and this is something that + # rm_conffile is not handling. In that case, let's put the backup + # file back in place + if [ -e /etc/default/motd-news.dpkg-bak ]; then + mv /etc/default/motd-news.dpkg-bak /etc/default/motd-news + fi + if [ -e /etc/default/motd-news.wasremoved ] && [ -e /etc/default/motd-news ]; then + 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 + rm /etc/default/motd-news.wasremoved + fi + fi + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 diff -Nru base-files-10.1ubuntu2.9/debian/postinst.in base-files-10.1ubuntu2.10/debian/postinst.in --- base-files-10.1ubuntu2.9/debian/postinst.in 2019-09-27 18:24:34.000000000 +0000 +++ base-files-10.1ubuntu2.10/debian/postinst.in 2020-08-13 18:59:47.000000000 +0000 @@ -125,4 +125,17 @@ fi fi +# special case of having /etc/default/motd-news removed by hand +# signal the motd-news-config package that this happened, so that +# it does not put back the file with default contents which would +# re-enable motd-news +motd_news_config="/etc/default/motd-news" +if [ ! -e ${motd_news_config} ]; then + if [ ! -e ${motd_news_config}.dpkg-remove ]; then + if [ ! -e ${motd_news_config}.dpkg-backup ]; then + touch ${motd_news_config}.wasremoved + fi + fi +fi + #DEBHELPER# diff -Nru base-files-10.1ubuntu2.9/debian/rules base-files-10.1ubuntu2.10/debian/rules --- base-files-10.1ubuntu2.9/debian/rules 2019-09-27 18:24:34.000000000 +0000 +++ base-files-10.1ubuntu2.10/debian/rules 2020-08-13 18:59:47.000000000 +0000 @@ -24,7 +24,6 @@ override_dh_auto_install: install -p -m 644 etc/* $(DESTDIR)/etc - install -p -m 644 debian/motd-news $(DESTDIR)/etc/default install -p -m 644 debian/motd-news.service $(DESTDIR)/lib/systemd/system/ install -p -m 644 debian/motd-news.timer $(DESTDIR)/lib/systemd/system/ install -p -m 644 licenses/* $(DESTDIR)/usr/share/common-licenses diff -Nru base-files-10.1ubuntu2.9/update-motd.d/50-motd-news base-files-10.1ubuntu2.10/update-motd.d/50-motd-news --- base-files-10.1ubuntu2.9/update-motd.d/50-motd-news 2019-09-27 18:24:34.000000000 +0000 +++ base-files-10.1ubuntu2.10/update-motd.d/50-motd-news 2020-08-13 18:59:47.000000000 +0000 @@ -1,10 +1,11 @@ #!/bin/sh # # 50-motd-news - print the live news from the Ubuntu wire -# Copyright (C) 2016-2017 Canonical Ltd. +# Copyright (C) 2016-2020 Canonical Ltd. # Copyright (C) 2016-2017 Dustin Kirkland # # Authors: Dustin Kirkland +# Steve Langasek # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -64,6 +65,9 @@ # If we've made it here, we've been given the --force argument, # probably from the systemd motd-news.service. Let's update... +# Abort early if wget is missing +[ -x /usr/bin/wget ] || exit 0 + # Generate our temp files, clean up when done NEWS=$(mktemp) || exit 1 ERR=$(mktemp) || exit 1 @@ -73,8 +77,8 @@ # Construct a user agent, similar to Firefox/Chrome/Safari/IE to # ensure a proper, tailored, accurate message of the day -# Curl browser version, for debug purposes -curl_ver="$(dpkg -l curl | awk '$1 == "ii" { print($3); exit(0); }')" +# wget browser version, for debug purposes +wget_ver="$(dpkg -l wget | awk '$1 == "ii" { print($3); exit(0); }')" # Distribution version, for messages releated to this Ubuntu release . /etc/lsb-release @@ -97,12 +101,8 @@ fi fi -# Some messages may only be pertinent before or after some amount of uptime -read up idle < /proc/uptime -uptime="uptime/$up/$idle" - # Piece together the user agent -USER_AGENT="curl/$curl_ver $lsb $platform $cpu $uptime cloud_id/$cloud_id" +USER_AGENT="wget/$wget_ver $lsb $platform $cpu cloud_id/$cloud_id" # Loop over any configured URLs for u in $URLS; do @@ -121,7 +121,18 @@ # If we're forced, set the wait to much higher (1 minute) [ "$FORCED" = "1" ] && WAIT=60 # Fetch and print the news motd - if curl --connect-timeout "$WAIT" --max-time "$WAIT" -A "$USER_AGENT" -o- "$u" >"$NEWS" 2>"$ERR"; then + result=0 + not_found_is_ok=0 + wget --timeout "$WAIT" -U "$USER_AGENT" -O- --content-on-error "$u" >"$NEWS" 2>"$ERR" || result=$? + # from wget's manpage: 8 Server issued an error response. + if [ $result -eq 8 ]; then + if grep -q "ERROR 404" "$ERR"; then + # The server's 404 document is the generic, non cloud-specific, motd-news + # content present in the index.txt file + not_found_is_ok=1 + fi + fi + if [ $result -eq 0 ] || [ $not_found_is_ok -eq 1 ]; then echo # At most, 10 lines of text, remove control characters, print at most 80 characters per line safe_print "$NEWS"