#!/bin/bash

# CLI script for updating a local copy of php in Dreamhost accounts.
#
# Copyright (C) 2006 Sam Bauers
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
#
# or go to http://www.gnu.org/licenses/gpl.txt
#
# @author Sam Bauers
# @version 0.1.5
# @copyright Sam Bauers, 2006
# @license GPL 2.0

echo
echo "=========================================================="
echo "php-update for Dreamhost version 0.1.5"
echo "Copyright (C) 2006 Sam Bauers"
echo "----------------------------------------------------------"
echo "php-update for Dreamhost comes with ABSOLUTELY NO WARRANTY"
echo "This is free software, and you are welcome to redistribute"
echo "it under certain conditions."
echo
echo "See accompanying LICENSE file for details."
echo "=========================================================="
echo

UPDATEDIR=$(dirname $0)

$UPDATEDIR/php-update.php

if [[ -e "$UPDATEDIR/php.cgi" ]] ; then
    echo
    echo "----------------------------------------------------------"
    echo "Finally - attempting to make php.cgi executable"
    echo "----------------------------------------------------------"
    
    chmod 0750 $UPDATEDIR/php.cgi
fi

if [[ -e "$UPDATEDIR/php5.cgi" ]] ; then
    echo
    echo "----------------------------------------------------------"
    echo "Finally - attempting to make php5.cgi executable"
    echo "----------------------------------------------------------"
    
    chmod 0750 $UPDATEDIR/php5.cgi
fi
