Skip to content

Recent Alpine build fix actually broke GENERIC_PACKS  #1617

@n1xx1

Description

@n1xx1

Describe the problem

The fix to the awk command made by #1614 broke the sorting. With { print length; print $0 } the output will be 2 lines for every pack, instead of 1 line for every pack. For example:

# find "$base_dir" -maxdepth 3 -type d \( -name mods -o -name plugins -o -name config \) -printf '%h\n' | awk '{ print length; print $0 }' | sort -n -s
.tmp/generic_pack_base/kubejs
.tmp/generic_pack_base
.tmp/generic_pack_base
22
22
29

Instead of:

# find "$base_dir" -maxdepth 3 -type d \( -name mods -o -name plugins -o -name config \) -printf '%h\n' | awk '{ print length, $0 }' | sort -n -s
22 .tmp/generic_pack_base
22 .tmp/generic_pack_base
29 .tmp/generic_pack_base/kubejs

So in the end you will have the wrong $base_dir. Hope it makes sense.

Container definition

version: "3.8"

services:
  server:
    image: itzg/minecraft-server:java17-jdk
    tty: true  
    stdin_open: true
    restart: unless-stopped
    deploy:
      mode: replicated
      replicas: 1
    volumes:
      - data:/data
      - /home/ubuntu/minecraft/modpacks:/modpacks
    networks:
      - minecraft
    environment:
      EULA: "true"
      MEMORY: 4G
      TYPE: FORGE
      DEBUG: "true"
      VERSION: "1.18.2"
      FORGEVERSION: "40.1.68"
      GENERIC_PACKS: /modpacks/Skyopolis+5+New+Server+Files.zip
      FORCE_GENERIC_PACK_UPDATE: "true"
    healthcheck:
      test: ["CMD-SHELL", "mc-health"]
      interval: 5s
      start_period: 2m
      timeout: 10s
      retries: 100

volumes:
  data:

networks:
  minecraft:
    external: true

Container logs

...
[init] 2022-07-20 21:34:42+00:00 Generic pack(s) are out of date. Re-applying...
+ original_base_dir=/data/.tmp/generic_pack_base
+ base_dir=/data/.tmp/generic_pack_base
+ rm -rf /data/.tmp/generic_pack_base
+ mkdir -p /data/.tmp/generic_pack_base
+ for pack in "${packFiles[@]}"
+ isDebugging
+ isTrue true
+ local oldState
++ shopt -po xtrace
+ oldState='set -o xtrace'
+ shopt -u -o xtrace
+ return 0
+ return 0
+ ls -l /modpacks/Skyopolis+5+New+Server+Files.zip
-rw-rw-r-- 1 minecraft minecraft 285390594 Jul 20 15:17 /modpacks/Skyopolis+5+New+Server+Files.zip
+ extract /modpacks/Skyopolis+5+New+Server+Files.zip /data/.tmp/generic_pack_base
+ src=/modpacks/Skyopolis+5+New+Server+Files.zip
+ destDir=/data/.tmp/generic_pack_base
++ file -b --mime-type /modpacks/Skyopolis+5+New+Server+Files.zip
+ type=application/zip
+ case "${type}" in
+ unzip -o -q -d /data/.tmp/generic_pack_base /modpacks/Skyopolis+5+New+Server+Files.zip
++ find /data/.tmp/generic_pack_base -maxdepth 3 -type d '(' -name mods -o -name plugins -o -name config ')' -printf '%h\n'
++ awk '{ print length;print $0 }'
++ sort -n -s
++ cut '-d ' -f2-
++ head -n1
++ xargs echo -n
+ base_dir=/data/.tmp/generic_pack_base/kubejs
+ [[ ! -n /data/.tmp/generic_pack_base/kubejs ]]
+ '[' -f /data/manifest.txt ']'
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions