2014-08-01 12:55:31 +04:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Script to create the Mac installer using the packages tool from
|
|
|
|
# http://s.sudre.free.fr/Software/Packages/about.html
|
|
|
|
#
|
|
|
|
|
2014-09-02 19:57:22 +04:00
|
|
|
[ "$#" -lt 2 ] && echo "Usage: create_mac_pkg.sh <CMAKE_INSTALL_DIR> <build dir> <installer sign identity>" && exit
|
|
|
|
|
2014-08-01 12:55:31 +04:00
|
|
|
# the path of installation must be given as parameter
|
|
|
|
if [ -z "$1" ]; then
|
2014-08-27 13:40:10 +04:00
|
|
|
echo "ERROR: Provide the path to CMAKE_INSTALL_DIR to this script as first parameter."
|
2014-08-01 12:55:31 +04:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2014-08-27 13:40:10 +04:00
|
|
|
if [ -z "$2" ]; then
|
|
|
|
echo "ERROR: Provide the path to build directory as second parameter."
|
|
|
|
exit 1
|
2014-08-01 12:55:31 +04:00
|
|
|
fi
|
|
|
|
|
2014-09-02 19:57:22 +04:00
|
|
|
install_path="$1"
|
|
|
|
build_path="$2"
|
|
|
|
identity="$3"
|
2014-08-27 13:40:10 +04:00
|
|
|
prjfile=$build_path/admin/osx/macosx.pkgproj
|
2014-08-01 12:55:31 +04:00
|
|
|
|
|
|
|
# The name of the installer package
|
2015-09-24 17:02:08 +03:00
|
|
|
installer="@APPLICATION_SHORTNAME@-@MIRALL_VERSION_FULL@@MIRALL_VERSION_SUFFIX@"
|
2014-08-27 14:49:22 +04:00
|
|
|
installer_file="$installer.pkg"
|
2014-09-02 14:15:11 +04:00
|
|
|
installer_file_tar="$installer.pkg.tar"
|
|
|
|
installer_file_tar_bz2="$installer.pkg.tar.bz2"
|
|
|
|
installer_file_tbz="$installer.pkg.tbz"
|
2014-08-26 18:01:36 +04:00
|
|
|
|
|
|
|
# set the installer name to the copied prj config file
|
2014-08-27 14:49:22 +04:00
|
|
|
/usr/local/bin/packagesutil --file $prjfile set project name "$installer"
|
2014-08-01 12:55:31 +04:00
|
|
|
|
|
|
|
# The command line tool of the "Packages" tool, see link above.
|
|
|
|
pkgbuild=/usr/local/bin/packagesbuild
|
|
|
|
|
|
|
|
$pkgbuild -F $install_path $prjfile
|
|
|
|
rc=$?
|
|
|
|
|
|
|
|
if [ $rc == 0 ]; then
|
2014-08-26 18:01:36 +04:00
|
|
|
echo "Successfully created $installer_file"
|
2014-08-01 12:55:31 +04:00
|
|
|
else
|
2014-08-26 18:01:36 +04:00
|
|
|
echo "Failed to create $installer_file"
|
2014-08-01 12:55:31 +04:00
|
|
|
exit 3
|
|
|
|
fi
|
|
|
|
|
2014-09-02 19:57:22 +04:00
|
|
|
# Sign the finished package if desired.
|
|
|
|
if [ ! -z "$identity" ]; then
|
|
|
|
echo "Will try to sign the installer"
|
|
|
|
pushd $install_path
|
|
|
|
productsign --sign "$identity" "$installer_file" "$installer_file.new"
|
2015-04-21 16:42:51 +03:00
|
|
|
mv "$installer_file".new "$installer_file"
|
2014-09-02 19:57:22 +04:00
|
|
|
popd
|
|
|
|
else
|
|
|
|
echo "No certificate given, will not sign the pkg"
|
|
|
|
fi
|
2014-08-27 13:40:10 +04:00
|
|
|
|
|
|
|
# FIXME: OEMs?
|
2014-09-02 19:57:22 +04:00
|
|
|
# they will need to do their own signing..
|
2014-09-02 14:15:11 +04:00
|
|
|
|
|
|
|
|
|
|
|
# Sparkle wants a tbz, it cannot install raw pkg
|
|
|
|
cd $install_path
|
2014-09-22 18:45:33 +04:00
|
|
|
tar cf "$installer_file_tar" "$installer_file"
|
|
|
|
bzip2 -9 "$installer_file_tar"
|
|
|
|
mv "$installer_file_tar_bz2" "$installer_file_tbz"
|
2014-09-02 14:15:11 +04:00
|
|
|
rc=$?
|
|
|
|
if [ $rc == 0 ]; then
|
|
|
|
echo "Successfully created $installer_file"
|
|
|
|
else
|
|
|
|
echo "Failed to create $installer_file"
|
|
|
|
exit 3
|
|
|
|
fi
|