#!/bin/bash

# Confirms all required php bits are in place or fails

set -e

source "/etc/openshift/node.conf"
source ${CARTRIDGE_BASE_PATH}/abstract/info/lib/util

[ -z "$CARTRIDGE_DIR" ] && CARTRIDGE_DIR="${CARTRIDGE_BASE_PATH}/postgresql-8.4/"

function print_help {
    echo "Usage: customername"
    exit 1
}

function quit {
    echo -e "$1" 1>&2
    exit 5
}

while getopts 'd' OPTION
do
    case $OPTION in
        d) set -x
        ;;
        ?) print_help
        ;;
    esac
done

[ $# -eq 1 ] || print_help

customer=$1

rpm -q php httpd > /dev/null || quit "Missing packages"
[ -d "$CARTRIDGE_DIR" ] || quit "Missing cartridge dir: $CARTRIDGE_DIR"
