Code review comment for ~ahasenack/ubuntu/+source/base-files:groovy-motd-news-config-split

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

> base-files.postinst:
> # user removed the full file, mark that to keep service disabled on conffile take over
> if [ -e /etc/default/motd-news ]; then
> touch /etc/default/motd-news.wasremoved
> fi

I'm assuming you meant "! -e" in the check above, i.e.:
- before rm_conffile kicks in (#DEBHELPER#)
- if /e/d/motd-news isn't there, then it's because the user removed it

I have this in debian/postinst.in:
(...)
# 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_config="/etc/default/motd-news"
ls -la "$motd_config" || :
if [ ! -e /etc/default/motd-news ]; then
  touch /etc/default/motd-news.wasremoved
fi

#DEBHELPER#

The "ls -la" is a debug statement.

I start with only base-files 11ubuntu10 installed (the current groovy version), and an unmodified /etc/default/motd-news file. Here is dpkg -i of the new base-files and new motd-news-config:

$ sudo dpkg -i ../*.deb 2>&1 | tee ../dpkg-i.log
(Reading database ... 36078 files and directories currently installed.)
Preparing to unpack .../base-files_11ubuntu11_amd64.deb ...
Warning: Stopping motd-news.service, but it can still be activated by:
  motd-news.timer
Unpacking base-files (11ubuntu11) over (11ubuntu10) ...
Selecting previously unselected package motd-news-config.
Preparing to unpack .../motd-news-config_11ubuntu11_all.deb ...
Unpacking motd-news-config (11ubuntu11) ...
Setting up base-files (11ubuntu11) ...
+ [ ! -e /etc/dpkg/origins/default ]
+ [ configure = configure ]
+ [ 11ubuntu10 = ]
+ [ ! -d /var/lib/dpkg ]
+ [ ! -f /var/lib/dpkg/status ]
+ [ ! -f /usr/info/dir ]
+ [ ! -f /usr/share/info/dir ]
+ [ configure = configure ]
+ [ 11ubuntu10 != ]
+ rm -f /var/lib/update-notifier/release-upgrade-available
+ [ -x /usr/lib/update-manager/check-new-release ]
+ update_to_current_default profile /etc/profile
+ [ -f /etc/profile ]
+ md5sum /etc/profile
+ cut -f 1 -d
+ md5=9d5ee34149287021622dd9e21c17ec26
+ grep -q 9d5ee34149287021622dd9e21c17ec26 /usr/share/base-files/profile.md5sums
+ cmp -s /usr/share/base-files/profile /etc/profile
+ update_to_current_default dot.profile /root/.profile
+ [ -f /root/.profile ]
+ md5sum /root/.profile
+ cut -f 1 -d
+ md5=d68ce7c7d7d2bb7d48aeb2f137b828e4
+ grep -q d68ce7c7d7d2bb7d48aeb2f137b828e4 /usr/share/base-files/dot.profile.md5sums
+ dpkg --compare-versions 11ubuntu10 lt-nl 7.7
+ motd_config=/etc/default/motd-news
+ ls -la /etc/default/motd-news
ls: cannot access '/etc/default/motd-news': No such file or directory
+ :
+ [ ! -e /etc/default/motd-news ]
+ touch /etc/default/motd-news.wasremoved
+ [ configure = configure ]
+ deb-systemd-helper unmask motd-news.timer
+ deb-systemd-helper --quiet was-enabled motd-news.timer
+ deb-systemd-helper enable motd-news.timer
+ [ configure = configure ]
+ [ -d /run/systemd/system ]
+ systemctl --system daemon-reload
+ deb-systemd-invoke start motd-news.timer
+ [ configure = configure ]
+ [ -d /run/systemd/system ]
+ systemctl --system daemon-reload
+ deb-systemd-invoke start motd-news.service
motd-news.service is a disabled or a static unit, not starting it.
+ dpkg-maintscript-helper rm_conffile /etc/default/motd-news 11ubuntu11~ base-files -- configure 11ubuntu10
Removing obsolete conffile /etc/default/motd-news ...
Setting up motd-news-config (11ubuntu11) ...
+ [ -z ]
+ [ -e /etc/default/motd-news.dpkg-bak ]
+ [ -e /etc/default/motd-news.wasremoved ]
+ sed -i -e s/^ENABLED=1/#Config file was removed for pkg:base-files - do not re-enable\nENABLED=0/ /etc/default/motd-news
+ rm /etc/default/motd-news.wasremoved
+ exit 0
Processing triggers for plymouth-theme-ubuntu-text (0.9.4git20200323-0ubuntu6) ...
update-initramfs: deferring update (trigger activated)
Processing triggers for install-info (6.7.0.dfsg.2-5) ...
install-info: warning: no info dir entry in `/usr/share/info/automake-history.info.gz'
Processing triggers for man-db (2.9.3-2) ...
Processing triggers for initramfs-tools (0.137ubuntu10) ...

/etc/default/motd-news isn't there at postinst time. Note how rm_conffile is run after, and correctly determines it's an obsolete conffile that can be removed

UPDATE

aha, it's dpkg-maintscripthelper. It renames /e/d/motd-news to motd-news.dpkg-remove in preparation for its removal in base-files.preinst, a script that does not exist in the src:base-files package, but since we are using dpkg-maintscripthelper, it's created at package build time.

« Back to merge proposal