Skip to content
This repository was archived by the owner on Jan 9, 2018. It is now read-only.

Commit a62ee2b

Browse files
committed
Mac fix for sed -r and date --date
1 parent 15e325a commit a62ee2b

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

installer.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,17 @@ done
5555
VERSION_DATA=$(download_file "http://www.pocketmine.net/api/?channel=$CHANNEL")
5656

5757
VERSION=$(echo "$VERSION_DATA" | grep '"version"' | cut -d ':' -f2- | tr -d ' ",')
58-
BASE_VERSION=$(echo "$VERSION" | sed -r 's/([A-Za-z0-9_\.]*).*/\1/')
5958
BUILD=$(echo "$VERSION_DATA" | grep build | cut -d ':' -f2- | tr -d ' ",')
6059
API_VERSION=$(echo "$VERSION_DATA" | grep api_version | cut -d ':' -f2- | tr -d ' ",')
6160
VERSION_DATE=$(echo "$VERSION_DATA" | grep '"date"' | cut -d ':' -f2- | tr -d ' ",')
62-
VERSION_DATE_STRING=$(date --date="@$VERSION_DATE")
6361
VERSION_DOWNLOAD=$(echo "$VERSION_DATA" | grep '"download_url"' | cut -d ':' -f2- | tr -d ' ",')
62+
if [ "$(uname -s)" == "Darwin" ]; then
63+
BASE_VERSION=$(echo "$VERSION" | sed -E 's/([A-Za-z0-9_\.]*).*/\1/')
64+
VERSION_DATE_STRING=$(date -j -f "%s" $VERSION_DATE)
65+
else
66+
BASE_VERSION=$(echo "$VERSION" | sed -r 's/([A-Za-z0-9_\.]*).*/\1/')
67+
VERSION_DATE_STRING=$(date --date="@$VERSION_DATE")
68+
fi
6469

6570
if [ "$VERSION" == "" ]; then
6671
echo "[ERROR] Couldn't get the latest PocketMine-MP version"

0 commit comments

Comments
 (0)