0
0
Fork 0
mirror of https://github.com/mumble-voip/mumble.git synced 2025-03-14 20:53:06 +00:00
mumble-voip_mumble/.github/actions/install-dependencies/extractWithProgress.sh
Robert Adam c03521593c CI: Introduce GitHub Actions
Now that Travis CI decided to stop offering their services for free, we
had to look for an alternative solution. GitHub Actions seems to fit the
picture really well and has the benefit of being tightly integrated into
GitHub (obviously).

For now only shared builds for Ubuntu 18.04 and 20.04 are included. The
scripts and the framework for also including static builds is part of
this commit as well but as it stands the static build always failed and
therefore it was given up upon for now.

Adding support for other OS will require a few tweaks and a couple of
new scripts but in general the framework was built with this kind of
extension in mind.
2020-11-29 17:40:15 +01:00

46 lines
1.1 KiB
Bash
Executable file

#!/usr/bin/env bash
#
# Copyright 2020 The Mumble Developers. All rights reserved.
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file at the root of the
# Mumble source tree or at <https://www.mumble.info/LICENSE>.
set -e
fromFile="$1"
targetDir="$2"
if [ -z "$fromFile" ]; then
echo "[ERROR]: Missing argument"
exit 1
fi
if [ -z "$targetDir" ]; then
targetDir="."
fi
echo "Extracting from \"$fromFile\" to \"$targetDir\""
echo ""
# Get sizes in bytes
fromSize=$(xz --robot --list "$fromFile" | tail -n -1 | cut -f 4)
toSize=$(xz --robot --list "$fromFile" | tail -n -1 | cut -f 5)
# Convert sizes to KB
toSizeKB=$(expr "$toSize" / 1000)
fromSizeKB=$(expr "$fromSize" / 1000)
echo "Compressed size: $fromSizeKB KB"
echo "Uncompressed size: $toSizeKB KB"
steps=100
checkPointStep=$(expr "$toSizeKB" / "$steps" )
echo ""
# Use gtar instead of tar if available (for MacOS compatibility)
tarExec="tar"
if [ -x "$(command -v gtar)" ]; then
tarExec="gtar"
fi
"$tarExec" -x --record-size=1K --checkpoint="$checkPointStep" --checkpoint-action="echo=%u / $toSize" -f "$fromFile" -C "$targetDir"