diff --git a/generate_password.sh b/generate_password.sh index b7a0433..e0819c8 100755 --- a/generate_password.sh +++ b/generate_password.sh @@ -1,23 +1,23 @@ #!/bin/bash -if [ ! -f "db.conf" ]; then - cp db.conf.example db.conf +if [ ! -f "db.env" ]; then + cp db.env.example db.env pw1=$(</dev/urandom tr -dc A-Za-z0-9 | head -c 28) pw2=$(</dev/urandom tr -dc A-Za-z0-9 | head -c 28) - sed -i "/^MYSQL_PASSWORD/c\\\MYSQL_PASSWORD=${pw1}" db.conf - sed -i "/^MYSQL_ROOT_PASSWORD/c\\\MYSQL_ROOT_PASSWORD=${pw2}" db.conf + sed -i "/^MYSQL_PASSWORD/c\\\MYSQL_PASSWORD=${pw1}" db.env + sed -i "/^MYSQL_ROOT_PASSWORD/c\\\MYSQL_ROOT_PASSWORD=${pw2}" db.env else - echo "db.conf already exists!" + echo "db.env already exists!" fi -if [ ! -f "cloud.conf" ]; then - cp cloud.conf.example cloud.conf +if [ ! -f "cloud.env" ]; then + cp cloud.env.example cloud.env pw1=$(</dev/urandom tr -dc A-Za-z0-9 | head -c 28) - sed -i "/^NEXTCLOUD_ADMIN_PASSWORD/c\\\NEXTCLOUD_ADMIN_PASSWORD=${pw1}" cloud.conf + sed -i "/^NEXTCLOUD_ADMIN_PASSWORD/c\\\NEXTCLOUD_ADMIN_PASSWORD=${pw1}" cloud.env else - echo "cloud.conf already exists!" + echo "cloud.env already exists!" fi