We have mariadb-server-10.1 now

This commit is contained in:
Alexandre Aubin 2018-05-08 19:01:25 +02:00
parent 7de61ce8ab
commit 2f0db53d8c
2 changed files with 8 additions and 16 deletions

View file

@ -1,6 +1,7 @@
#!/bin/bash #!/bin/bash
set -e set -e
MYSQL_PKG="mariadb-server-10.1"
do_pre_regen() { do_pre_regen() {
pending_dir=$1 pending_dir=$1
@ -31,19 +32,14 @@ do_post_regen() {
"applications, and is going to reset the MySQL root password." \ "applications, and is going to reset the MySQL root password." \
"You can find this new password in /etc/yunohost/mysql." >&2 "You can find this new password in /etc/yunohost/mysql." >&2
# retrieve MySQL package provider
ynh_package_is_installed "mariadb-server-10.0" \
&& mysql_pkg="mariadb-server-10.0" \
|| mysql_pkg="mysql-server-5.5"
# set new password with debconf # set new password with debconf
sudo debconf-set-selections << EOF sudo debconf-set-selections << EOF
$mysql_pkg mysql-server/root_password password $mysql_password $MYSQL_PKG mysql-server/root_password password $mysql_password
$mysql_pkg mysql-server/root_password_again password $mysql_password $MYSQL_PKG mysql-server/root_password_again password $mysql_password
EOF EOF
# reconfigure Debian package # reconfigure Debian package
sudo dpkg-reconfigure -freadline -u "$mysql_pkg" 2>&1 sudo dpkg-reconfigure -freadline -u "$MYSQL_PKG" 2>&1
else else
echo "It seems that you have already configured MySQL." \ echo "It seems that you have already configured MySQL." \
"YunoHost needs to have a root access to MySQL to runs its" \ "YunoHost needs to have a root access to MySQL to runs its" \

View file

@ -1,4 +1,5 @@
backup_dir="$1/conf/ynh/mysql" backup_dir="$1/conf/ynh/mysql"
MYSQL_PKG="mariadb-server-10.1"
# ensure that mysql is running # ensure that mysql is running
service mysql status >/dev/null 2>&1 \ service mysql status >/dev/null 2>&1 \
@ -23,19 +24,14 @@ sudo mysqladmin -s -u root -p"$curr_pwd" password "$new_pwd" || {
"applications, and is going to reset the MySQL root password." \ "applications, and is going to reset the MySQL root password." \
"You can find this new password in /etc/yunohost/mysql." >&2 "You can find this new password in /etc/yunohost/mysql." >&2
# retrieve MySQL package provider
ynh_package_is_installed "mariadb-server-10.0" \
&& mysql_pkg="mariadb-server-10.0" \
|| mysql_pkg="mysql-server-5.5"
# set new password with debconf # set new password with debconf
sudo debconf-set-selections << EOF sudo debconf-set-selections << EOF
$mysql_pkg mysql-server/root_password password $new_pwd $MYSQL_PKG mysql-server/root_password password $new_pwd
$mysql_pkg mysql-server/root_password_again password $new_pwd $MYSQL_PKG mysql-server/root_password_again password $new_pwd
EOF EOF
# reconfigure Debian package # reconfigure Debian package
sudo dpkg-reconfigure -freadline -u "$mysql_pkg" 2>&1 sudo dpkg-reconfigure -freadline -u "$MYSQL_PKG" 2>&1
} }
# store new root password # store new root password