mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
tools/mk7z: support debian unstable / ubuntu 22.04
The version of `7z` provided by `p7zip-full` is now the same as `7zip`: - symlinks are dereferenced by default (no support for `-l`) - `7z -ba h` appends a trailing `/` to directories (not present in the output of `7z -slt l`)
This commit is contained in:
committed by
Frans de Jonge
parent
2d4b12c99c
commit
a4400b3ccb
@@ -34,8 +34,18 @@ trap 'rm -rf "${tmpdir}"' EXIT
|
||||
|
||||
manifest="${tmpdir}/manifest"
|
||||
|
||||
"${sevenzip}" -l -ba h "${patterns[@]}" |
|
||||
awk '{ if ($3!="") print $3, $2, $1; else print $1 }' |
|
||||
# Detect if that version of 7z deferences symlinks by default.
|
||||
sevenzip_manifest_cmd=("${sevenzip}" -ba h)
|
||||
ln -s /dev/null "${tmpdir}/symlink"
|
||||
checksum="$("${sevenzip_manifest_cmd[@]}" "${tmpdir}/symlink" | awk '{ print $1 }')"
|
||||
if [[ "${checksum}" != '00000000' ]]; then
|
||||
sevenzip_manifest_cmd+=(-l)
|
||||
fi
|
||||
rm -f "${tmpdir}/symlink"
|
||||
|
||||
# Note: remove trailing `/` appended to directories in some 7z versions.
|
||||
"${sevenzip_manifest_cmd[@]}" "${patterns[@]}" |
|
||||
awk '{ if ($3!="") print $3, $2, $1; else { gsub("/$", "", $1); print $1 } }' |
|
||||
sort >"${manifest}"
|
||||
|
||||
# cat "${manifest}" | less
|
||||
@@ -78,6 +88,6 @@ cd "${tmpdir}/contents"
|
||||
find . -depth -print0 | xargs -0 touch --date="${epoch}"
|
||||
|
||||
# And create the final archive.
|
||||
"${sevenzip}" -l -mqs "${options[@]}" a "${archive}" .
|
||||
"${sevenzip}" -mqs "${options[@]}" a "${archive}" .
|
||||
|
||||
# vim: sw=4
|
||||
|
||||
Reference in New Issue
Block a user