#!/bin/bash -e
# regenerate debian-sys-maint mysql password

. /etc/default/inithooks

PASSWORD=$(mcookie | head -c 16)

if [ -f /etc/mysql/debian.cnf ]; then
    $INITHOOKS_PATH/bin/mysqlconf.py --user debian-sys-maint --pass="$PASSWORD"
else
    echo mysql-server-5.5 mysql-server/root_password password $PASSWORD | debconf-set-selections
    echo mysql-server-5.5 mysql-server/root_password_again password $PASSWORD | debconf-set-selections
    dpkg-reconfigure -f noninteractive mysql-server-5.5
fi
