#!/bin/bash
read -p "Enter new password for mysql root: " -s NewMysqlPassword
echo

#StaticVars
TempPassword=$(cat /opt/Setup/TempMysqlPasswd)
JeninsPlugins="dark-theme ssh-slaves workflow-aggregator locale golang git dark-theme copyartifact ws-cleanup"

#Configure PhpMyAdmin
mysql -u root --password="$TempPassword" < /opt/PhpMyAdmin/sql/create_tables.sql
echo -e "<?php\n\n\$cfg['blowfish_secret'] = '$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)';\n\n?>" >> /opt/PhpMyAdmin/blowfish_secret.inc.php
#Set MysqlPassword
mysql -u root -p$TempPassword -e "ALTER USER 'root'@'localhost' IDENTIFIED BY '$NewMysqlPassword'";
rm /opt/Setup/TempMysqlPasswd