diff options
author | merakor <cem@ckyln.com> | 2021-08-10 23:12:37 +0000 |
---|---|---|
committer | merakor <cem@ckyln.com> | 2021-08-10 23:12:37 +0000 |
commit | 779de00952b8cf03a3a34efe9c5ca0f287576546 (patch) | |
tree | c84234411701c831482a39bb05e7420f55da42d8 /src/cpt-lib.in | |
parent | 296796280f670a5da9aee42cc86f127e6a48e602 (diff) | |
download | cpt-779de00952b8cf03a3a34efe9c5ca0f287576546.tar.gz |
fix CPT_COMPRESS if faulty variable is set
FossilOrigin-Name: cea141d938e78239f6ec5c90457d40311797a712f87d0a001839b2e9b8b4e142
Diffstat (limited to 'src/cpt-lib.in')
-rw-r--r-- | src/cpt-lib.in | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/cpt-lib.in b/src/cpt-lib.in index a882594..abf5bdf 100644 --- a/src/cpt-lib.in +++ b/src/cpt-lib.in @@ -2233,8 +2233,13 @@ create_cache() { # do nothing on a normal system. mkdir -p "$CPT_ROOT/" 2>/dev/null ||: - # Set a value for CPT_COMPRESS if it isn't set. - : "${CPT_COMPRESS:=gz}" + # Set the default compression to gzip, and warn the user if the value is + # invalid. + case ${CPT_COMPRESS:=gz} in + bz2|gz|xz|zst|lz) ;; + *) warn "'$CPT_COMPRESS' is not a valid CPT_COMPRESS value, falling back to 'gz'" + CPT_COMPRESS=gz + esac # Set colors if they are to be enabled. # shellcheck disable=2034 |