mirror of
https://github.com/chocolate-doom/chocpkg.git
synced 2024-11-10 07:11:39 +00:00
Add support for decompressing .bz2 files.
This should resolve the blocking issue with libmpg321 which is distributed in .tar.bz2 format.
This commit is contained in:
parent
e13fe8f8c5
commit
8782712aaf
1 changed files with 17 additions and 2 deletions
|
@ -3,7 +3,7 @@ fetch_download::init() {
|
|||
PACKAGE_URL=$1
|
||||
PACKAGE_SHA256_DIGEST=$2
|
||||
PACKAGE_FILENAME=$(basename "$PACKAGE_URL")
|
||||
PACKAGE_DIR_NAME="${PACKAGE_FILENAME/.tar.gz/}"
|
||||
PACKAGE_DIR_NAME="${PACKAGE_FILENAME/%.tar.*/}"
|
||||
IS_TAR_BOMB=false
|
||||
}
|
||||
|
||||
|
@ -35,6 +35,21 @@ fetch_download::download_package_file() {
|
|||
fi
|
||||
}
|
||||
|
||||
fetch_download::decompress() {
|
||||
local filename="$1"
|
||||
case "$filename" in
|
||||
*.gz)
|
||||
gunzip < $filename
|
||||
;;
|
||||
*.bz2)
|
||||
bunzip2 < $filename
|
||||
;;
|
||||
*)
|
||||
chocpkg::abort "unknown compression format for filename $filename"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
fetch_download::extract_package_file() {
|
||||
local dlfile="$PACKAGES_DIR/$PACKAGE_FILENAME"
|
||||
# Well-formed tar files contain a single directory that matches their
|
||||
|
@ -47,7 +62,7 @@ fetch_download::extract_package_file() {
|
|||
local parent_dir=$(dirname "$PACKAGE_BUILD_DIR")
|
||||
cd "$parent_dir"
|
||||
fi
|
||||
(gunzip < "$dlfile" | tar -x) || (
|
||||
(fetch_download::decompress "$dlfile" | tar -x) || (
|
||||
mv "$dlfile" "$dlfile.bad"
|
||||
chocpkg::abort "Failed to extract $PACKAGE_FILENAME: bad download?"
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue