浏览代码

support/download/helpers: adjust for older coreutils versions

The -z option for head was only added in coreutils 8.25, but some older
enterprise-grade distributions (e.g. the oldest still maintained RHEL 7)
only have nothing more recent than coreutils 8.22.

We fix that by using sed to remove everything that starts with the first
NULL byte, \x00.

Signed-off-by: Clayton Shotwell <clayton.shotwell@collins.com>
[yann.morin.1998@free.fr: hex is \xHH, not \xH, reword commit log]
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
Clayton Shotwell 3 年之前
父节点
当前提交
6e40891a66
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      support/download/helpers

+ 1 - 1
support/download/helpers

@@ -79,7 +79,7 @@ post_process_unpack() {
 
     mkdir "${dest}"
     tar -C "${dest}" --strip-components=1 -xzf "${tarball}"
-    one_file="$(find "${dest}" -type f -print0 |LC_ALL=C sort -z |head -z -n1 |tr -d "\0")"
+    one_file="$(find "${dest}" -type f -print0 |LC_ALL=C sort -z |sed 's/\x0.*//')"
     touch -r "${one_file}" "${dest}.timestamp"
 }