-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
144 lines (135 loc) · 4.9 KB
/
install.sh
File metadata and controls
144 lines (135 loc) · 4.9 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
#!/bin/bash
# ImagicalMine Installation Script for Mac OS X and Linux(master)
# _ _ _ _______
# | | | | /\ | | |__ __|
# | |__| | / \ | | | |
# | __ | / /\ \ | | | |
# | | | | / ____ \ | |____ | | _
# |_| |_|/_/ \_\|______||_|(_)
#
# This file is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
# Before you start doing anything, read the license for more detail into what you are allowed to do and not do.
l="install_log/log"
le="install_log/log_errors"
lp="install_log/log_php"
lpe="install_log/log_php_errors"
w="install_log/log_wget"
wp="install_log/log_wget_php"
function message() {
# download and include the language file
# in language file you can define variables for each string that should translated
# in this script you can replace the string with the variablename from language file
if [ ! -d "language" ]; then
mkdir "language"
fi
if [ ! -d "install_log" ]; then
mkdir "install_log"
fi
wget https://raw.githubusercontent.com/ImagicalCorp/php-build-scripts/master/language/$o.sh -O language/$o.sh >>./$l 2>>./$le
. language/$o.sh
}
while :
do
clear
cat << "EOF"
_ _ _ __ __ _
(_) (_) | | \/ (_)
_ _ __ ___ __ _ __ _ _ ___ __ _| | \ / |_ _ __ ___
| | '_ ` _ \ / _` |/ _` | |/ __/ _` | | |\/| | | '_ \ / _ \
| | | | | | | (_| | (_| | | (_| (_| | | | | | | | | | __/
|_|_| |_| |_|\__,_|\__, |_|\___\__,_|_|_| |_|_|_| |_|\___|
__/ |
|___/
EOF
echo "system> Welcome to the ImagicalMine installer!"
echo "system> If your language is not listed below, feel free to fork the ImagicalMine/php-build-scripts repository on GitHub and translate it for us, then make a pull request so this installer includes your language."
echo "system> Please choose which language you want to use during the installation:"
echo "system> 1) English"
echo "system> 2) Chinese"
echo "system> 3) German"
echo "system> 4) Exit ImagicalMine installation"
read -e -p "system> Number (e.g. 1): " k
read -e -p "system> Number (e.g. 1): " k </dev/tty
case "$k" in
1 ) o="en"; message "en";;
2 ) o="ch"; message "ch";;
3 ) o="de"; message "de";;
4 ) exit 1;;
* ) echo "error> An unexpected error occurred - you entered an unknown selection. Restart the script, and then choose again."; exit 1;;
esac
# this is how to call the function message and pass the input(selected langugae) as argument
# message "en"
# echo $message_hello_world
echo
echo $language_selected
echo
echo $php_prompt
echo $linux_32
echo $linux_64
echo $mac_32
echo $mac_64
echo $rpi2
echo $exit1
read -e -p "$no_selection" a
read -e -p "$no_selection" a </dev/tty
case "$a" in
1 ) z="PHP_7.0.2_x86_Linux.tar.gz";;
2 ) z="PHP_7.0.2_x86-64_Linux.tar.gz";;
3 ) z="PHP_7.0.2_x86_MacOS.tar.gz";;
4 ) z="PHP_7.0.2_x86-64_MacOS.tar.gz";;
5 ) z="RPI2";;
6 ) exit 1;;
* ) echo $error_selection; exit 1;;
esac
l="install_log/log"
le="install_log/log_errors"
lp="install_log/log_php"
lpe="install_log/log_php_errors"
w="install_log/log_wget"
wp="install_log/log_wget_php"
echo $im_install_echo
wget https://github.com/ImagicalCorp/ImagicalMine/archive/master.zip >>./$w 2>>./$w
chmod 777 master.zip >>./$l 2>>./$le
unzip -o master.zip >>./$l 2>>./$le
chmod 777 ImagicalMine-master >>./$l 2>>./$le
cd ImagicalMine-master >>./$l 2>>./$le
chmod 777 src >>../$l 2>>../$le
cp -rf src .. >>../$l 2>>../$le
cd .. >>../$l 2>>../$le
rm -rf ImagicalMine-master >>./$l 2>>./$le
rm -rf master.zip >>./$l 2>>./$le
wget --no-check-certificate https://raw.githubusercontent.com/ImagicalCorp/ImagicalMine/master/start.sh >>./$l 2>>./$le
chmod 777 start.sh >>./$l 2>>./$le
wget --no-check-certificate https://raw.githubusercontent.com/ImagicalCorp/ImagicalMine/master/LICENSE.md >>./$l 2>>./$le
echo
echo $php_install_echo
if [ "$z" == "RPI2" ];then
wget --no-check-certificate http://forums.imagicalmine.net/bin.zip >>./$wp 2>>./$wp
unzip bin.zip >>./$lp 2>>./$lpe
rm -r bin.zip >>./$lp 2>>./$lpe
else
wget --no-check-certificate https://bintray.com/artifact/download/pocketmine/PocketMine/$z >>./$wp 2>>./$wp
chmod 777 PHP* >>./$lp 2>>./$lpe
tar zxvf PHP* >>./$lp 2>>./$lpe
rm -r PHP* >>./$lp 2>>./$lpe
fi
echo
echo $loop_prompt
echo $yes
echo $no
read -e -p "$no_selection" t
read -e -p "$no_selection" t </dev/tty
case "$t" in
1 ) c="y";;
2 ) c="n";;
* ) echo $error_selection; exit 1;;
esac
if [ "$c" == "y" ]||[ "$c" == "Y" ]; then
sed -i 's/DO_LOOP="no"/DO_LOOP="yes"/' start.sh
else
sed -i 's/DO_LOOP="yes"/DO_LOOP="no"/' start.sh
fi
echo
echo $installation_complete
exit 0
done