Update ghost version retrieval and configure MySQL with random password

This commit is contained in:
fabrice1236 2025-01-08 20:39:23 +01:00
parent 739b47e9c3
commit d402d4a635
2 changed files with 9 additions and 2 deletions

View File

@ -32,7 +32,7 @@ function update_script() {
msg_info "Updating ${APP} LXC"
if command -v ghost &> /dev/null; then
current_version=$(ghost --version | awk '{print $2}') #TO REVIEW
current_version=$(ghost version | grep 'Ghost-CLI version' | awk '{print $3}')
latest_version=$(npm show ghost-cli version)
if [ "$current_version" != "$latest_version" ]; then
msg_info "Updating ${APP} from version $current_version to $latest_version"

View File

@ -31,8 +31,15 @@ $STD ufw allow 'Nginx Full'
# Configure MySQL
msg_info "Configuring MySQL"
$STD mysql -u root -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH 'mysql_native_password' BY 'ghost';"
DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13)
$STD mysql -u root -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH 'mysql_native_password' BY '$DB_PASS';"
$STD mysql -u root -p'ghost' -e "FLUSH PRIVILEGES;"
{
echo "MySQL-Credentials"
echo "Username: root"
echo "Password: $DB_PASS"
} >> ~/mysql.creds
msg_ok "Configured MySQL"