Great testing as always.
I was not looking at re-running your tests, instead I wondered "what could happen" and a less surgical blunt user came to mind that just deleted /etc/default/motd-news which at first achieves the same thing (motd news is off)
I tested that on ubuntu-server and without ubuntu-server.
Without Ubuntu-server it is ok, the file does not come back and stays disabled.
But with Ubuntu-server installed there is nothing rm_conffile of base-files does.
Therefore no artifact is left, and due to that the default file is placed (again) and thereby re-enabling the service :-/
Great testing as always. motd-news which at first achieves the same thing (motd news is off)
I was not looking at re-running your tests, instead I wondered "what could happen" and a less surgical blunt user came to mind that just deleted /etc/default/
I tested that on ubuntu-server and without ubuntu-server.
Without Ubuntu-server it is ok, the file does not come back and stays disabled.
But with Ubuntu-server installed there is nothing rm_conffile of base-files does.
Therefore no artifact is left, and due to that the default file is placed (again) and thereby re-enabling the service :-/
# Working (default)
root@g2:~# bash -x /etc/update- motd.d/ 50-motd- news motd-news ']' motd-news /motd.ubuntu. com /motd.ubuntu. com ']' var/cache/ motd-news motd-news ']'
+ '[' -r /etc/default/
+ . /etc/default/
++ ENABLED=1
++ URLS=https:/
++ WAIT=5
+ '[' 1 = 1 ']'
+ '[' -n https:/
+ '[' -n 5 ']'
+ '[' -n '' ']'
+ CACHE=/
+ '[' '' = --force ']'
+ '[' '' '!=' 1 ']'
+ '[' -r /var/cache/
++ id -u
+ '[' 0 -eq 0 ']'
+ :
+ exit 0
# Remove file (disabled)
root@g2:~# rm /etc/default/ motd-news motd.d/ 50-motd- news motd-news ']'
root@g2:~# bash -x /etc/update-
+ '[' -r /etc/default/
+ '[' '' = 1 ']'
+ exit 0
# Upgrade re-enables
root@g2:~# add-apt-repository ppa:ahasenack/ zomg-2
More info: https:/ /launchpad. net/~ahasenack/ +archive/ ubuntu/ zomg-2
Press [ENTER] to continue or Ctrl-c to cancel adding it.
Hit:1 http:// archive. ubuntu. com/ubuntu groovy InRelease archive. ubuntu. com/ubuntu groovy-updates InRelease archive. ubuntu. com/ubuntu groovy-backports InRelease ppa.launchpad. net/ahasenack/ zomg-2/ ubuntu groovy InRelease [17.5 kB] security. ubuntu. com/ubuntu groovy-security InRelease ppa.launchpad. net/ahasenack/ zomg-2/ ubuntu groovy/main amd64 Packages [3772 B] ppa.launchpad. net/ahasenack/ zomg-2/ ubuntu groovy/main Translation-en [1056 B] ppa.launchpad. net/ahasenack/ zomg-2/ ubuntu groovy/main amd64 ubuntu-server amd64 1.453 [46.8 kB] ppa.launchpad. net/ahasenack/ zomg-2/ ubuntu groovy/main amd64 base-files amd64 11ubuntu11 [88.6 kB] ppa.launchpad. net/ahasenack/ zomg-2/ ubuntu groovy/main amd64 motd-news-config all 11ubuntu11 [32.5 kB] ppa.launchpad. net/ahasenack/ zomg-2/ ubuntu groovy/main amd64 ubuntu-minimal amd64 1.453 [46.9 kB] ppa.launchpad. net/ahasenack/ zomg-2/ ubuntu groovy/main amd64 ubuntu-standard amd64 1.453 [46.9 kB] server_ 1.453_amd64. deb ... files_11ubuntu1 1_amd64. deb ... news-config_ 11ubuntu11_ all.deb ... minimal_ 1.453_amd64. deb ... standard_ 1.453_amd64. deb ... theme-ubuntu- text (0.9.4git202003 23-0ubuntu6) ... motd.d/ 50-motd- news motd-news ']' motd-news /motd.ubuntu. com /motd.ubuntu. com ']' var/cache/ motd-news motd-news ']'
Hit:2 http://
Hit:3 http://
Get:4 http://
Hit:5 http://
Get:6 http://
Get:7 http://
Fetched 22.3 kB in 1s (27.7 kB/s)
Reading package lists... Done
root@g2:~#
root@g2:~#
root@g2:~# apt upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following package was automatically installed and is no longer required:
libfreetype6
Use 'apt autoremove' to remove it.
The following NEW packages will be installed:
motd-news-config
The following packages will be upgraded:
base-files ubuntu-minimal ubuntu-server ubuntu-standard
4 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 262 kB of archives.
After this operation, 45.1 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://
Get:2 http://
Get:3 http://
Get:4 http://
Get:5 http://
Fetched 262 kB in 1s (340 kB/s)
(Reading database ... 31477 files and directories currently installed.)
Preparing to unpack .../ubuntu-
Unpacking ubuntu-server (1.453) over (1.452) ...
Preparing to unpack .../base-
Warning: Stopping motd-news.service, but it can still be activated by:
motd-news.timer
Unpacking base-files (11ubuntu11) over (11ubuntu10) ...
Setting up base-files (11ubuntu11) ...
motd-news.service is a disabled or a static unit, not starting it.
Selecting previously unselected package motd-news-config.
(Reading database ... 31476 files and directories currently installed.)
Preparing to unpack .../motd-
Unpacking motd-news-config (11ubuntu11) ...
Preparing to unpack .../ubuntu-
Unpacking ubuntu-minimal (1.453) over (1.452) ...
Preparing to unpack .../ubuntu-
Unpacking ubuntu-standard (1.453) over (1.452) ...
Setting up motd-news-config (11ubuntu11) ...
Setting up ubuntu-minimal (1.453) ...
Setting up ubuntu-standard (1.453) ...
Setting up ubuntu-server (1.453) ...
Processing triggers for man-db (2.9.3-2) ...
Processing triggers for plymouth-
update-initramfs: deferring update (trigger activated)
Processing triggers for install-info (6.7.0.dfsg.2-5) ...
Processing triggers for initramfs-tools (0.137ubuntu10) ...
root@g2:~# bash -x /etc/update-
+ '[' -r /etc/default/
+ . /etc/default/
++ ENABLED=1
++ URLS=https:/
++ WAIT=5
+ '[' 1 = 1 ']'
+ '[' -n https:/
+ '[' -n 5 ']'
+ '[' -n '' ']'
+ CACHE=/
+ '[' '' = --force ']'
+ '[' '' '!=' 1 ']'
+ '[' -r /var/cache/
+ echo
+ safe_print /var/cache/ motd-news motd-news 011\013\ 014\016- \037'
+ cat /var/cache/
+ head -n 10
+ tr -d '\000-\
+ cut -c -80
+ exit 0
What do you think, does this require a bit more maintscript magic to be covered as well?
other than that things look +1 to me.
Also I like Steves suggestion to stay in one src:package so we only have NEW for the binary.