Skip to content

Add unpacking progress when unpacking game.zip on data deploy #4

@voidderef

Description

@voidderef

In GitLab by @icex2 on Jun 19, 2020, 24:59

Because the games get very large and it would be nice to see what unzip is up to, show the progress in regards to number of files processed and total number of files to process, as well as the progress on the current file.

Here is a snippet I created within 10-15 minutes but it doesn't work entirely. When a game is unpacked, some files seem to be broken and the game doesn't start at all. Needs some more time to debug.

unpack_zip_with_progress()
{
    local zip_file="$1"
    local out_dir="$2"

    n_files=$(unzip -Z -1 "$zip_file" | wc -l)
    counter=0

    for f in $(unzip -Z -1 "$zip_file"); do
        counter=$((counter + 1))

        mkdir -p "$out_dir/$(dirname "$f")"
        unzip -o -c "$zip_file" "$f" 2> /dev/null | \
            pv -cN "($counter/$n_files) $(basename "$f")" -s "$(unzip -Z "$zip_file" "$f" | \
            awk '{print $4}')" > "$out_dir/$f"
    done
}

Instead of unzip "$game_zip" -d "$target_ver_dir" > /dev/null in script/data.sh call unpack_zip_with_progress "$game_zip" "$target_ver_dir".

Feel free to grab this issue and fix the above command.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions