This repository was archived by the owner on Jan 9, 2018. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +59
-0
lines changed Expand file tree Collapse file tree 1 file changed +59
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ BRANCH=" master"
4
+ DEVTOOLS=" DevTools.phar"
5
+ CONSOLE_SCRIPT=" https://raw.githubusercontent.com/PocketMine/DevTools/master/src/DevTools/ConsoleScript.php"
6
+
7
+ PHP=" $( which php) "
8
+
9
+ function usage {
10
+ echo " Usage: $0 [-b branch] [-d /path/to/DevTools.phar] [-p /path/to/php] <url>"
11
+ exit 1
12
+ }
13
+
14
+ while getopts " p:b:d:h" opt; do
15
+ case $opt in
16
+ b)
17
+ BRANCH=" $2 "
18
+ ;;
19
+ d)
20
+ DEVTOOLS=" $2 "
21
+ ;;
22
+ p)
23
+ PHP=" $2 "
24
+ ;;
25
+ h)
26
+ usage
27
+ esac
28
+ done
29
+
30
+ shift $( expr $OPTIND - 1 )
31
+ URL=" $1 "
32
+
33
+ if [ " $( $PHP -r ' echo 1;' 2> /dev/null) " != " 1" ]; then
34
+ echo " [*] PHP not found"
35
+ usage
36
+ fi
37
+
38
+ if [ ! -f $DEVTOOLS ]; then
39
+ if [ ! -f " ConsoleScript.php" ]; then
40
+ echo " [*] Downloading ConsoleScript.php"
41
+ wget --no-check-certificate -O - " $CONSOLE_SCRIPT " > ConsoleScript.php
42
+ fi
43
+ DEVTOOLS=" $( pwd) /ConsoleScript.php"
44
+ fi
45
+
46
+ if [ " $URL " == " " ]; then
47
+ usage
48
+ fi
49
+
50
+ git clone -b " $BRANCH " " $URL " plugin
51
+
52
+ cd plugin
53
+ PLUGIN_NAME=$( grep ' name: ' plugin.yml | sed ' s/^[^:]*: \(.*\)$/\1/g' )
54
+ PLUGIN_VERSION=$( grep ' version: ' plugin.yml | sed ' s/^[^:]*: \(.*\)$/\1/g' )
55
+ GIT_COMMIT=" $( git rev-parse HEAD) "
56
+ cd ..
57
+
58
+ $PHP -dphar.readonly=0 " $DEVTOOLS " --make=" ./plugin/" --relative=" ./plugin/" --out " ${PLUGIN_NAME} _v${PLUGIN_VERSION} -${GIT_COMMIT: 0: 8} .phar"
59
+ rm -fr plugin
You can’t perform that action at this time.
0 commit comments