mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2024-06-07 19:40:43 +00:00
Use xq for XML parsing instead of inline python
This commit is contained in:
parent
1531e38ab6
commit
511912acc1
@ -18,7 +18,7 @@ RUN apk add --no-cache -U \
|
||||
nano \
|
||||
python python-dev py2-pip
|
||||
|
||||
RUN pip install mcstatus
|
||||
RUN pip install mcstatus yq
|
||||
|
||||
HEALTHCHECK CMD mcstatus localhost:$SERVER_PORT ping
|
||||
|
||||
|
@ -10,20 +10,8 @@ if [[ -z $FABRIC_INSTALLER && -z $FABRIC_INSTALLER_URL ]]; then
|
||||
echo "Checking Fabric version information."
|
||||
case $FABRICVERSION in
|
||||
LATEST)
|
||||
FABRIC_VERSION=$(python - << 'EOF'
|
||||
import sys
|
||||
import xml.etree.ElementTree as ET
|
||||
from contextlib import closing
|
||||
from urllib2 import urlopen
|
||||
|
||||
with closing(urlopen('https://maven.fabricmc.net/net/fabricmc/fabric-installer/maven-metadata.xml')) as resp:
|
||||
xml = resp.read()
|
||||
|
||||
root = ET.fromstring(xml)
|
||||
version = root.find('*/release').text
|
||||
print version
|
||||
EOF
|
||||
)
|
||||
curl -fsSL https://maven.fabricmc.net/net/fabricmc/fabric-installer/maven-metadata.xml | xq -c . > /tmp/fabric.json
|
||||
FABRIC_VERSION=$(< /tmp/fabric.json jq -r ".metadata.versioning.release")
|
||||
;;
|
||||
|
||||
*)
|
||||
|
Loading…
Reference in New Issue
Block a user