-
Notifications
You must be signed in to change notification settings - Fork 899
feat: Compress and extract slim binaries with zstd #2533
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
b262c38
fb24c02
6c7e1f7
b427108
3c68823
0c6e367
de8c01f
528c34c
db959f3
bd322c7
5c070d5
c3e4613
d715944
2db7961
e65a528
650558e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -23,8 +23,9 @@ source "$(dirname "${BASH_SOURCE[0]}")/lib.sh" | |||||
|
||||||
version="" | ||||||
output_path="" | ||||||
compress="" | ||||||
mafredri marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
args="$(getopt -o "" -l version:,output: -- "$@")" | ||||||
args="$(getopt -o "" -l version:,output:,compress: -- "$@")" | ||||||
eval set -- "$args" | ||||||
while true; do | ||||||
case "$1" in | ||||||
|
@@ -36,6 +37,10 @@ while true; do | |||||
output_path="$2" | ||||||
shift 2 | ||||||
;; | ||||||
--compress) | ||||||
compress="$2" | ||||||
shift 2 | ||||||
;; | ||||||
--) | ||||||
shift | ||||||
break | ||||||
|
@@ -48,6 +53,13 @@ done | |||||
|
||||||
# Check dependencies | ||||||
dependencies go | ||||||
if [[ -n $compress ]]; then | ||||||
mafredri marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
dependencies tar zstd | ||||||
|
||||||
if [[ ! $compress == [0-9]* ]] || ((compress > 22)) || ((compress < 1)); then | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just curious why we'd want to avoid There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consistency, we use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, fair enough. I'd like for us to drop the use of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Feel free to change it across all scripts 👍 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I won't do it in this PR to keep the noise down, but I can do a follow-up tomorrow. |
||||||
error "Invalid value for compress, must in in the range of [1, 22]" | ||||||
fi | ||||||
fi | ||||||
|
||||||
# Remove the "v" prefix. | ||||||
version="${version#v}" | ||||||
|
@@ -92,3 +104,12 @@ for f in ./coder-slim_*; do | |||||
dest="$dest_dir/$hyphenated" | ||||||
cp "$f" "$dest" | ||||||
done | ||||||
|
||||||
if [[ -n $compress ]]; then | ||||||
mafredri marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
( | ||||||
cd "$dest_dir" | ||||||
tar cf coder.tar coder-* | ||||||
rm coder-* | ||||||
zstd --ultra --long -"${compress}" --rm --no-progress coder.tar -o coder.tar.zst | ||||||
) | ||||||
mafredri marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
fi |
Uh oh!
There was an error while loading. Please reload this page.