mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-03 00:25:04 +00:00
New directory structure. More powerful startup scripts
This commit is contained in:
61
start.sh
61
start.sh
@ -1,8 +1,61 @@
|
||||
#!/bin/bash
|
||||
DIR="$(cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd)"
|
||||
cd "$DIR"
|
||||
if [ -f ./bin/php5/bin/php ]; then
|
||||
exec ./bin/php5/bin/php -d enable_dl=On PocketMine-MP.php $@
|
||||
else
|
||||
exec php -d enable_dl=On PocketMine-MP.php $@
|
||||
|
||||
DO_LOOP="no"
|
||||
|
||||
while getopts "p:f:l" OPTION; do
|
||||
case $OPTION in
|
||||
p)
|
||||
PHP_BINARY="$OPTARG"
|
||||
;;
|
||||
f)
|
||||
POCKETMINE_FILE="$OPTARG"
|
||||
;;
|
||||
l)
|
||||
DO_LOOP="yes"
|
||||
;;
|
||||
\?)
|
||||
echo "Invalid option: -$OPTION$OPTARG" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ "$PHP_BINARY" == "" ]; then
|
||||
if [ -f ./bin/php5/bin/php ]; then
|
||||
PHP_BINARY="./bin/php5/bin/php"
|
||||
elif [ type php 2>/dev/null ]; then
|
||||
PHP_BINARY=$(type -p php)
|
||||
else
|
||||
echo "Couldn't find a working PHP binary, please use the installer."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$POCKETMINE_FILE" == "" ]; then
|
||||
if [ -f ./src/PocketMine/PocketMine.php ]; then
|
||||
POCKETMINE_FILE="./src/PocketMine/PocketMine.php"
|
||||
elif [ -f ./PocketMine-MP.phar ]; then
|
||||
POCKETMINE_FILE="./PocketMine-MP.phar"
|
||||
else
|
||||
echo "Couldn't find a valid PocketMine-MP installation"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
LOOPS=0
|
||||
|
||||
set +e
|
||||
while [ "$LOOPS" -eq 0 ] || [ "$DO_LOOP" == "yes" ]; do
|
||||
if [ "$DO_LOOP" == "yes" ]; then
|
||||
"$PHP_BINARY" -d enable_dl=On "$POCKETMINE_FILE" $@
|
||||
else
|
||||
exec "$PHP_BINARY" -d enable_dl=On "$POCKETMINE_FILE" $@
|
||||
fi
|
||||
((LOOPS++))
|
||||
done
|
||||
|
||||
if [ ${LOOPS} -gt 1 ]; then
|
||||
echo "Restarted $LOOPS times"
|
||||
fi
|
Reference in New Issue
Block a user