#!/bin/bash -e
# reconfigure: no
# reconfigure-title: Simple Machines Forum Secrets
# reconfigure-description: Regenerate the application database password.
# regenerate simplemachines mysql password

. /etc/default/inithooks

CONF=/var/www/simplemachines/Settings.php
PASSWORD=$(mcookie)
sed -i "s|^\$db_passwd.*|\$db_passwd = '$PASSWORD';|" $CONF
$INITHOOKS_PATH/bin/mysqlconf.py --user=simplemachines --pass="$PASSWORD"

