This repository was archived by the owner on Aug 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathwiz
executable file
·48 lines (43 loc) · 1.45 KB
/
wiz
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash
##
# Wiz
#
# NOTICE OF LICENSE
#
# This source file is subject to the Open Software License (OSL 3.0)
# http://opensource.org/licenses/osl-3.0.php
#
# DISCLAIMER
#
# This program is provided to you AS-IS. There is no warranty. It has not been
# certified for any particular purpose.
#
# @copyright Copyright (c) 2012 by Classy Llama Studios, LLC
# @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
##
WIZ_PATH="$0";
if [[ -L "$WIZ_PATH" ]]; then
WIZ_PATH="`readlink -n $WIZ_PATH`";
fi
WIZ_DIR="`dirname $WIZ_PATH`";
WIZ_PHP_VERSION="5.2";
# If no valid PHP executable has been set in WIZ_PHP_PATH, iterate PATH looking for one
if [ ! -x "$WIZ_PHP_PATH" ] || [ "`$WIZ_PHP_PATH -r "echo (int) version_compare(PHP_VERSION, '$WIZ_PHP_VERSION', '>=');"`" == "0" ]; then
IFS=:
for i in $PATH; do
if [ -x "$i/php" ]; then
WIZ_PHP_VALID=`$i/php -r "echo (int) version_compare(PHP_VERSION, '$WIZ_PHP_VERSION', '>=');"`
if [ "$WIZ_PHP_VALID" == "1" ]; then
WIZ_PHP_PATH="$i/php"
break;
fi
fi
done
fi
# Validate that we have a valid executable file on our hands and that one has been found.
if [ ! -x "$WIZ_PHP_PATH" ]; then
echo "ERROR: Could not find a PHP executable >= $WIZ_PHP_VERSION. Please set WIZ_PHP_PATH to a valid PHP executable binary and try again."
exit;
fi
# Begin tool execution
$WIZ_PHP_PATH -f "$WIZ_DIR/wiz.php" $@