Rewrite/improve start-mysql.sh

- execute lsb_release only once, instead of up to 4
- use a switch case to match distro, makes things easier to read

Change-Id: I4d73424893da979ee4789da3461d1954c0b23548
This commit is contained in:
Pino Toscano 2015-07-07 13:50:44 +02:00
parent 23f07512b6
commit 5132b50b63
1 changed files with 10 additions and 5 deletions

View File

@ -6,8 +6,13 @@ fi
set -eu
set -o pipefail
if [ $(lsb_release -is) = 'Ubuntu' ]; then
sudo service mysql start
elif [ $(lsb_release -is) = 'Fedora' -o $(lsb_release -is) = 'CentOS' -o $(lsb_release -is) = 'RedHatEnterpriseServer' ]; then
sudo service mysqld start
fi
DISTRO="$(lsb_release -is)"
case "$DISTRO" in
Ubuntu )
sudo service mysql start
;;
Fedora | CentOS | RedHatEnterpriseServer )
sudo service mysqld start
;;
esac