[cmake-commits] alex committed CPack.STGZ_Header.sh.in 1.6 1.7

cmake-commits at cmake.org cmake-commits at cmake.org
Thu Jul 19 15:40:00 EDT 2007


Update of /cvsroot/CMake/CMake/Modules
In directory public:/mounts/ram/cvs-serv13763

Modified Files:
	CPack.STGZ_Header.sh.in 
Log Message:

ENH: try if tail works with the -n +<number> syntax, if not use only
"+<number>" (GNU tail warns that this is deprecated)

Alex


Index: CPack.STGZ_Header.sh.in
===================================================================
RCS file: /cvsroot/CMake/CMake/Modules/CPack.STGZ_Header.sh.in,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- CPack.STGZ_Header.sh.in	19 Jul 2007 13:42:57 -0000	1.6
+++ CPack.STGZ_Header.sh.in	19 Jul 2007 19:39:58 -0000	1.7
@@ -123,15 +123,14 @@
 # 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
+# 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_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"
 



More information about the Cmake-commits mailing list