Include default installation scripts, as well as ability to symlink a script

This commit is contained in:
Dane Everitt 2017-04-27 16:16:57 -04:00
parent 77b1a258d9
commit 30b4934013
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
12 changed files with 346 additions and 11 deletions

View file

@ -110,6 +110,27 @@ EOF;
private function addCoreOptions()
{
$script = <<<'EOF'
#!/bin/ash
# Vanilla MC Installation Script
#
# Server Files: /mnt/server
apk update
apk add curl
cd /mnt/server
LATEST_VERSION=`curl -s https://s3.amazonaws.com/Minecraft.Download/versions/versions.json | grep -o "[[:digit:]]\.[0-9]*\.[0-9]" | head -n 1`
if [ -z "$VANILLA_VERSION" ] || [ "$VANILLA_VERSION" == "latest" ]; then
DL_VERSION=$LATEST_VERSION
else
DL_VERSION=$VANILLA_VERSION
fi
curl -o ${SERVER_JARFILE} https://s3.amazonaws.com/Minecraft.Download/versions/${DL_VERSION}/minecraft_server.${DL_VERSION}.jar
EOF;
$this->option['vanilla'] = ServiceOption::updateOrCreate([
'service_id' => $this->service->id,
'tag' => 'vanilla',
@ -123,8 +144,27 @@ EOF;
'config_stop' => 'stop',
'config_from' => null,
'startup' => null,
'script_install' => $script,
]);
$script = <<<'EOF'
#!/bin/ash
# Spigot Installation Script
#
# Server Files: /mnt/server
## Only download if a path is provided, otherwise continue.
if [ ! -z "${DL_PATH}" ]; then
apk update
apk add curl
cd /mnt/server
MODIFIED_DOWNLOAD=`eval echo $(echo ${DL_PATH} | sed -e 's/{{/${/g' -e 's/}}/}/g')`
curl -sSL -o ${SERVER_JARFILE} ${MODIFIED_DOWNLOAD}
fi
EOF;
$this->option['spigot'] = ServiceOption::updateOrCreate([
'service_id' => $this->service->id,
'tag' => 'spigot',
@ -138,8 +178,23 @@ EOF;
'config_stop' => null,
'config_from' => $this->option['vanilla']->id,
'startup' => null,
'script_install' => $script,
]);
$script = <<<'EOF'
#!/bin/ash
# Sponge Installation Script
#
# Server Files: /mnt/server
apk update
apk add curl
cd /mnt/server
curl -sSL "https://repo.spongepowered.org/maven/org/spongepowered/spongevanilla/${SPONGE_VERSION}/spongevanilla-${SPONGE_VERSION}.jar" -o ${SERVER_JARFILE}
EOF;
$this->option['sponge'] = ServiceOption::updateOrCreate([
'service_id' => $this->service->id,
'tag' => 'sponge',
@ -153,8 +208,26 @@ EOF;
'config_stop' => null,
'config_from' => $this->option['vanilla']->id,
'startup' => null,
'script_install' => $script,
]);
$script = <<<'EOF'
#!/bin/ash
# Bungeecord Installation Script
#
# Server Files: /mnt/server
apk update
apk add curl
cd /mnt/server
if [ -z "${BUNGEE_VERSION}" ] || [ "${BUNGEE_VERSION}" == "latest" ]; then
BUNGEE_VERSION="lastStableBuild"
fi
curl -o ${SERVER_JARFILE} https://ci.md-5.net/job/BungeeCord/${BUNGEE_VERSION}/artifact/bootstrap/target/BungeeCord.jar
EOF;
$this->option['bungeecord'] = ServiceOption::updateOrCreate([
'service_id' => $this->service->id,
'tag' => 'bungeecord',
@ -168,6 +241,7 @@ EOF;
'config_stop' => 'end',
'config_from' => null,
'startup' => null,
'script_install' => $script,
]);
}