2015-10-23 18:10:47 +00:00
#!/bin/bash
2015-11-16 19:21:57 +00:00
#
# Copyright (c) .NET Foundation and contributors. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
#
2015-10-23 18:10:47 +00:00
SOURCE = " ${ BASH_SOURCE [0] } "
while [ -h " $SOURCE " ] ; do # resolve $SOURCE until the file is no longer a symlink
DIR = " $( cd -P " $( dirname " $SOURCE " ) " && pwd ) "
SOURCE = " $( readlink " $SOURCE " ) "
[ [ $SOURCE != /* ] ] && SOURCE = " $DIR / $SOURCE " # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
DIR = " $( cd -P " $( dirname " $SOURCE " ) " && pwd ) "
REPOROOT = " $( cd -P " $DIR /../../ " && pwd ) "
if [ -z " $DOTNET_BUILD_VERSION " ] ; then
echo " Provide a version number (DOTNET_BUILD_VERSION) $DOTNET_BUILD_VERSION " && exit 1
fi
2015-11-11 01:30:01 +00:00
if [ " $( uname) " = = "Darwin" ] ; then
OSNAME = osx
RID = osx.10.10-x64
else
echo "Package (OSX) only runs on Darwin"
exit 0
2015-10-23 18:10:47 +00:00
fi
STAGE2_DIR = $REPOROOT /artifacts/$RID /stage2
if [ ! -d " $STAGE2_DIR " ] ; then
echo " Missing stage2 output in $STAGE2_DIR " 1>& 2
exit 1
fi
PACKAGE_DIR = $REPOROOT /artifacts/packages/pkg
[ -d " $PACKAGE_DIR " ] || mkdir -p $PACKAGE_DIR
PACKAGE_NAME = $PACKAGE_DIR /dotnet-cli-x64.${ DOTNET_BUILD_VERSION } .pkg
2015-11-11 01:30:01 +00:00
#chmod -R 755 $STAGE2_DIR
2015-10-23 18:10:47 +00:00
pkgbuild --root $STAGE2_DIR \
2015-10-28 19:55:44 +00:00
--version $DOTNET_BUILD_VERSION \
2015-10-23 18:10:47 +00:00
--scripts $DIR /scripts \
2015-11-18 20:59:03 +00:00
--ownership preserve \
2015-10-23 18:10:47 +00:00
--identifier com.microsoft.dotnet.cli.pkg.dotnet-osx-x64 \
--install-location /usr/local/share/dotnet/cli \
$DIR /dotnet-osx-x64.$DOTNET_BUILD_VERSION .pkg
cat $DIR /Distribution-Template | sed " /{VERSION}/s// $DOTNET_BUILD_VERSION /g " > $DIR /Dist
2015-10-28 19:55:44 +00:00
productbuild --version $DOTNET_BUILD_VERSION --identifier com.microsoft.dotnet.cli --package-path $DIR --resources $DIR /resources --distribution $DIR /Dist $PACKAGE_NAME
2015-10-23 18:10:47 +00:00
#Clean temp files
rm $DIR /dotnet-osx-x64.$DOTNET_BUILD_VERSION .pkg
2015-11-06 20:48:34 +00:00
rm $DIR /Dist
2015-11-11 01:30:01 +00:00
$REPOROOT /scripts/publish/publish.sh $PACKAGE_NAME