2020-07-29 17:44:30 +02:00
|
|
|
#!/bin/sh
|
2020-07-29 18:05:27 +02:00
|
|
|
cd "$(dirname "$0")" || exit
|
2020-07-29 17:44:30 +02:00
|
|
|
case $1 in
|
|
|
|
install)
|
|
|
|
if ! [ -d "$HOME/.mpt" ];
|
|
|
|
then mkdir $HOME/.mpt
|
|
|
|
fi
|
|
|
|
if ! [ -f "$HOME/.mpt/mpt.jar" ];
|
|
|
|
then
|
2020-08-21 23:44:38 +02:00
|
|
|
dl=$(curl https://data.tilera.xyz/api/mpt.php/latest)
|
2020-07-29 17:44:30 +02:00
|
|
|
echo Downloading $dl ...
|
2020-08-09 00:00:45 +02:00
|
|
|
curl $dl --output $HOME/.mpt/mpt.jar
|
2020-07-29 17:44:30 +02:00
|
|
|
fi
|
|
|
|
;;
|
2020-07-29 18:05:27 +02:00
|
|
|
update)
|
2020-08-21 23:44:38 +02:00
|
|
|
dl=$(curl https://data.tilera.xyz/api/mpt.php/latest)
|
2020-07-29 18:05:27 +02:00
|
|
|
echo Downloading $dl ...
|
2020-07-29 23:34:44 +02:00
|
|
|
if [ -f ".mpt/mpt.jar" ]
|
2020-07-29 18:05:27 +02:00
|
|
|
then
|
2020-08-09 00:00:45 +02:00
|
|
|
curl $dl --output .mpt/mpt.jar
|
2020-07-29 18:05:27 +02:00
|
|
|
else
|
2020-08-09 00:00:45 +02:00
|
|
|
curl $dl --output $HOME/.mpt/mpt.jar
|
2020-07-29 18:05:27 +02:00
|
|
|
fi
|
2020-07-29 23:34:44 +02:00
|
|
|
echo Updating Script
|
2020-08-21 23:44:38 +02:00
|
|
|
curl https://data.tilera.xyz/api/mpt.php/script > mpt
|
2020-07-29 18:05:27 +02:00
|
|
|
;;
|
2020-07-29 17:44:30 +02:00
|
|
|
*)
|
|
|
|
if ! [ -d ".mpt" ];
|
|
|
|
then mkdir .mpt
|
|
|
|
fi
|
2020-07-29 23:34:44 +02:00
|
|
|
if [ -f ".mpt/mpt.jar" ];
|
2020-07-29 17:44:30 +02:00
|
|
|
then jar=.mpt/mpt.jar
|
2020-07-29 23:34:44 +02:00
|
|
|
elif [ -f "$HOME.mpt/mpt.jar" ];
|
|
|
|
then jar=$HOME.mpt/mpt.jar
|
2020-07-29 17:44:30 +02:00
|
|
|
else
|
2020-08-21 23:44:38 +02:00
|
|
|
dl=$(curl https://data.tilera.xyz/api/mpt.php/latest)
|
2020-07-29 17:44:30 +02:00
|
|
|
echo Downloading $dl ...
|
2020-08-09 00:00:45 +02:00
|
|
|
curl $dl --output .mpt/mpt.jar
|
2020-07-29 17:44:30 +02:00
|
|
|
jar=.mpt/mpt.jar
|
|
|
|
fi
|
|
|
|
java -jar $jar $*
|
|
|
|
;;
|
2020-08-09 00:00:45 +02:00
|
|
|
esac
|