diff options
author | Sergei Golubchik <sergii@pisem.net> | 2012-05-25 21:08:26 +0200 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2012-05-25 21:08:26 +0200 |
commit | 108265bd9e17f19a6bcae7a68d6e1b63dc349783 (patch) | |
tree | e751f55b442468048bc2028449a6b82aad355b70 /support-files/rpm | |
parent | be0d1179a87298a6ffc02e55a12e8e3a38d1e3c8 (diff) | |
download | mariadb-git-108265bd9e17f19a6bcae7a68d6e1b63dc349783.tar.gz |
MDEV-295 Do NOT start mysql when installing MariaDB rpms
but restart it on upgrade, if it was already running
Diffstat (limited to 'support-files/rpm')
-rw-r--r-- | support-files/rpm/server-postin.sh | 16 | ||||
-rw-r--r-- | support-files/rpm/server-postun.sh | 7 | ||||
-rw-r--r-- | support-files/rpm/server-prein.sh | 7 | ||||
-rw-r--r-- | support-files/rpm/server-preun.sh | 8 |
4 files changed, 15 insertions, 23 deletions
diff --git a/support-files/rpm/server-postin.sh b/support-files/rpm/server-postin.sh index 49a8253ceef..88ff059ff22 100644 --- a/support-files/rpm/server-postin.sh +++ b/support-files/rpm/server-postin.sh @@ -4,8 +4,10 @@ mysql_datadir=%{mysqldatadir} mkdir -p $mysql_datadir/{mysql,test} # Make MySQL start/shutdown automatically when the machine does it. -if [ -x /sbin/chkconfig ] ; then - /sbin/chkconfig --add mysql +if [ $1 = 1 ] ; then + if [ -x /sbin/chkconfig ] ; then + /sbin/chkconfig --add mysql + fi fi # Create a MySQL user and group. Do not report any problems if it already @@ -65,13 +67,3 @@ if [ -x sbin/restorecon ] ; then sbin/restorecon -R var/lib/mysql fi -# Restart in the same way that mysqld will be started normally. -if [ -x %{_sysconfdir}/init.d/mysql ] ; then - %{_sysconfdir}/init.d/mysql start - echo "Giving mysqld 2 seconds to start" - sleep 2 -fi - -# Allow safe_mysqld to start mysqld and print a message before we exit -sleep 2 - diff --git a/support-files/rpm/server-postun.sh b/support-files/rpm/server-postun.sh new file mode 100644 index 00000000000..652d59154ae --- /dev/null +++ b/support-files/rpm/server-postun.sh @@ -0,0 +1,7 @@ +if [ $1 -ge 1 ]; then + if [ -x %{_sysconfdir}/init.d/mysql ] ; then + # only restart the server if it was alredy running + %{_sysconfdir}/init.d/mysql status > /dev/null 2>&1 && \ + %{_sysconfdir}/init.d/mysql restart + fi +fi diff --git a/support-files/rpm/server-prein.sh b/support-files/rpm/server-prein.sh index 0a8ac0c5f97..9194f2b0656 100644 --- a/support-files/rpm/server-prein.sh +++ b/support-files/rpm/server-prein.sh @@ -64,10 +64,3 @@ HERE fi fi -# Shut down a previously installed server first -if [ -x %{_sysconfdir}/init.d/mysql ] ; then - %{_sysconfdir}/init.d/mysql stop > /dev/null 2>&1 - echo "Giving mysqld 5 seconds to exit nicely" - sleep 5 -fi - diff --git a/support-files/rpm/server-preun.sh b/support-files/rpm/server-preun.sh index 182be27f1ec..7ef48f1c8d4 100644 --- a/support-files/rpm/server-preun.sh +++ b/support-files/rpm/server-preun.sh @@ -2,10 +2,10 @@ if [ $1 = 0 ] ; then # Stop MySQL before uninstalling it if [ -x %{_sysconfdir}/init.d/mysql ] ; then %{_sysconfdir}/init.d/mysql stop > /dev/null - # Don't start it automatically anymore - if [ -x /sbin/chkconfig ] ; then - /sbin/chkconfig --del mysql - fi + fi + # Don't start it automatically anymore + if [ -x /sbin/chkconfig ] ; then + /sbin/chkconfig --del mysql fi fi |