ENH: try if tail works with the -n +<number> syntax, if not use only

"+<number>" (GNU tail warns that this is deprecated)

Alex
This commit is contained in:
Alexander Neundorf 2007-07-19 15:39:58 -04:00
parent 0f4985ea23
commit 3a12116e39
1 changed files with 7 additions and 8 deletions

View File

@ -123,15 +123,14 @@ echo ""
# take the archive portion of this file and pipe it to tar # take the archive portion of this file and pipe it to tar
# the NUMERIC parameter in this command should be one more # the NUMERIC parameter in this command should be one more
# than the number of lines in this header file # than the number of lines in this header file
# on SunOS there are two tails, the one in /usr/bin doesn't understand # there are tails which don't understand the "-n" argument, e.g. on SunOS
# the -n +<number> syntax, the one in /usr/xpg4/bin/ does # OTOH there are tails which complain when not using the "-n" argument (e.g. GNU)
tail_executable=tail # so at first try to tail some file to see if tail fails if used with "-n"
if [ -x /usr/xpg4/bin/tail ] # if so, don't use "-n"
then use_new_tail_syntax="-n"
tail_executable=/usr/xpg4/bin/tail tail $use_new_tail_syntax +1 "$0" > /dev/null 2> /dev/null || use_new_tail_syntax=""
fi
"$tail_executable" -n +###CPACK_HEADER_LENGTH### "$0" | gunzip | (cd "${toplevel}" && tar xf -) || cpack_echo_exit "Problem unpacking the @CPACK_PACKAGE_FILE_NAME@" 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" echo "Unpacking finished successfully"