echo ">>> Making postgres"


for VALS in "POSTGRES_VERSION=9.5 REPMGR_VERSION=3.2 REPMGR_SYNTAX_V3=1 REPMGR_PACKAGE_VERSION=3.3.2-1.pgdg80+1" \
            "POSTGRES_VERSION=9.6 REPMGR_VERSION=3.2 REPMGR_SYNTAX_V3=1 REPMGR_PACKAGE_VERSION=3.3.2-1.pgdg80+1" \
            "POSTGRES_VERSION=10 REPMGR_VERSION=3.2 REPMGR_SYNTAX_V3=1 REPMGR_PACKAGE_VERSION=3.3.2-1.pgdg80+1" \
            "POSTGRES_VERSION=9.5 REPMGR_VERSION=4.0 REPMGR_SYNTAX_V4=1 REPMGR_PACKAGE_VERSION=4.0.6-2.pgdg80+1" \
            "POSTGRES_VERSION=9.6 REPMGR_VERSION=4.0 REPMGR_SYNTAX_V4=1 REPMGR_PACKAGE_VERSION=4.0.6-2.pgdg80+1" \
            "POSTGRES_VERSION=10 REPMGR_VERSION=4.0 REPMGR_SYNTAX_V4=1 REPMGR_PACKAGE_VERSION=4.0.6-2.pgdg+1" \
            "POSTGRES_VERSION=11 REPMGR_VERSION=4.0 REPMGR_SYNTAX_V4=1 REPMGR_PACKAGE_VERSION=4.0.6-2.pgdg+1"; do
    eval $VALS
    FILE_FROM="./src/includes/dockerfile/Postgres-$POSTGRES_VERSION-Repmgr-$REPMGR_VERSION.part.Dockerfile"
    FILE_FROM_EXT="./src/includes/dockerfile/Postgres-extended-$POSTGRES_VERSION-Repmgr-$REPMGR_VERSION.part.Dockerfile"

    VALS="POSTGRES_VERSION=$POSTGRES_VERSION"
    FILE_TO="./src/Postgres-$POSTGRES_VERSION-Repmgr-$REPMGR_VERSION.Dockerfile"

    template $FILE_FROM $FILE_TO $VALS

    FILE_TO_EXT="./src/Postgres-extended-$POSTGRES_VERSION-Repmgr-$REPMGR_VERSION.Dockerfile"

    template $FILE_FROM $FILE_TO_EXT $VALS
    template $FILE_FROM_EXT $FILE_TO_EXT

    unset REPMGR_SYNTAX_V4 REPMGR_SYNTAX_V3 POSTGRES_VERSION REPMGR_VERSION REPMGR_PACKAGE_VERSION
done
