]> id.pley.net Git - postfix.git/blobdiff - postfixadmin/setup-postfixadmin.sh
Add a setup step to Dovecot which grants permission to the postfix database to the...
[postfix.git] / postfixadmin / setup-postfixadmin.sh
index b19e9e21575668ebaa693abd9a3188d3951e21f4..11630e07a0d46760366eaa1aedf71f502a122164 100755 (executable)
@@ -9,6 +9,9 @@ if [[ -z "$( mysql -u root -e 'SHOW DATABASES LIKE "postfix"' )" ]]; then
     echo Creating \"postfix\" database.
     mysql -u root -e 'CREATE DATABASE postfix'
     mysql -u root -e 'GRANT ALL PRIVILEGES ON postfix.* TO "postfix"@"localhost"'
+    if [[ -n "$( mysql -u root -e 'SELECT User FROM mysql.user WHERE User = "dovecot"' )" ]]; then
+        mysql -u root -e 'GRANT ALL PRIVILEGES ON postfix.* TO "dovecot"@"localhost"'
+    fi
     mysql -u root -e 'FLUSH PRIVILEGES'
 fi