Skip to content

Commit 6a9d0e4

Browse files
committed
Preliminary support for zstd compression (#210)
1 parent 7c6f409 commit 6a9d0e4

3 files changed

Lines changed: 21 additions & 3 deletions

File tree

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ jobs:
1212
steps:
1313
- name: Install Linux packages
1414
if: runner.os == 'Linux'
15-
run: sudo env DEBIAN_FRONTEND=noninteractive apt-get -qq -y install pbzip2
15+
run: sudo env DEBIAN_FRONTEND=noninteractive apt-get -qq -y install pbzip2 zstd
1616

1717
- name: Install macOS packages
1818
if: runner.os == 'macOS'
19-
run: brew install pbzip2 coreutils
19+
run: brew install pbzip2 coreutils zstd
2020

2121
- name: Checkout Makeself
2222
uses: actions/checkout@v2

makeself.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,14 @@ MS_Usage()
105105
echo " --quiet | -q : Do not print any messages other than errors."
106106
echo " --gzip : Compress using gzip (default if detected)"
107107
echo " --pigz : Compress with pigz"
108+
echo " --zstd : Compress with zstd"
108109
echo " --bzip2 : Compress using bzip2 instead of gzip"
109110
echo " --pbzip2 : Compress using pbzip2 instead of gzip"
110111
echo " --xz : Compress using xz instead of gzip"
111112
echo " --lzo : Compress using lzop instead of gzip"
112113
echo " --lz4 : Compress using lz4 instead of gzip"
113114
echo " --compress : Compress using the UNIX 'compress' command"
114-
echo " --complevel lvl : Compression level for gzip pigz xz lzo lz4 bzip2 and pbzip2 (default 9)"
115+
echo " --complevel lvl : Compression level for gzip pigz zstd xz lzo lz4 bzip2 and pbzip2 (default 9)"
115116
echo " --threads thds : Number of threads to be used by compressors that support parallelization."
116117
echo " Omit to use compressor's default. Most useful (and required) for opting"
117118
echo " into xz's threading, usually with '--threads=0' for all available cores."
@@ -233,6 +234,10 @@ do
233234
COMPRESS=pigz
234235
shift
235236
;;
237+
--zstd)
238+
COMPRESS=zstd
239+
shift
240+
;;
236241
--xz)
237242
COMPRESS=xz
238243
shift
@@ -500,6 +505,10 @@ pigz)
500505
fi
501506
GUNZIP_CMD="gzip -cd"
502507
;;
508+
zstd)
509+
GZIP_CMD="zstd -$COMPRESS_LEVEL"
510+
GUNZIP_CMD="zstd -cd"
511+
;;
503512
pbzip2)
504513
GZIP_CMD="pbzip2 -c$COMPRESS_LEVEL"
505514
if test $THREADS -ne $DEFAULT_THREADS; then # Leave as the default if threads not indicated

test/extracttest

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,15 @@ testPBzip2()
4646
assertEqual $? 0
4747
}
4848

49+
testZstd()
50+
{
51+
# Skip if zstd is not available
52+
which zstd || return
53+
setupTests --zstd
54+
55+
./makeself-test.run --check
56+
assertEqual $? 0
57+
}
4958

5059
source bashunit/bashunit.bash
5160

0 commit comments

Comments
 (0)