aboutsummaryrefslogtreecommitdiff
path: root/sbopkglint.d/60-usr_info.t.sh
diff options
context:
space:
mode:
Diffstat (limited to 'sbopkglint.d/60-usr_info.t.sh')
-rw-r--r--sbopkglint.d/60-usr_info.t.sh11
1 files changed, 2 insertions, 9 deletions
diff --git a/sbopkglint.d/60-usr_info.t.sh b/sbopkglint.d/60-usr_info.t.sh
index b839180..3f3ffd5 100644
--- a/sbopkglint.d/60-usr_info.t.sh
+++ b/sbopkglint.d/60-usr_info.t.sh
@@ -36,18 +36,11 @@ NONINFO=""
NONGZIP=""
# 2 args: $1 is the file to check, $2 is 1 for .gz name, 0 otherwise.
-# The LANG=C is because we're grepping for raw bytes, not characters
-# in e.g. UTF-8 encoding. Believe it or not, using head and grep is
-# quite a bit faster than using the file command... though we could
-# make file faster with "file -m /etc/file/magic/compress".
check_info() {
- local is_gzip=0
- head -c2 "$1" | LANG=C grep -Pq '\x1f\x8b' && is_gzip=1
-
if [ "$2" = 0 ]; then
- [ "$is_gzip" = "1" ] && warn "$i is gzipped but lacks .gz extension"
+ is_gzipped "$1" && warn "$i is gzipped but lacks .gz extension"
else
- [ "$is_gzip" = "0" ] && warn "$i has .gz extension but is not gzipped"
+ is_gzipped "$1" || warn "$i has .gz extension but is not gzipped"
fi
LANG=C zgrep -Pq '\x1f' "$1" || NONINFO+="$1 "