Skip to content

Commit

Permalink
Preliminary support for zstd compression (#210)
Browse files Browse the repository at this point in the history
  • Loading branch information
megastep committed Apr 27, 2020
1 parent 7c6f409 commit 6a9d0e4
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ jobs:
steps:
- name: Install Linux packages
if: runner.os == 'Linux'
run: sudo env DEBIAN_FRONTEND=noninteractive apt-get -qq -y install pbzip2
run: sudo env DEBIAN_FRONTEND=noninteractive apt-get -qq -y install pbzip2 zstd

- name: Install macOS packages
if: runner.os == 'macOS'
run: brew install pbzip2 coreutils
run: brew install pbzip2 coreutils zstd

- name: Checkout Makeself
uses: actions/checkout@v2
Expand Down
11 changes: 10 additions & 1 deletion makeself.sh
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,14 @@ MS_Usage()
echo " --quiet | -q : Do not print any messages other than errors."
echo " --gzip : Compress using gzip (default if detected)"
echo " --pigz : Compress with pigz"
echo " --zstd : Compress with zstd"
echo " --bzip2 : Compress using bzip2 instead of gzip"
echo " --pbzip2 : Compress using pbzip2 instead of gzip"
echo " --xz : Compress using xz instead of gzip"
echo " --lzo : Compress using lzop instead of gzip"
echo " --lz4 : Compress using lz4 instead of gzip"
echo " --compress : Compress using the UNIX 'compress' command"
echo " --complevel lvl : Compression level for gzip pigz xz lzo lz4 bzip2 and pbzip2 (default 9)"
echo " --complevel lvl : Compression level for gzip pigz zstd xz lzo lz4 bzip2 and pbzip2 (default 9)"
echo " --threads thds : Number of threads to be used by compressors that support parallelization."
echo " Omit to use compressor's default. Most useful (and required) for opting"
echo " into xz's threading, usually with '--threads=0' for all available cores."
Expand Down Expand Up @@ -233,6 +234,10 @@ do
COMPRESS=pigz
shift
;;
--zstd)
COMPRESS=zstd
shift
;;
--xz)
COMPRESS=xz
shift
Expand Down Expand Up @@ -500,6 +505,10 @@ pigz)
fi
GUNZIP_CMD="gzip -cd"
;;
zstd)
GZIP_CMD="zstd -$COMPRESS_LEVEL"
GUNZIP_CMD="zstd -cd"
;;
pbzip2)
GZIP_CMD="pbzip2 -c$COMPRESS_LEVEL"
if test $THREADS -ne $DEFAULT_THREADS; then # Leave as the default if threads not indicated
Expand Down
9 changes: 9 additions & 0 deletions test/extracttest
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,15 @@ testPBzip2()
assertEqual $? 0
}

testZstd()
{
# Skip if zstd is not available
which zstd || return
setupTests --zstd

./makeself-test.run --check
assertEqual $? 0
}

source bashunit/bashunit.bash

0 comments on commit 6a9d0e4

Please sign in to comment.