%define _libexecdir %{_sbindir}
%define _localstatedir /var/lib/%{name}
-%define _mysqlhome /home/services/%{name}
%define mysqldatadir share/mysql/%{mysqlversion}
%define mysqllibdir %{_lib}/mysql/%{mysqlversion}
rm -rf $RPM_BUILD_ROOT
install -d $RPM_BUILD_ROOT/etc/{logrotate.d,rc.d/init.d,sysconfig,mysql/%{mysqlversion},skel} \
$RPM_BUILD_ROOT/var/{log/{archive,}/mysql/%{mysqlversion},lib/{mysql,mysql-files}/%{mysqlversion}} \
- $RPM_BUILD_ROOT%{_mysqlhome} \
$RPM_BUILD_ROOT%{_libdir}
%{__make} -C build install \
%clean
rm -rf $RPM_BUILD_ROOT
-%pre
-%groupadd -g 89 mysql
-%useradd -u 89 -d %{_mysqlhome} -s /bin/false -g mysql -c "%{name} Server" mysql
-
%post
/sbin/ldconfig
/sbin/chkconfig --add %{name}
update-alternatives --remove mysql_upgrade %{_libdir}/mysql/%{mysqlversion}/sbin/mysql_upgrade || :
update-alternatives --remove mysqlcheck %{_libdir}/mysql/%{mysqlversion}/sbin/mysqlcheck || :
update-alternatives --remove mysqld %{_libdir}/mysql/%{mysqlversion}/sbin/mysqld || :
+fi
+
+%pre -n mysql-common
+%groupadd -g 89 mysql
+%useradd -u 89 -d /var/lib/mysql -s /bin/false -g mysql -c "MySQL Server" mysql
+
+%postun -n mysql-common
+if [ "$1" = "0" ]; then
%userremove mysql
%groupremove mysql
fi
%{_datadir}/mysql/%{mysqlversion}/man/man1/*resolve_stack_dump.1*
%endif
-%attr(700,mysql,mysql) %{_mysqlhome}
%attr(640,mysql,mysql) %ghost /var/log/mysql/%{mysqlversion}/*
# This is template for configuration file which is created after 'service mysql init'