-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathminecraft.sh
More file actions
56 lines (45 loc) · 1.92 KB
/
minecraft.sh
File metadata and controls
56 lines (45 loc) · 1.92 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
#!/bin/bash
#
#<UDF name="pass" label="McMyAdmin Password">
# PASS=
#
# Version control: https://github.com/tkulick/stackscripts
#
# Added logging for debug purposes
exec > >(tee -a /root/stackscript.log)
exec 2> >(tee -a /root/stackscript.log >&2)
# Install pre-reqs
export DEBIAN_FRONTEND=noninteractive
apt -q -y install git openjdk-8-jre-headless expect unzip
# Create a user for Spigot
adduser --disabled-password --gecos "" spigot
chown -R spigot:spigot /home/spigot
# Install McMyAdmin
cd /usr/local
wget http://mcmyadmin.com/Downloads/etc.zip
unzip etc.zip; rm etc.zip
su - spigot -c "mkdir /home/spigot/McMyAdmin"
# Setup a Bash script for the install
cat <<EOF >> /home/spigot/McMyAdmin/setup.sh
#!/bin/bash
cd /home/spigot/McMyAdmin
wget -O /home/spigot/McMyAdmin/MCMA2_glibc26_2.zip http://mcmyadmin.com/Downloads/MCMA2_glibc26_2.zip
unzip /home/spigot/McMyAdmin/MCMA2_glibc26_2.zip
rm /home/spigot/McMyAdmin/MCMA2_glibc26_2.zip
chmod +x /home/spigot/McMyAdmin/install.sh
/home/spigot/McMyAdmin/install.sh
/home/spigot/McMyAdmin/MCMA2_Linux_x86_64 -setpass $PASS -configonly -nonotice
tmux new -s McMyAdmin -d /home/spigot/McMyAdmin/MCMA2_Linux_x86_64
EOF
chown -R spigot:spigot /home/spigot
su - spigot -c "chmod +x /home/spigot/McMyAdmin/setup.sh && /home/spigot/McMyAdmin/setup.sh"
# Install and compile!
su - spigot -c "mkdir /home/spigot/BuildTools && mkdir /home/spigot/spigot"
su - spigot -c "wget -O ~/BuildTools/BuildTools.jar https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar"
su - spigot -c "git config --global --unset core.autocrlf"
su - spigot -c "java -jar ~/BuildTools/BuildTools.jar"
# Mark EULA as true and fire up the server
su - spigot -c "java -Xms1G -Xmx1G -XX:+UseConcMarkSweepGC -jar ~/spigot*.jar"
su - spigot -c "sed -i \"s/eula=false/eula=true/\" /home/spigot/eula.txt"
# Move Spigot jar
su - spigot -c "mv /home/spigot/spigot*.jar /home/spigot/McMyAdmin/Minecraft/"