4
sudo apt-get install -qqy debconf-utils python-mysqldb uuid
8
echo $PASSWORD >> /var/lib/ensemble/mysql.passwd
3
sudo apt-get install -qqy debconf-utils python-mysqldb uuid augeas-tools augeas-lenses
5
PASSFILE=/var/lib/ensemble/mysql.passwd
6
if ! [ -f $PASSFILE ] ; then
9
PASSWORD=`cat $PASSFILE`
10
11
echo mysql-server-5.1 mysql-server/root_password password $PASSWORD | debconf-set-selections
11
12
echo mysql-server-5.1 mysql-server/root_password_again password $PASSWORD | debconf-set-selections
13
14
DEBIAN_FRONTEND=noninteractive apt-get -y install -qq mysql-server
15
python -c "data = open('/etc/mysql/my.cnf').read().replace('127.0.0.1', '0.0.0.0'); open('/etc/mysql/my.cnf', 'w').write(data)"
16
unit_id=`echo $ENSEMBLE_UNIT_NAME | cut -d/ -f2`
18
# augeas 0.8.0 and later knows about my.cnf format .. otherwise use ours
19
augvers=`dpkg -l augeas-lenses|awk '/^ii/ {print $3}'`
20
if dpkg --compare-versions $augvers '<' 0.8.0 || \
21
! [ -f /usr/share/augeas/dist/mysql.aug ] ; then
22
echo augeas $augvers needs mysql.aug and inifile.aug file from formula...
23
mv -f /usr/share/augeas/lenses/dist/inifile.aug /var/backups
24
cp -v `dirname $0`/../inifile.aug /usr/share/augeas/lenses/dist
25
cp -v `dirname $0`/../mysql.aug /usr/share/augeas/lenses/dist
27
echo using mysql.aug from $augvers
30
defnode mysqld '/files/etc/mysql/my.cnf/target[. = "mysqld"]'
31
set \$mysqld/server_id $unit_id
32
set \$mysqld/log_bin /var/log/mysql/mysql-bin.log
33
set \$mysqld/default_storage_engine InnoDB
37
service mysql stop || :