fluent / fluent-package-builder

td-agent (Fluentd) Building and Packaging System

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

rpm: User is removed at uninstalling, which can cause error at reinstalling

daipom opened this issue · comments

fluent-package v5.0.0 and v5.0.1try to remove User and Group at uninstalling.

the codes in %postun:

if [ $1 -eq 0 ]; then
# Removing
if getent passwd @SERVICE_NAME@ >/dev/null; then
echo "Removing @SERVICE_NAME@ user..."
/usr/sbin/userdel --remove @SERVICE_NAME@
fi
if getent group @SERVICE_NAME@ >/dev/null; then
echo "Removing @SERVICE_NAME@ group..."
/usr/sbin/groupdel @SERVICE_NAME@
fi
if getent passwd @COMPAT_SERVICE_NAME@ >/dev/null; then
echo "Removing @COMPAT_SERVICE_NAME@ user..."
/usr/sbin/userdel --remove @COMPAT_SERVICE_NAME@
fi
if getent group @COMPAT_SERVICE_NAME@ >/dev/null; then
echo "Removing @COMPAT_SERVICE_NAME@ group..."
/usr/sbin/groupdel @COMPAT_SERVICE_NAME@
fi
fi

This behavior is added in the following fix:

It looks like it was influenced by the implementation of apt purge .

For dnf/yum remove, we can't remove User and Group.
The files in /var/log/fluent/ and /etc/fluent/ remain, and they will be used after reinstalling.

If the previous Use or Group is removed, fluent-package creates a new one, and it causes errors in accessing those files.