From b1e75841f4718aba46d609ecc39ad8bff2a3595d Mon Sep 17 00:00:00 2001 From: MrGeneration Date: Thu, 20 Aug 2020 15:47:31 +0200 Subject: [PATCH] Maintenance: explicitly expect zammad user and exit if not found As the restoration script expects specific users and all package installation and source code documentation is talking about "zammad" as a user, we expect this user to be present. If needed users that want to use different user names may have to adjust the scripts. This still should cover over 90% of Zammad installations. This is a preparation commit for Issue #3139. --- contrib/backup/functions | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/contrib/backup/functions b/contrib/backup/functions index be19c4997..eed91755e 100644 --- a/contrib/backup/functions +++ b/contrib/backup/functions @@ -159,6 +159,14 @@ function restore_zammad () { fi if [ "${DB_ADAPTER}" == "postgresql" ]; then + echo "# Checking requirements" + + if ! id "zammad" &> /dev/null; then + echo "# ERROR: User 'zammad' is not present, but should be by default! #" + echo "# Restoration was NOT successfull, exitting ..." + exit 1 + fi + echo "# ... Dropping current database ${DB_NAME}" # This step is only needed for some pgsql dumps, as they don't provide a drop table statement which will cause