From dfbc0b3b83f24e3de9bff47d4a109cc03e5c3550 Mon Sep 17 00:00:00 2001 From: mhoellein Date: Thu, 3 Sep 2020 09:40:46 +0200 Subject: [PATCH] committing changes in /etc made by "apt-get upgrade" Package changes: -base-files 11ubuntu5.1 amd64 +base-files 11ubuntu5.2 amd64 -command-not-found 20.04.2 all +command-not-found 20.04.4 all -libx11-6 2:1.6.9-2ubuntu1 amd64 -libx11-data 2:1.6.9-2ubuntu1 all -libx11-xcb1 2:1.6.9-2ubuntu1 amd64 +libx11-6 2:1.6.9-2ubuntu1.1 amd64 +libx11-data 2:1.6.9-2ubuntu1.1 all +libx11-xcb1 2:1.6.9-2ubuntu1.1 amd64 -python3-commandnotfound 20.04.2 all +python3-commandnotfound 20.04.4 all -ubuntu-minimal 1.450.1 amd64 +ubuntu-minimal 1.450.2 amd64 -ubuntu-standard 1.450.1 amd64 +ubuntu-standard 1.450.2 amd64 --- .etckeeper | 1 - default/motd-news | 19 ------------------- update-motd.d/50-motd-news | 29 ++++++++++++++++++++--------- 3 files changed, 20 insertions(+), 29 deletions(-) delete mode 100644 default/motd-news diff --git a/.etckeeper b/.etckeeper index b5a33b80e..450224aa9 100755 --- a/.etckeeper +++ b/.etckeeper @@ -878,7 +878,6 @@ maybe chmod 0644 'default/irqbalance' maybe chmod 0644 'default/keyboard' maybe chmod 0644 'default/knockd' maybe chmod 0644 'default/locale' -maybe chmod 0644 'default/motd-news' maybe chmod 0644 'default/named' maybe chmod 0644 'default/networkd-dispatcher' maybe chmod 0644 'default/nss' diff --git a/default/motd-news b/default/motd-news deleted file mode 100644 index 434e562f5..000000000 --- a/default/motd-news +++ /dev/null @@ -1,19 +0,0 @@ -# Enable/disable the dynamic MOTD news service -# This is a useful way to provide dynamic, informative -# information pertinent to the users and administrators -# of the local system -ENABLED=1 - -# Configure the source of dynamic MOTD news -# White space separated list of 0 to many news services -# For security reasons, these must be https -# and have a valid certificate -# Canonical runs a service at motd.ubuntu.com, and you -# can easily run one too -URLS="https://motd.ubuntu.com" - -# Specify the time in seconds, you're willing to wait for -# dynamic MOTD news -# Note that news messages are fetched in the background by -# a systemd timer, so this should never block boot or login -WAIT=5 diff --git a/update-motd.d/50-motd-news b/update-motd.d/50-motd-news index 912e7685e..4b0b56a77 100755 --- a/update-motd.d/50-motd-news +++ b/update-motd.d/50-motd-news @@ -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 @@ fi # 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 @@ trap "rm -f $NEWS $ERR $CLOUD" HUP INT QUIT ILL TRAP KILL BUS TERM # 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 @@ if [ -x /usr/bin/cloud-id ]; then 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 @@ for u in $URLS; do # 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" -- 2.43.0