Browse code

Merge "Do not hardcode mysql service name when we have a variable for it"

Jenkins authored on 2012/10/03 06:26:23
Showing 1 changed files
... ...
@@ -975,24 +975,25 @@ fi
975 975
 if is_service_enabled mysql; then
976 976
     echo_summary "Configuring and starting MySQL"
977 977
 
978
+    if [[ "$os_PACKAGE" = "deb" ]]; then
979
+        MY_CONF=/etc/mysql/my.cnf
980
+        MYSQL=mysql
981
+    else
982
+        MY_CONF=/etc/my.cnf
983
+        MYSQL=mysqld
984
+    fi
985
+
978 986
     # Start mysql-server
979 987
     if [[ "$os_PACKAGE" = "rpm" ]]; then
980 988
         # RPM doesn't start the service
981
-        start_service mysqld
989
+        start_service $MYSQL
982 990
         # Set the root password - only works the first time
983 991
         sudo mysqladmin -u root password $MYSQL_PASSWORD || true
984 992
     fi
985 993
     # Update the DB to give user ‘$MYSQL_USER’@’%’ full control of the all databases:
986 994
     sudo mysql -uroot -p$MYSQL_PASSWORD -h127.0.0.1 -e "GRANT ALL PRIVILEGES ON *.* TO '$MYSQL_USER'@'%' identified by '$MYSQL_PASSWORD';"
987 995
 
988
-    # Update ``my.cnf`` for some local needs and restart the mysql service
989
-    if [[ "$os_PACKAGE" = "deb" ]]; then
990
-        MY_CONF=/etc/mysql/my.cnf
991
-        MYSQL=mysql
992
-    else
993
-        MY_CONF=/etc/my.cnf
994
-        MYSQL=mysqld
995
-    fi
996
+    # Now update ``my.cnf`` for some local needs and restart the mysql service
996 997
 
997 998
     # Change ‘bind-address’ from localhost (127.0.0.1) to any (0.0.0.0)
998 999
     sudo sed -i '/^bind-address/s/127.0.0.1/0.0.0.0/g' $MY_CONF