Uploaded image for project: 'XenServer Org'
  1. XenServer Org
  2. XSO-880

message-switch update leaves broken symlinks in /etc/rc.d

    XMLWordPrintable

    Details

    • Internal JIRA Reference:
      XSI-62

      Description

      When message-switch is updated via RPM from the version in 7.4 or below to the version in 7.5 (for example using the 7.5 updates ISO), it leaves broken symbolic links behind:

      /etc/rc.d/rc1.d/K88message-switch
      /etc/rc.d/rc2.d/S12message-switch
      /etc/rc.d/rc3.d/S12message-switch
      /etc/rc.d/rc4.d/S12message-switch
      /etc/rc.d/rc5.d/S12message-switch
      /etc/rc.d/rc6.d/K88message-switch
      /etc/rc.d/rc0.d/K88message-switch
      

      They all point at /etc/rc.d/init.d/message-switch which does not exist anymore since the package switched to systemd units. They don't cause bugs as far as I can tell, but that's still not very clean.

      You could probably have run something like `/sbin/chkconfig --del message-switch` in %post because %post is executed before the old package is removed so the initscript would still have been there (–del doesn't work anymore once the initscript in /etc/rc.d/init.d/ has been removed)

      %post
      %systemd_post message-switch.service
      # upgrade from SysV, see http://0pointer.de/public/systemd-man/daemon.html
      # except %triggerun doesn't work since previous package had no systemd,
      # and don't transition in 2 steps
      if /sbin/chkconfig --level 5 message-switch ; then
        /bin/systemctl --no-reload enable message-switch.service >/dev/null 2>&1 || :
        /sbin/chkconfig --del message-switch >/dev/null 2>&1 || :
      fi

      ... but now it's too late for those who already upgraded. So I guess you should add a more manual step:

      %post
      %systemd_post message-switch.service
      if [ $1 -gt 1 ] ; then
        # upgrade from SysV, see http://0pointer.de/public/systemd-man/daemon.html
        # except %triggerun doesn't work since previous package had no systemd,
        # and don't transition in 2 steps
        if /sbin/chkconfig --level 5 message-switch ; then
          /bin/systemctl --no-reload enable message-switch.service >/dev/null 2>&1 || :
          /sbin/chkconfig --del message-switch >/dev/null 2>&1 || :
        else
          # remove broken symlinks that a previous version of the package may have forgotten to remove
          find /etc/rc.d -name "*message-switch" -delete >/dev/null 2>&1 || :
        fi
      fi

      Disclaimer: this code is untested

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            stormi Samuel Verschelde
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: