Thanks, your responses to the previous two comments are satisfactory and I don't think changes are needed for this SRU for those points.
+ # We should only perform this check on UA version that have the + # ua-messaging.timer: 27.0 until 27.2. This will also guarantee + # that on 27.3 and forward, we will not run this logic. + if dpkg --compare-versions "$PREVIOUS_PKG_VER" ge-nl "27.0~"; then + if dpkg --compare-versions "$PREVIOUS_PKG_VER" lt-nl "27.3~"; then + if [ -x "/usr/bin/deb-systemd-helper" ]; then + if [ -d /run/systemd/system ]; then + if ! deb-systemd-helper --quiet was-enabled $OLD_MESSAGING_TIMER; then This could be written without all the nesting as: if dpkg --compare-versions "$PREVIOUS_PKG_VER" lt "27.0~" \ || dpkg --compare-versions "$PREVIOUS_PKG_VER" ge "27.3~"; then return fi if [ -x "/usr/bin/deb-systemd-helper" ] && [ -d /run/systemd/system ] \ && ! deb-systemd-helper --quiet was-enabled $OLD_MESSAGING_TIMER; then Under what circumstances would deb-systemd-helper not be present? init- system-helpers is part of the minimal task from trusty onwards; it is Essential: yes from bionic onwards; and ubuntu-advantage-tools itself could reasonably declare a dependency on it. What is the expected behavior if we don't have a running systemd (such as in a chroot, and /run/systemd/system is not present)? Why are you short-circuiting in this case, rather than calling deb-systemd-helper and letting it handle these cases? Also, for some reason you are calling deb-systemd-helper *enable*, not disable? I think this should be reduced to: if ! deb-systemd-helper --quiet was-enabled $OLD_MESSAGING_TIMER; then deb-systemd-helper disable $UA_TIMER_NAME > /dev/null 2>&1 || true systemctl stop $UA_TIMER_NAME > /dev/null 2>&1 || true fi the other checks are either superfluous, or actively harmful. -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1942929 Title: [SRU] ubuntu-advantage-tools (27.2.2 -> 27.3) Xenial, Bionic, Focal, Hirsute To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/ubuntu-advantage-tools/+bug/1942929/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs