mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2024-06-07 19:40:43 +00:00
Handle packwiz bootstrap installer already being present (#1595)
This commit is contained in:
parent
51f1a08f6e
commit
e3a29180fd
@ -23,37 +23,35 @@ if isTrue "${REMOVE_OLD_MODS}" && [ -z "${MODS_FILE}" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# If packwiz url passed, bootstrap packwiz and update mods before other modpack processing
|
# If packwiz url passed, bootstrap packwiz and update mods before other modpack processing
|
||||||
if [[ "${PACKWIZ_URL}" ]]; then
|
if [[ "${PACKWIZ_URL:-}" ]]; then
|
||||||
# Ensure we have the latest packwiz bootstrap installer
|
# Ensure we have the latest packwiz bootstrap installer
|
||||||
latestPackwiz=$(curl -fsSL https://api.github.com/repos/packwiz/packwiz-installer-bootstrap/releases/latest)
|
latestPackwiz=$(curl -fsSL https://api.github.com/repos/packwiz/packwiz-installer-bootstrap/releases/latest)
|
||||||
if [[ -z "${latestPackwiz}" ]]; then
|
if [[ -z "${latestPackwiz}" ]]; then
|
||||||
log "WARNING: Could not retrieve Packwiz bootstrap installer release information"
|
log "WARNING: Could not retrieve Packwiz bootstrap installer release information"
|
||||||
else
|
else
|
||||||
isDebugging && log "Latest packwiz ${latestPackwiz}"
|
isDebugging && log "Latest packwiz ${latestPackwiz}"
|
||||||
latestPackwizVer=$(echo ${latestPackwiz} | jq --raw-output '.tag_name')
|
latestPackwizVer=$(echo "${latestPackwiz}" | jq --raw-output '.tag_name')
|
||||||
latestPackwizUrl=$(echo ${latestPackwiz} | jq --raw-output '.assets[] | select(.name | match("packwiz-installer-bootstrap.jar")) | .url')
|
latestPackwizUrl=$(echo "${latestPackwiz}" | jq --raw-output '.assets[] | select(.name | match("packwiz-installer-bootstrap.jar")) | .url')
|
||||||
: "${PACKWIZ_JAR:=packwiz-installer-bootstrap_${latestPackwizVer}.jar}"
|
: "${PACKWIZ_BOOTSTRAP_JAR:=packwiz-installer-bootstrap_${latestPackwizVer}.jar}"
|
||||||
if [[ ! -e $PACKWIZ_JAR ]]; then
|
if [[ ! -e $PACKWIZ_BOOTSTRAP_JAR ]]; then
|
||||||
log "Downloading Packwiz ${latestPackwizVer}"
|
log "Downloading Packwiz ${latestPackwizVer}"
|
||||||
curl -H "Accept:application/octet-stream" -o "$PACKWIZ_JAR" -fsSL ${latestPackwizUrl}
|
if ! curl -H "Accept:application/octet-stream" -o "$PACKWIZ_BOOTSTRAP_JAR" -fsSL ${latestPackwizUrl}; then
|
||||||
ln -sf "${PACKWIZ_JAR}" packwiz-installer-bootstrap.jar
|
log "ERROR: failed to download Packwiz bootstrap installer"
|
||||||
fi
|
|
||||||
fi
|
|
||||||
if [[ ! -f packwiz-installer-bootstrap.jar ]]; then
|
|
||||||
log "ERROR: Packwiz not available or could not be downloaded from Github!"
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
log "Running packwiz against URL: ${PACKWIZ_URL}"
|
fi
|
||||||
java -jar packwiz-installer-bootstrap.jar -g -s server "${PACKWIZ_URL}"
|
fi
|
||||||
|
log "Running packwiz installer against URL: ${PACKWIZ_URL}"
|
||||||
|
java -jar "${PACKWIZ_BOOTSTRAP_JAR}" -g -s server "${PACKWIZ_URL}"
|
||||||
#if bootstrap download fails, download installer manually - then run without updating
|
#if bootstrap download fails, download installer manually - then run without updating
|
||||||
returnVal=$?
|
returnVal=$?
|
||||||
if [[ $returnVal ]]; then
|
if [[ $returnVal ]]; then
|
||||||
latestPackwizInstaller=$(curl -fsSL https://api.github.com/repos/packwiz/packwiz-installer/releases/latest)
|
latestPackwizInstaller=$(curl -fsSL https://api.github.com/repos/packwiz/packwiz-installer/releases/latest)
|
||||||
latestPackwizInstallerVer=$(echo ${latestPackwizInstaller} | jq --raw-output '.tag_name')
|
latestPackwizInstallerVer=$(echo "${latestPackwizInstaller}" | jq --raw-output '.tag_name')
|
||||||
latestPackwizInstallerUrl=$(echo ${latestPackwizInstaller} | jq --raw-output '.assets[] | select(.name | match("packwiz-installer.jar")) | .url')
|
latestPackwizInstallerUrl=$(echo "${latestPackwizInstaller}" | jq --raw-output '.assets[] | select(.name | match("packwiz-installer.jar")) | .url')
|
||||||
log "Packwiz couldn't update - Downloading Packwiz Installer ${latestPackwizInstallerVer}"
|
log "Packwiz couldn't update - Downloading Packwiz Installer ${latestPackwizInstallerVer}"
|
||||||
curl -H "Accept:application/octet-stream" -o "packwiz-installer.jar" -fsSL ${latestPackwizInstallerUrl}
|
curl -H "Accept:application/octet-stream" -o "packwiz-installer.jar" -fsSL "${latestPackwizInstallerUrl}"
|
||||||
java -jar packwiz-installer-bootstrap.jar -g -bootstrap-no-update -s server "${PACKWIZ_URL}"
|
java -jar "${PACKWIZ_BOOTSTRAP_JAR}" -g -bootstrap-no-update -s server "${PACKWIZ_URL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
21
tests/setuponlytests/packwiz/docker-compose.yml
Normal file
21
tests/setuponlytests/packwiz/docker-compose.yml
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
version: "3"
|
||||||
|
|
||||||
|
services:
|
||||||
|
web:
|
||||||
|
image: nginx
|
||||||
|
volumes:
|
||||||
|
- ./web:/usr/share/nginx/html
|
||||||
|
mc:
|
||||||
|
depends_on:
|
||||||
|
- web
|
||||||
|
image: ${IMAGE_TO_TEST:-itzg/minecraft-server}
|
||||||
|
environment:
|
||||||
|
EULA: "true"
|
||||||
|
SETUP_ONLY: "true"
|
||||||
|
PACKWIZ_URL: http://web/pack.toml
|
||||||
|
TYPE: CUSTOM
|
||||||
|
CUSTOM_SERVER: /servers/fake.jar
|
||||||
|
VERSION: 1.19
|
||||||
|
volumes:
|
||||||
|
- ./data:/data
|
||||||
|
- ./fake.jar:/servers/fake.jar
|
0
tests/setuponlytests/packwiz/fake.jar
Normal file
0
tests/setuponlytests/packwiz/fake.jar
Normal file
1
tests/setuponlytests/packwiz/verify.sh
Normal file
1
tests/setuponlytests/packwiz/verify.sh
Normal file
@ -0,0 +1 @@
|
|||||||
|
mc-image-helper assert fileExists mods/architectury-5.7.28-fabric.jar
|
6
tests/setuponlytests/packwiz/web/index.toml
Normal file
6
tests/setuponlytests/packwiz/web/index.toml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
hash-format = "sha256"
|
||||||
|
|
||||||
|
[[files]]
|
||||||
|
file = "mods/architectury-api.pw.toml"
|
||||||
|
hash = "c20179449fff711afb96ba0eadd3328fbf1aae639082d25d77c9080837685b79"
|
||||||
|
metafile = true
|
@ -0,0 +1,13 @@
|
|||||||
|
name = "Architectury API"
|
||||||
|
filename = "architectury-5.7.28-fabric.jar"
|
||||||
|
side = "both"
|
||||||
|
|
||||||
|
[download]
|
||||||
|
url = "https://cdn.modrinth.com/data/lhGA9TYQ/versions/5.7.28+fabric/architectury-5.7.28-fabric.jar"
|
||||||
|
hash-format = "sha1"
|
||||||
|
hash = "aa38ae9cc2e978e4ec87ff891f7b02ea0c0ee1b8"
|
||||||
|
|
||||||
|
[update]
|
||||||
|
[update.modrinth]
|
||||||
|
mod-id = "lhGA9TYQ"
|
||||||
|
version = "Hf0Bau1j"
|
13
tests/setuponlytests/packwiz/web/pack.toml
Normal file
13
tests/setuponlytests/packwiz/web/pack.toml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
name = "Vanillia Server"
|
||||||
|
author = "itzg"
|
||||||
|
version = "2.0.0"
|
||||||
|
pack-format = "packwiz:1.1.0"
|
||||||
|
|
||||||
|
[index]
|
||||||
|
file = "index.toml"
|
||||||
|
hash-format = "sha256"
|
||||||
|
hash = "1a27b406c3fb6d35167fe659384ab528a6b3f8a66e6c05d593058e646aec591f"
|
||||||
|
|
||||||
|
[versions]
|
||||||
|
fabric = "0.14.8"
|
||||||
|
minecraft = "1.19"
|
@ -40,7 +40,7 @@ setupOnlyMinecraftTest(){
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
start=$(date +%s)
|
start=$(date +%s)
|
||||||
if ! logs=$(docker-compose run mc 2>&1); then
|
if ! logs=$(docker compose run mc 2>&1); then
|
||||||
outputContainerLog "$logs"
|
outputContainerLog "$logs"
|
||||||
result=1
|
result=1
|
||||||
elif [ -f verify.sh ]; then
|
elif [ -f verify.sh ]; then
|
||||||
@ -57,7 +57,7 @@ setupOnlyMinecraftTest(){
|
|||||||
echo "${folder} PASSED in $(delta start)"
|
echo "${folder} PASSED in $(delta start)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
docker-compose down -v --remove-orphans > /dev/null
|
docker compose down -v --remove-orphans >& /dev/null
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
return $result
|
return $result
|
||||||
|
Loading…
Reference in New Issue
Block a user