mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-11 08:20:18 -06:00
CPack/STGZ: Avoid replacing directory symlinks if possible
When installing into a prefix with existing directory symlinks, tell `tar` not to replace them with real directories from the package. Fixes: #21119
This commit is contained in:
@@ -136,8 +136,16 @@ echo ""
|
||||
use_new_tail_syntax="-n"
|
||||
tail $use_new_tail_syntax +1 "$0" > /dev/null 2> /dev/null || use_new_tail_syntax=""
|
||||
|
||||
extractor="pax -r"
|
||||
command -v pax > /dev/null 2> /dev/null || extractor="tar xf -"
|
||||
if command -v pax > /dev/null 2> /dev/null; then
|
||||
extractor="pax -r"
|
||||
else
|
||||
# Avoid replacing directory symlinks with directories from the package.
|
||||
if tar --help 2> /dev/null | grep "keep-directory-symlink" > /dev/null 2> /dev/null; then
|
||||
extractor="tar --keep-directory-symlink -xf -"
|
||||
else
|
||||
extractor="tar xf -"
|
||||
fi
|
||||
fi
|
||||
|
||||
tail $use_new_tail_syntax +###CPACK_HEADER_LENGTH### "$0" | gunzip | (cd "${toplevel}" && ${extractor}) || cpack_echo_exit "Problem unpacking the @CPACK_PACKAGE_FILE_NAME@"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user