diff --git a/scripts/start-finalExec b/scripts/start-finalExec index 9cc2c7d007b..8a85e017ce7 100755 --- a/scripts/start-finalExec +++ b/scripts/start-finalExec @@ -5,13 +5,19 @@ isDebugging && set -x if [ -n "$ICON" ]; then - if [ ! -e server-icon.png ] || [ "${OVERRIDE_ICON}" == "TRUE" ]; then + if [ ! -e server-icon.png ] || isTrue "${OVERRIDE_ICON}"; then log "Using server icon from $ICON..." # Not sure what it is yet...call it "img" - curl -sSL -o /tmp/icon.img $ICON - specs=$(identify /tmp/icon.img | awk '{print $2,$3}') - if [ "$specs" = "PNG 64x64" ]; then + if ! get -o /tmp/icon.img "$ICON"; then + log "ERROR: failed to download icon from $ICON" + exit 1 + fi + read -r -a specs < <(identify /tmp/icon.img | awk 'NR == 1 { print $2, $3 }') + if [ "${specs[0]} ${specs[1]}" = "PNG 64x64" ]; then mv /tmp/icon.img /data/server-icon.png + elif [ "${specs[0]}" = GIF ]; then + log "Converting GIF image to 64x64 PNG..." + convert "/tmp/icon.img[0]" -resize 64x64! /data/server-icon.png else log "Converting image to 64x64 PNG..." convert /tmp/icon.img -resize 64x64! /data/server-icon.png diff --git a/tests/setuponlytests/icon-gif-multiframe/docker-compose.yml b/tests/setuponlytests/icon-gif-multiframe/docker-compose.yml new file mode 100644 index 00000000000..b7285da2c71 --- /dev/null +++ b/tests/setuponlytests/icon-gif-multiframe/docker-compose.yml @@ -0,0 +1,22 @@ +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" + ICON: http://web/motion-tween-example.gif + # the following are only used to speed up test execution + TYPE: CUSTOM + CUSTOM_SERVER: /servers/fake.jar + VERSION: 1.18.1 + volumes: + - ./data:/data + - ./fake.jar:/servers/fake.jar diff --git a/tests/setuponlytests/icon-gif-multiframe/fake.jar b/tests/setuponlytests/icon-gif-multiframe/fake.jar new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/setuponlytests/icon-gif-multiframe/verify.sh b/tests/setuponlytests/icon-gif-multiframe/verify.sh new file mode 100644 index 00000000000..3bde55eb98f --- /dev/null +++ b/tests/setuponlytests/icon-gif-multiframe/verify.sh @@ -0,0 +1 @@ +mc-image-helper assert fileExists server-icon.png \ No newline at end of file diff --git a/tests/setuponlytests/icon-gif-multiframe/web/motion-tween-example.gif b/tests/setuponlytests/icon-gif-multiframe/web/motion-tween-example.gif new file mode 100644 index 00000000000..2819ff3226a Binary files /dev/null and b/tests/setuponlytests/icon-gif-multiframe/web/motion-tween-example.gif differ diff --git a/tests/setuponlytests/icon-png-atscale/docker-compose.yml b/tests/setuponlytests/icon-png-atscale/docker-compose.yml new file mode 100644 index 00000000000..a2911d5c730 --- /dev/null +++ b/tests/setuponlytests/icon-png-atscale/docker-compose.yml @@ -0,0 +1,22 @@ +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" + ICON: http://web/4737386_minecraft_squircle_icon.png + # the following are only used to speed up test execution + TYPE: CUSTOM + CUSTOM_SERVER: /servers/fake.jar + VERSION: 1.18.1 + volumes: + - ./data:/data + - ./fake.jar:/servers/fake.jar diff --git a/tests/setuponlytests/icon-png-atscale/fake.jar b/tests/setuponlytests/icon-png-atscale/fake.jar new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/setuponlytests/icon-png-atscale/verify.sh b/tests/setuponlytests/icon-png-atscale/verify.sh new file mode 100644 index 00000000000..3bde55eb98f --- /dev/null +++ b/tests/setuponlytests/icon-png-atscale/verify.sh @@ -0,0 +1 @@ +mc-image-helper assert fileExists server-icon.png \ No newline at end of file diff --git a/tests/setuponlytests/icon-png-atscale/web/4737386_minecraft_squircle_icon.png b/tests/setuponlytests/icon-png-atscale/web/4737386_minecraft_squircle_icon.png new file mode 100644 index 00000000000..bee51ae488b Binary files /dev/null and b/tests/setuponlytests/icon-png-atscale/web/4737386_minecraft_squircle_icon.png differ diff --git a/tests/setuponlytests/icon-png-scale/docker-compose.yml b/tests/setuponlytests/icon-png-scale/docker-compose.yml new file mode 100644 index 00000000000..a2911d5c730 --- /dev/null +++ b/tests/setuponlytests/icon-png-scale/docker-compose.yml @@ -0,0 +1,22 @@ +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" + ICON: http://web/4737386_minecraft_squircle_icon.png + # the following are only used to speed up test execution + TYPE: CUSTOM + CUSTOM_SERVER: /servers/fake.jar + VERSION: 1.18.1 + volumes: + - ./data:/data + - ./fake.jar:/servers/fake.jar diff --git a/tests/setuponlytests/icon-png-scale/fake.jar b/tests/setuponlytests/icon-png-scale/fake.jar new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/setuponlytests/icon-png-scale/verify.sh b/tests/setuponlytests/icon-png-scale/verify.sh new file mode 100644 index 00000000000..3bde55eb98f --- /dev/null +++ b/tests/setuponlytests/icon-png-scale/verify.sh @@ -0,0 +1 @@ +mc-image-helper assert fileExists server-icon.png \ No newline at end of file diff --git a/tests/setuponlytests/icon-png-scale/web/4737386_minecraft_squircle_icon.png b/tests/setuponlytests/icon-png-scale/web/4737386_minecraft_squircle_icon.png new file mode 100644 index 00000000000..9f8da2e5ce0 Binary files /dev/null and b/tests/setuponlytests/icon-png-scale/web/4737386_minecraft_squircle_icon.png differ