修改 pre 和 postun 中对 mysql 用户的处理逻辑

Signed-off-by: herengui <herengui@uniontech.com>
This commit is contained in:
herengui 2021-08-23 13:22:31 +08:00
parent 052b2ee5fd
commit 7d66291b85

View File

@ -7,7 +7,7 @@
%global boost_bundled_version 1.73.0
Name: mysql
Version: 8.0.26
Release: 1
Release: 2
License: GPLv2 with exceptions and LGPLv2 and BSD
Summary: The world's most popular open source database
URL: http://www.mysql.com/
@ -74,9 +74,9 @@ cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/data/mysql/data
rm -rf %{buildroot}
%pre
if ! id %{name} > /dev/null 2>&1;then
useradd -M -s /sbin/nologin %{name}
fi
/usr/sbin/groupadd -g 27 -o -r mysql >/dev/null 2>&1 || :
/usr/sbin/useradd -M -N -g mysql -o -r -d %{_sharedstatedir}/mysql -s /sbin/nologin \
-c "MySQL Server" -u 27 mysql >/dev/null 2>&1 || :
%post
if [ -f %{_prefix}/local/%{name}/support-files/mysql.server > /dev/null 2>&1 ] && [ ! -f %{_initddir}/mysql > /dev/null 2>&1 ];then
@ -105,9 +105,6 @@ if [ "$1" = 0 ];then
fi
%postun
if [ "$1" = 0 ];then
userdel -r %{name} &>/dev/null
fi
%files
%dir %{_prefix}/local/%{name}
@ -116,6 +113,10 @@ fi
%exclude /usr/lib/debug
%changelog
* Mon Aug 23 2021 herengui <herengui@uniontech.com> - 8.0.26-2
- The user mysql should not be deleted when mysql is uninstalled
Set the mysql user/group to use a fixed uid/gid 27
* Mon Aug 2 2021 liwu <liwu13@huawei.com> - 8.0.26-1
- Upgrade mysql to 8.0.26,fix CVES:CVE-2021-2356,CVE-2021-2339,CVE-2021-2354
CVE-2021-2352,CVE-2021-2340