|
@@ -11,51 +11,49 @@
|
|
|
#
|
|
|
rm -f /opt/zammad/public/assets/.sprockets-manifest-*.json || true
|
|
|
|
|
|
-#
|
|
|
-# TEMPORARILY DISABLED DUE TO OPEN ISSUES
|
|
|
-#
|
|
|
-# # Ensure database connectivity
|
|
|
-# if [[ -f /opt/zammad/config/database.yml ]]; then
|
|
|
-# DB_HOST="$(grep -m 1 '^[[:space:]]*host:' < /opt/zammad/config/database.yml | sed -e 's/.*host:[[:space:]]*//g')"
|
|
|
-# DB_PORT="$(grep -m 1 '^[[:space:]]*port:' < /opt/zammad/config/database.yml | sed -e 's/.*port:[[:space:]]*//g')"
|
|
|
-# DB_SOCKET="$(grep -m 1 '^[[:space:]]*socket:' < /opt/zammad/config/database.yml | sed -e 's/.*socket:[[:space:]]*//g')"
|
|
|
-# fi
|
|
|
-
|
|
|
-# if [ "${DB_HOST}x" == "x" ]; then
|
|
|
-# DB_HOST="localhost"
|
|
|
-# fi
|
|
|
-
|
|
|
-# if [ -n "$(which psql 2> /dev/null)" ]; then
|
|
|
-# if [ "${DB_PORT}x" == "x" ]; then
|
|
|
-# DB_PORT="5432"
|
|
|
-# fi
|
|
|
-
|
|
|
-# if [ "${DB_SOCKET}x" == "x" ]; then
|
|
|
-# pg_isready -q -h $DB_HOST -p $DB_PORT
|
|
|
-# state=$?
|
|
|
-# else
|
|
|
-# pg_isready -q
|
|
|
-# state=$?
|
|
|
-# fi
|
|
|
-
|
|
|
-# elif [ -n "$(which mysql 2> /dev/null)" ]; then
|
|
|
-# if [ "${DB_PORT}x" == "x" ]; then
|
|
|
-# DB_PORT="3306"
|
|
|
-# fi
|
|
|
-
|
|
|
-# mysqladmin status -h $DB_HOST -P $DB_PORT
|
|
|
-# state=$?
|
|
|
-# fi
|
|
|
+# Ensure database connectivity
|
|
|
+if [[ -f /opt/zammad/config/database.yml ]]; then
|
|
|
+ DB_HOST="$(grep -m 1 '^[[:space:]]*host:' < /opt/zammad/config/database.yml | sed -e 's/.*host:[[:space:]]*//g')"
|
|
|
+ DB_PORT="$(grep -m 1 '^[[:space:]]*port:' < /opt/zammad/config/database.yml | sed -e 's/.*port:[[:space:]]*//g')"
|
|
|
+ DB_USER="$(grep -m 1 '^[[:space:]]*username:' < /opt/zammad/config/database.yml | sed -e 's/.*username:[[:space:]]*//g')"
|
|
|
+ DB_PASS="$(grep -m 1 '^[[:space:]]*password:' < /opt/zammad/config/database.yml | sed -e 's/.*password:[[:space:]]*//g')"
|
|
|
+ DB_SOCKET="$(grep -m 1 '^[[:space:]]*socket:' < /opt/zammad/config/database.yml | sed -e 's/.*socket:[[:space:]]*//g')"
|
|
|
+else
|
|
|
+ # Skip this whole script if we can't find our database file
|
|
|
+ echo "Warning: Could not find database.yml"
|
|
|
+ exit 0
|
|
|
+fi
|
|
|
|
|
|
-# # Check error state to ensure database is online
|
|
|
-# if [[ $state -gt 0 ]]; then
|
|
|
-# echo "!!! ERROR !!!"
|
|
|
-# echo "Your database does not seem to be online!"
|
|
|
-# echo "Please check your configuration in config/database.yml and ensure the configured database server is online."
|
|
|
-# echo "Exiting Zammad package installation / upgrade - try again."
|
|
|
+if [ "${DB_HOST}x" == "x" ]; then
|
|
|
+ DB_HOST="localhost"
|
|
|
+fi
|
|
|
+if [ -n "$(which psql 2> /dev/null)" ]; then
|
|
|
+ if [ "${DB_PORT}x" == "x" ]; then
|
|
|
+ DB_PORT="5432"
|
|
|
+ fi
|
|
|
+ if [ "${DB_SOCKET}x" == "x" ]; then
|
|
|
+ pg_isready -q -h $DB_HOST -p $DB_PORT
|
|
|
+ state=$?
|
|
|
+ else
|
|
|
+ pg_isready -q
|
|
|
+ state=$?
|
|
|
+ fi
|
|
|
+elif [ -n "$(which mysql 2> /dev/null)" ]; then
|
|
|
+ if [ "${DB_PORT}x" == "x" ]; then
|
|
|
+ DB_PORT="3306"
|
|
|
+ fi
|
|
|
+ mysqladmin status -h $DB_HOST -P $DB_PORT -u $DB_USER -p$DB_PASS > /dev/null
|
|
|
+ state=$?
|
|
|
+fi
|
|
|
|
|
|
-# exit 1
|
|
|
-# fi
|
|
|
+# Check error state to ensure database is online
|
|
|
+if [[ $state -gt 0 ]]; then
|
|
|
+ echo "!!! ERROR !!!"
|
|
|
+ echo "Your database does not seem to be online!"
|
|
|
+ echo "Please check your configuration in config/database.yml and ensure the configured database server is online."
|
|
|
+ echo "Exiting Zammad package installation / upgrade - try again."
|
|
|
+ exit 1
|
|
|
+fi
|
|
|
|
|
|
# remove local files of the packages
|
|
|
if [ -n "$(which zammad 2> /dev/null)" ]; then
|