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.
This commit is contained in:
MrGeneration 2020-08-20 15:47:31 +02:00 committed by Thorsten Eckel
parent 43702a7045
commit b1e75841f4

View file

@ -159,6 +159,14 @@ function restore_zammad () {
fi fi
if [ "${DB_ADAPTER}" == "postgresql" ]; then 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}" 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 # This step is only needed for some pgsql dumps, as they don't provide a drop table statement which will cause