From cae3a3cbe85d1dffcd7a7a964669d2b758561dc0 Mon Sep 17 00:00:00 2001 From: mh Date: Wed, 5 Feb 2014 22:34:17 +0100 Subject: fix #6638 - remove the unless check & improve script To workaround a limitation of the exec provider within puppet, we do the unless check no within the script itself and ensure that we use the password there. https://labs.riseup.net/code/issues/6638 --- files/scripts/CentOS/setmysqlpass.sh | 2 ++ files/scripts/Debian/setmysqlpass.sh | 2 ++ 2 files changed, 4 insertions(+) (limited to 'files/scripts') diff --git a/files/scripts/CentOS/setmysqlpass.sh b/files/scripts/CentOS/setmysqlpass.sh index 870494c..8b468e1 100644 --- a/files/scripts/CentOS/setmysqlpass.sh +++ b/files/scripts/CentOS/setmysqlpass.sh @@ -4,6 +4,8 @@ test -f /root/.my.cnf || exit 1 rootpw=$(grep password /root/.my.cnf | sed -e 's/^[^=]*= *\(.*\) */\1/') +/usr/bin/mysqladmin -uroot --password="${rootpw}" status > /dev/null && echo "Nothing to do as the password already works" && exit 0 + /sbin/service mysqld stop /usr/libexec/mysqld --skip-grant-tables --user=root --datadir=/var/lib/mysql/data --log-bin=/var/lib/mysql/mysql-bin & diff --git a/files/scripts/Debian/setmysqlpass.sh b/files/scripts/Debian/setmysqlpass.sh index 1ef4aaa..ec2c971 100644 --- a/files/scripts/Debian/setmysqlpass.sh +++ b/files/scripts/Debian/setmysqlpass.sh @@ -4,6 +4,8 @@ test -f /root/.my.cnf || exit 1 rootpw=$(grep password /root/.my.cnf | sed -e 's/^[^=]*= *\(.*\) */\1/') +/usr/bin/mysqladmin -uroot --password="${rootpw}" status > /dev/null && echo "Nothing to do as the password already works" && exit 0 + /etc/init.d/mysql stop /usr/sbin/mysqld --skip-grant-tables --user=root --datadir=/var/lib/mysql --log-bin=/var/lib/mysql/mysql-bin & -- cgit v1.2.3