Add mysql user with package install (#7220)

Add mysql user & group at the time of installation if there is none.
Also, cleanup post un-installation.
This commit is contained in:
AZaugg 2024-01-24 18:37:34 -08:00 committed by GitHub
parent c6945413a4
commit c929f086ae
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 16 additions and 1 deletions

View File

@ -1,7 +1,7 @@
Summary: MySQL.
Name: mysql
Version: 8.0.35
Release: 2%{?dist}
Release: 3%{?dist}
License: GPLv2 with exceptions AND LGPLv2 AND BSD
Vendor: Microsoft Corporation
Distribution: Mariner
@ -51,6 +51,18 @@ make DESTDIR=%{buildroot} install
%check
make test
%pre
getent group mysql >/dev/null || groupadd -r mysql
getent passwd mysql >/dev/null || useradd -c "mysql" -s /bin/false -g mysql -M -r mysql
%postun
if getent passwd mysql >/dev/null; then
userdel mysql
fi
if getent group mysql >/dev/null; then
groupdel mysql
fi
%files
%defattr(-,root,root)
%license LICENSE router/LICENSE.router
@ -84,6 +96,9 @@ make test
%{_libdir}/pkgconfig/mysqlclient.pc
%changelog
* Wed Jan 10 2024 Andy Zaugg <azaugg@linkedin.com> - 8.0.35-3
- Add mysql user as part of post scripts
* Wed Dec 20 2023 Suresh Thelkar <sthelkar@microsoft.com> - 8.0.35-2
- Patch CVE-2023-46218