ó FRTc@szdZddlmZddlZddlZddlmZddlmZddl Z dZ defd„ƒYZ dS( sR This installer will install mysql-server on an Ubuntu machine. In addition to the normal installation done by apt-get, it will also configure the new MySQL server to store it's data files in a different location. By default, this is /mnt but that can be configured in the [MySQL] section of the boto config file passed to the instance. iÿÿÿÿ(t InstallerN(t ShellCommand(t ConfigParsers‚ [MySQL] root_password = data_dir = tMySQLcBs&eZd„Zdd„Zd„ZRS(cCs*|jdƒ|jddtdtƒdS(Nsapt-get updatesapt-get -y install mysql-servertnotifyt exit_on_error(truntTrue(tself((sO/opt/freeware/lib/python2.7/site-packages/boto/pyami/installers/ubuntu/mysql.pytinstall-s c Cstjjdddƒ}t}tdƒ}|jƒ|jƒdkrµtjdƒd}x<|jdƒdkr—|dkr—tjdƒ|d }q\W|jd ƒ|jd ƒnt j j |d ƒ}t j j |ƒsö|jd |ƒt }n|jd|ƒtddƒ}|jdƒ|jd|ƒ|jdƒ|jd|ƒ|jdt j j |dƒƒ|jƒ|r£|jd|ƒ|jd ƒnutƒ}|jdƒ|jddƒ}|jd ƒtjdƒd|} x&|j| ƒdkrtjdƒqòWdS(NRtdata_dirs/mntsmysqladmin pingii secho 'quit' | mysql -u rootiis/etc/init.d/mysql stopspkill -9 mysqltmysqlsmkdir %sschown -R mysql:mysql %ss/etc/mysql/conf.d/use_mnt.cnftws# created by pyami s# use the %s volume for data s [mysqld] s datadir = %s s log_bin = %s s mysql-bin.logscp -pr /var/lib/mysql/* %s/s/etc/mysql/debian.cnftclienttpasswordsrecho "GRANT ALL PRIVILEGES ON *.* TO 'debian-sys-maint'@'localhost' IDENTIFIED BY '%s' WITH GRANT OPTION;" | mysql(tbototconfigtgettFalseRRt getStatusttimetsleeptostpathtjointexistsRtopentwritetclosetstartRtread( RRR t fresh_installtis_mysql_running_commandtit mysql_pathtfpt config_parsert grant_command((sO/opt/freeware/lib/python2.7/site-packages/boto/pyami/installers/ubuntu/mysql.pytchange_data_dir8sF   $            cCs|jƒ|jƒdS(N(R R&(R((sO/opt/freeware/lib/python2.7/site-packages/boto/pyami/installers/ubuntu/mysql.pytmaings N(t__name__t __module__R tNoneR&R'(((sO/opt/freeware/lib/python2.7/site-packages/boto/pyami/installers/ubuntu/mysql.pyR+s /( t__doc__t&boto.pyami.installers.ubuntu.installerRRRt boto.utilsRt boto.compatRRt ConfigSectionR(((sO/opt/freeware/lib/python2.7/site-packages/boto/pyami/installers/ubuntu/mysql.pyts