Commit a7a29c82 authored by Andrew Ladlow's avatar Andrew Ladlow
Browse files

mysql: Use debconf to capture user input

parent 412ae90b
#!/bin/sh -e
. /usr/share/debconf/confmodule
while [ -z "$RET" ] ; do
db_input high symbiosis-mysql/admin_password || true
db_go
db_get symbiosis-mysql/admin_password
done
exit 0
......@@ -8,7 +8,7 @@ Standards-Version: 3.9.6
Package: symbiosis-mysql
Architecture: all
Depends: default-mysql-server (>= 1.0.2), ruby, symbiosis-common (>= 2014:0113), ${misc:Depends}
Depends: default-mysql-server (>= 1.0.2), ruby, symbiosis-common (>= 2014:0113), debconf, ${misc:Depends}
Replaces: bytemark-vhost-mysql, symbiosis-monit (<< 2011:1206)
Provides: bytemark-vhost-mysql
Conflicts: bytemark-vhost-mysql
......
......@@ -2,6 +2,8 @@
set -e
. /usr/share/debconf/confmodule
#
# Skip, if we are not in "configure" state
#
......@@ -49,8 +51,8 @@ if grep -qx 'password = ' /etc/mysql/debian.cnf && [ "$(mysql -u root -se "selec
if [ -e /etc/first-boot.d/.mysql.hash ]; then
mysql -u root -e "grant all privileges on *.* to 'admin'@'localhost' identified by password '*$(cat /etc/first-boot.d/.mysql.hash)' with grant option;"
else
read -p "Enter a password for the admin@localhost MySQL user (To be used with phpMyAdmin): " password
mysql -u root -e "grant all privileges on *.* to 'admin'@'localhost' identified by '$password' with grant option;"
db_get symbiosis-mysql/admin_password
mysql -u root -e "grant all privileges on *.* to 'admin'@'localhost' identified by '$RET' with grant option;"
fi
fi
......
if [ "$1" = "purge" -a -e /usr/share/debconf/confmodule ]; then
. /usr/share/debconf/confmodule
db_purge
fi
Template: symbiosis-mysql/admin_password
Type: password
Description: Enter a password for the admin@localhost MySQL user (for phpMyAdmin access).
#!/bin/bash
#
# Hash password "semiconscious malpractice" and store in .mysql.hash file
#
mkdir -p /etc/first-boot.d
echo "semiconscious malpractice" | ruby -n -rdigest -e \
'puts Digest::SHA1.hexdigest(Digest::SHA1.digest($_.chomp)).upcase' > \
/etc/first-boot.d/.mysql.hash
chmod 0600 /etc/first-boot.d/.mysql.hash
......@@ -6,6 +6,8 @@ locales locales/locales_to_be_generated multiselect en_GB.UTF-8 UTF-8
mysql-server-5.5 mysql-server/root_password password semiconscious malpractice
# Repeat password for the MySQL "root" user:
mysql-server-5.5 mysql-server/root_password_again password semiconscious malpractice
# Set password for the MySQL "admin" user for phpMyAdmin access:
symbiosis-mysql symbiosis-mysql/admin_password password semiconscious malpractice
# Password of the database's administrative user:
phpmyadmin phpmyadmin/mysql/admin-pass password semiconscious malpractice
# Password of the database's administrative user:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment