#!/bin/sh

if [ "$XIVO_VERSION_INSTALLED" \> "2020.02.00" ]; then
    exit 0
fi

# zgrep command with wildcard can't be used for test because exit status corresponds to the last tested file
if grep -s '\[MIGRATE_QUEUEMEMBER\]' /var/log/postgresql/postgresql-11-main.log > /dev/null \
    || grep -s '\[MIGRATE_QUEUEMEMBER\]' /var/log/postgresql/postgresql-11-main.log.1 > /dev/null; then
	cat <<-EOF
	******************************************************************************************
	*   WARNING: Group and queue members with invalid interface were removed                 *
	*                                                                                        *
	*   You MUST check the upgrade log with the following command:                           *
	*   # zgrep -ha '\[MIGRATE_QUEUEMEMBER\]' /var/log/postgresql/postgresql-11-main.log*    *
	******************************************************************************************
	EOF
fi
