2008-08-09 06:38:44 +02:00
|
|
|
# Check for an argument
|
|
|
|
if [ $1 = "" ]; then
|
|
|
|
echo "Sapphire Sake
|
|
|
|
|
|
|
|
Usage: $0 (command-url) (params)
|
|
|
|
Executes a Sapphire command"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Special case for "sake installsake"
|
|
|
|
if [ "$1" = "installsake" ]; then
|
|
|
|
echo "Installing sake to /usr/bin..."
|
|
|
|
cp $0 /usr/bin
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Find the PHP binary
|
2008-08-11 01:29:30 +02:00
|
|
|
for candidatephp in php5 php; do
|
2008-08-09 06:38:44 +02:00
|
|
|
if [ -f `which $candidatephp` ]; then
|
|
|
|
php=`which $candidatephp`
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ "$php" = "" ]; then
|
|
|
|
echo "Can't find any php binary"
|
|
|
|
exit 2
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -d ./sapphire ]; then
|
|
|
|
$php ./sapphire/cli-script.php $1 $2
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -f ./cli-script.php ]; then
|
|
|
|
$php ./cli-script.php $1 $2
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2008-08-11 01:29:30 +02:00
|
|
|
echo "Can't find ./sapphire/cli-script.php or ./cli-script.php"
|