Fixup of systemd service rename

When the old galera was installed, and enabled with "systemctl enable garbd.service",
it created symlink '/etc/systemd/system/garb.service' → '/usr/lib/systemd/system/garbd.service'.

When new galera is installed, the target file of the symlink above no longer exists, and the new service is
'/usr/lib/systemd/system/garb.service'.
So calls for "systemctl start garbd" will fail as none such exists,
and calls for "systemctl start garb" will fail as the old symlink in /etc/systemd takes precedence, and since it's target file does not exist, it reports that such systemd unit does not exist.

By removing the old symlink, the newly installed '/usr/lib/systemd/system/garb.service' is recognized by the systemd again.
And once 'systemctl enable garb.service' is called, it creates symlink:
  '/etc/systemd/system/garbd.service' → '/usr/lib/systemd/system/garb.service'.
so the 'garbd' can be used again too.
This commit is contained in:
Michal Schorm 2024-06-09 09:25:10 +02:00
parent 104ae88424
commit c2a32e82cc

View File

@ -106,6 +106,8 @@ sed -i 's/User=nobody/User=garb/g' %{buildroot}%{_unitdir}/garb.service
%pre
/usr/sbin/useradd -M -r -d /dev/null -s /sbin/nologin -c "Galera Arbitrator Daemon" garb >/dev/null 2>&1 || :
# Fixup after upgrading on system before systemd unit rename
unlink /etc/systemd/system/garb.service || :
%post
/sbin/ldconfig