2006-04-18 16:25:24 +04:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# Display usage
|
|
|
|
cpack_usage()
|
|
|
|
{
|
|
|
|
cat <<EOF
|
|
|
|
Usage: $0 [options]
|
|
|
|
Options: [defaults in brackets after descriptions]
|
|
|
|
--help print this message
|
|
|
|
--prefix=dir directory in which to install
|
|
|
|
--include-subdir include the @CPACK_PACKAGE_FILE_NAME@ subdirectory
|
|
|
|
--exclude-subdir exclude the @CPACK_PACKAGE_FILE_NAME@ subdirectory
|
|
|
|
EOF
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
2006-05-04 00:24:14 +04:00
|
|
|
cpack_echo_exit()
|
|
|
|
{
|
|
|
|
echo $1
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
2006-04-18 16:25:24 +04:00
|
|
|
# Display version
|
|
|
|
cpack_version()
|
|
|
|
{
|
|
|
|
echo "@CPACK_PACKAGE_NAME@ Installer Version: @CPACK_PACKAGE_VERSION@, Copyright (c) @CPACK_PACKAGE_VENDOR@"
|
|
|
|
}
|
|
|
|
|
|
|
|
# Helper function to fix windows paths.
|
|
|
|
cpack_fix_slashes ()
|
|
|
|
{
|
|
|
|
echo "$1" | sed 's/\\/\//g'
|
|
|
|
}
|
|
|
|
|
2006-05-01 22:23:15 +04:00
|
|
|
interactive=TRUE
|
|
|
|
cpack_skip_license=FALSE
|
|
|
|
cpack_include_subdir=""
|
2006-04-18 16:25:24 +04:00
|
|
|
for a in "$@CPACK_AT_SIGN@"; do
|
|
|
|
if echo $a | grep "^--prefix=" > /dev/null 2> /dev/null; then
|
|
|
|
cpack_prefix_dir=`echo $a | sed "s/^--prefix=//"`
|
|
|
|
cpack_prefix_dir=`cpack_fix_slashes "${cpack_prefix_dir}"`
|
|
|
|
fi
|
|
|
|
if echo $a | grep "^--help" > /dev/null 2> /dev/null; then
|
|
|
|
cpack_usage
|
|
|
|
fi
|
|
|
|
if echo $a | grep "^--version" > /dev/null 2> /dev/null; then
|
|
|
|
cpack_version
|
|
|
|
exit 2
|
|
|
|
fi
|
|
|
|
if echo $a | grep "^--include-subdir" > /dev/null 2> /dev/null; then
|
|
|
|
cpack_include_subdir=TRUE
|
|
|
|
fi
|
|
|
|
if echo $a | grep "^--exclude-subdir" > /dev/null 2> /dev/null; then
|
|
|
|
cpack_include_subdir=FALSE
|
|
|
|
fi
|
2006-05-01 22:23:15 +04:00
|
|
|
if echo $a | grep "^--skip-license" > /dev/null 2> /dev/null; then
|
|
|
|
cpack_skip_license=TRUE
|
|
|
|
fi
|
2006-04-18 16:25:24 +04:00
|
|
|
done
|
|
|
|
|
2006-12-14 00:44:49 +03:00
|
|
|
if [ "x${cpack_include_subdir}x" != "xx" -o "x${cpack_skip_license}x" = "xTRUEx" ]
|
2006-05-01 22:23:15 +04:00
|
|
|
then
|
|
|
|
interactive=FALSE
|
|
|
|
fi
|
|
|
|
|
2006-04-18 16:25:24 +04:00
|
|
|
cpack_version
|
|
|
|
echo "This is a self-extracting archive."
|
|
|
|
toplevel="`pwd`"
|
|
|
|
if [ "x${cpack_prefix_dir}x" != "xx" ]
|
|
|
|
then
|
|
|
|
toplevel="${cpack_prefix_dir}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "The archive will be extracted to: ${toplevel}"
|
|
|
|
|
2006-12-14 00:44:49 +03:00
|
|
|
if [ "x${interactive}x" = "xTRUEx" ]
|
2006-04-18 16:25:24 +04:00
|
|
|
then
|
2006-05-01 22:23:15 +04:00
|
|
|
echo ""
|
2006-04-18 16:25:24 +04:00
|
|
|
echo "If you want to stop extracting, please press <ctrl-C>."
|
2006-05-01 22:23:15 +04:00
|
|
|
|
|
|
|
if [ "x${cpack_skip_license}x" != "xTRUEx" ]
|
2006-04-18 16:25:24 +04:00
|
|
|
then
|
2006-05-01 22:23:15 +04:00
|
|
|
more << ____cpack__here_doc____
|
|
|
|
@CPACK_RESOURCE_FILE_LICENSE_CONTENT@
|
|
|
|
____cpack__here_doc____
|
|
|
|
echo
|
2007-03-06 17:16:46 +03:00
|
|
|
echo "Do you accept the license? [yN]: "
|
2006-05-01 22:23:15 +04:00
|
|
|
read line leftover
|
|
|
|
case ${line} in
|
|
|
|
y* | Y*)
|
|
|
|
cpack_license_accepted=TRUE;;
|
|
|
|
*)
|
|
|
|
echo "License not accepted. Exiting ..."
|
|
|
|
exit 1;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
2006-12-14 00:44:49 +03:00
|
|
|
if [ "x${cpack_include_subdir}x" = "xx" ]
|
2006-05-01 22:23:15 +04:00
|
|
|
then
|
|
|
|
echo "By default the @CPACK_PACKAGE_NAME@ will be installed in:"
|
2006-05-04 00:24:14 +04:00
|
|
|
echo " \"${toplevel}/@CPACK_PACKAGE_FILE_NAME@\""
|
2006-05-01 22:23:15 +04:00
|
|
|
echo "Do you want to include the subdirectory @CPACK_PACKAGE_FILE_NAME@?"
|
2006-05-04 00:24:14 +04:00
|
|
|
echo "Saying no will install in: \"${toplevel}\" [Yn]: "
|
2006-05-01 22:23:15 +04:00
|
|
|
read line leftover
|
2006-05-04 00:24:14 +04:00
|
|
|
cpack_include_subdir=TRUE
|
2006-05-01 22:23:15 +04:00
|
|
|
case ${line} in
|
2006-05-04 00:24:14 +04:00
|
|
|
n* | N*)
|
|
|
|
cpack_include_subdir=FALSE
|
2006-05-01 22:23:15 +04:00
|
|
|
esac
|
2006-04-18 16:25:24 +04:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2006-12-14 00:44:49 +03:00
|
|
|
if [ "x${cpack_include_subdir}x" = "xTRUEx" ]
|
2006-04-18 16:25:24 +04:00
|
|
|
then
|
|
|
|
toplevel="${toplevel}/@CPACK_PACKAGE_FILE_NAME@"
|
|
|
|
mkdir -p "${toplevel}"
|
|
|
|
fi
|
2006-05-01 22:23:15 +04:00
|
|
|
echo
|
|
|
|
echo "Using target directory: ${toplevel}"
|
|
|
|
echo "Extracting, please wait..."
|
2006-04-18 16:25:24 +04:00
|
|
|
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
|
2007-07-19 17:42:57 +04:00
|
|
|
# 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@"
|
2006-05-04 00:24:14 +04:00
|
|
|
|
|
|
|
echo "Unpacking finished successfully"
|
2006-04-18 16:25:24 +04:00
|
|
|
|
|
|
|
exit 0
|
|
|
|
#-----------------------------------------------------------
|
|
|
|
# Start of TAR.GZ file
|
|
|
|
#-----------------------------------------------------------;
|
|
|
|
|