summaryrefslogtreecommitdiffstats
path: root/Modules/CPack.STGZ_Header.sh.in
diff options
context:
space:
mode:
authorAlexander Neundorf <neundorf@kde.org>2007-07-19 19:39:58 (GMT)
committerAlexander Neundorf <neundorf@kde.org>2007-07-19 19:39:58 (GMT)
commit3a12116e39d0bef710d1ae24438873e7aed925c6 (patch)
treebdc9adefcbffd5947b1a71aee58ae3408bcd1937 /Modules/CPack.STGZ_Header.sh.in
parent0f4985ea2394ef65f37c23f39f65168ad668b03b (diff)
downloadCMake-3a12116e39d0bef710d1ae24438873e7aed925c6.zip
CMake-3a12116e39d0bef710d1ae24438873e7aed925c6.tar.gz
CMake-3a12116e39d0bef710d1ae24438873e7aed925c6.tar.bz2
ENH: try if tail works with the -n +<number> syntax, if not use only
"+<number>" (GNU tail warns that this is deprecated) Alex
Diffstat (limited to 'Modules/CPack.STGZ_Header.sh.in')
-rwxr-xr-xModules/CPack.STGZ_Header.sh.in17
1 files changed, 8 insertions, 9 deletions
diff --git a/Modules/CPack.STGZ_Header.sh.in b/Modules/CPack.STGZ_Header.sh.in
index d0d239f..3b50e74 100755
--- a/Modules/CPack.STGZ_Header.sh.in
+++ b/Modules/CPack.STGZ_Header.sh.in
@@ -123,15 +123,14 @@ echo ""
# take the archive portion of this file and pipe it to tar
# the NUMERIC parameter in this command should be one more
# than the number of lines in this header file
-# on SunOS there are two tails, the one in /usr/bin doesn't understand
-# the -n +<number> syntax, the one in /usr/xpg4/bin/ does
-tail_executable=tail
-if [ -x /usr/xpg4/bin/tail ]
-then
- tail_executable=/usr/xpg4/bin/tail
-fi
-
-"$tail_executable" -n +###CPACK_HEADER_LENGTH### "$0" | gunzip | (cd "${toplevel}" && tar xf -) || cpack_echo_exit "Problem unpacking the @CPACK_PACKAGE_FILE_NAME@"
+# there are tails which don't understand the "-n" argument, e.g. on SunOS
+# OTOH there are tails which complain when not using the "-n" argument (e.g. GNU)
+# so at first try to tail some file to see if tail fails if used with "-n"
+# if so, don't use "-n"
+use_new_tail_syntax="-n"
+tail $use_new_tail_syntax +1 "$0" > /dev/null 2> /dev/null || use_new_tail_syntax=""
+
+tail $use_new_tail_syntax +###CPACK_HEADER_LENGTH### "$0" | gunzip | (cd "${toplevel}" && tar xf -) || cpack_echo_exit "Problem unpacking the @CPACK_PACKAGE_FILE_NAME@"
echo "Unpacking finished successfully"