2016-04-27 12:03:10 +00:00
|
|
|
set -e
|
|
|
|
FullExecPath=$PWD
|
|
|
|
pushd `dirname $0` > /dev/null
|
|
|
|
FullScriptPath=`pwd`
|
|
|
|
popd > /dev/null
|
|
|
|
|
2016-04-27 13:59:08 +00:00
|
|
|
if [ ! -d "$FullScriptPath/../../../TelegramPrivate" ]; then
|
|
|
|
echo ""
|
|
|
|
echo "This script is for building the production version of Telegram Desktop."
|
|
|
|
echo ""
|
|
|
|
echo "For building custom versions please visit the build instructions page at:"
|
|
|
|
echo "https://github.com/telegramdesktop/tdesktop/#build-instructions"
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
Error () {
|
|
|
|
cd $FullExecPath
|
|
|
|
echo "$1"
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
2016-04-27 12:03:10 +00:00
|
|
|
DeployTarget="$1"
|
|
|
|
|
2016-04-27 13:59:08 +00:00
|
|
|
if [ ! -f "$FullScriptPath/target" ]; then
|
|
|
|
Error "Build target not found!"
|
|
|
|
fi
|
|
|
|
|
|
|
|
while IFS='' read -r line || [[ -n "$line" ]]; do
|
|
|
|
BuildTarget="$line"
|
|
|
|
done < "$FullScriptPath/target"
|
|
|
|
|
2016-04-27 12:03:10 +00:00
|
|
|
while IFS='' read -r line || [[ -n "$line" ]]; do
|
|
|
|
set $line
|
|
|
|
eval $1="$2"
|
2016-04-27 13:59:08 +00:00
|
|
|
done < "$FullScriptPath/version"
|
2016-04-27 12:03:10 +00:00
|
|
|
|
|
|
|
if [ "$BetaVersion" != "0" ]; then
|
|
|
|
AppVersion="$BetaVersion"
|
|
|
|
AppVersionStrFull="${AppVersionStr}_${BetaVersion}"
|
|
|
|
BetaKeyFile="tbeta_${AppVersion}_key"
|
2016-04-27 13:59:08 +00:00
|
|
|
elif [ "$AlphaChannel" == "0" ]; then
|
2016-04-27 12:03:10 +00:00
|
|
|
AppVersionStrFull="$AppVersionStr"
|
|
|
|
else
|
2016-04-27 13:59:08 +00:00
|
|
|
AppVersionStrFull="$AppVersionStr.alpha"
|
2016-04-27 12:03:10 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
echo ""
|
2016-04-27 13:59:08 +00:00
|
|
|
HomePath="$FullScriptPath/.."
|
2016-04-27 12:03:10 +00:00
|
|
|
if [ "$BuildTarget" == "linux" ]; then
|
|
|
|
echo "Deploying version $AppVersionStrFull for Linux 64bit.."
|
|
|
|
UpdateFile="tlinuxupd$AppVersion"
|
|
|
|
SetupFile="tsetup.$AppVersionStrFull.tar.xz"
|
2016-04-27 13:59:08 +00:00
|
|
|
ReleasePath="$HomePath/../Linux/Release"
|
2016-04-27 12:03:10 +00:00
|
|
|
RemoteFolder="tlinux"
|
|
|
|
elif [ "$BuildTarget" == "linux32" ]; then
|
|
|
|
echo "Deploying version $AppVersionStrFull for Linux 32bit.."
|
|
|
|
UpdateFile="tlinux32upd$AppVersion"
|
|
|
|
SetupFile="tsetup32.$AppVersionStrFull.tar.xz"
|
2016-04-27 13:59:08 +00:00
|
|
|
ReleasePath="$HomePath/../Linux/Release"
|
2016-04-27 12:03:10 +00:00
|
|
|
RemoteFolder="tlinux32"
|
|
|
|
elif [ "$BuildTarget" == "mac" ]; then
|
|
|
|
DeployMac="0"
|
|
|
|
DeployMac32="0"
|
|
|
|
DeployWin="0"
|
|
|
|
if [ "$DeployTarget" == "mac" ]; then
|
|
|
|
DeployMac="1"
|
|
|
|
echo "Deploying version $AppVersionStrFull for OS X 10.8+.."
|
|
|
|
elif [ "$DeployTarget" == "mac32" ]; then
|
|
|
|
DeployMac32="1"
|
|
|
|
echo "Deploying version $AppVersionStrFull for OS X 10.6 and 10.7.."
|
|
|
|
elif [ "$DeployTarget" == "win" ]; then
|
|
|
|
DeployWin="1"
|
|
|
|
echo "Deploying version $AppVersionStrFull for Windows.."
|
|
|
|
else
|
|
|
|
DeployMac="1"
|
|
|
|
if [ "$BetaVersion" != "0" ]; then
|
|
|
|
DeployMac32="0"
|
|
|
|
else
|
|
|
|
DeployMac32="1"
|
|
|
|
fi
|
|
|
|
DeployWin="1"
|
|
|
|
echo "Deploying three versions of $AppVersionStrFull: for Windows, OS X 10.6 and 10.7 and OS X 10.8+.."
|
|
|
|
fi
|
|
|
|
UpdateFile="tmacupd$AppVersion"
|
|
|
|
SetupFile="tsetup.$AppVersionStrFull.dmg"
|
2016-04-27 13:59:08 +00:00
|
|
|
ReleasePath="$HomePath/../Mac/Release"
|
2016-04-27 12:03:10 +00:00
|
|
|
RemoteFolder="tmac"
|
2016-04-27 13:59:08 +00:00
|
|
|
Mac32DeployPath="$HomePath/../../tother/tmac32/$AppVersionStrMajor/$AppVersionStrFull"
|
2016-04-27 12:03:10 +00:00
|
|
|
Mac32UpdateFile="tmac32upd$AppVersion"
|
|
|
|
Mac32SetupFile="tsetup32.$AppVersionStrFull.dmg"
|
|
|
|
Mac32RemoteFolder="tmac32"
|
2016-04-27 13:59:08 +00:00
|
|
|
WinDeployPath="$HomePath/../../tother/tsetup/$AppVersionStrMajor/$AppVersionStrFull"
|
2016-04-27 12:03:10 +00:00
|
|
|
WinUpdateFile="tupdate$AppVersion"
|
|
|
|
WinSetupFile="tsetup.$AppVersionStrFull.exe"
|
|
|
|
WinPortableFile="tportable.$AppVersionStrFull.zip"
|
|
|
|
WinRemoteFolder="tsetup"
|
2016-04-27 13:59:08 +00:00
|
|
|
DropboxPath="/Volumes/Storage/Dropbox/Telegram/deploy/$AppVersionStrMajor"
|
2016-04-27 12:03:10 +00:00
|
|
|
DropboxDeployPath="$DropboxPath/$AppVersionStrFull"
|
|
|
|
DropboxSetupFile="$SetupFile"
|
|
|
|
DropboxMac32SetupFile="$Mac32SetupFile"
|
|
|
|
elif [ "$BuildTarget" == "mac32" ] || [ "$BuildTarget" = "macstore" ]; then
|
2016-04-27 13:59:08 +00:00
|
|
|
Error "No need to deploy this target."
|
2016-04-27 12:03:10 +00:00
|
|
|
else
|
2016-04-27 13:59:08 +00:00
|
|
|
Error "Invalid target!"
|
2016-04-27 12:03:10 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
DeployPath="$ReleasePath/deploy/$AppVersionStrMajor/$AppVersionStrFull"
|
|
|
|
|
|
|
|
if [ "$BetaVersion" != "0" ]; then
|
|
|
|
if [ "$DeployTarget" == "win" ]; then
|
|
|
|
BetaFilePath="$WinDeployPath/$BetaKeyFile"
|
|
|
|
elif [ "$DeployTarget" == "mac32" ]; then
|
|
|
|
BetaFilePath="$Mac32DeployPath/$BetaKeyFile"
|
|
|
|
else
|
|
|
|
BetaFilePath="$DeployPath/$BetaKeyFile"
|
|
|
|
fi
|
|
|
|
if [ ! -f "$BetaFilePath" ]; then
|
2016-04-27 13:59:08 +00:00
|
|
|
Error "Beta key file for $AppVersionStrFull not found :("
|
2016-04-27 12:03:10 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
while IFS='' read -r line || [[ -n "$line" ]]; do
|
|
|
|
BetaSignature="$line"
|
|
|
|
done < "$BetaFilePath"
|
|
|
|
|
|
|
|
UpdateFile="${UpdateFile}_${BetaSignature}"
|
|
|
|
if [ "$BuildTarget" == "linux" ] || [ "$BuildTarget" == "linux32" ]; then
|
|
|
|
SetupFile="tbeta${BetaVersion}_${BetaSignature}.tar.xz"
|
|
|
|
elif [ "$BuildTarget" == "mac" ]; then
|
|
|
|
SetupFile="tbeta${BetaVersion}_${BetaSignature}.zip"
|
|
|
|
DropboxSetupFile="tbeta${BetaVersion}_${BetaSignature}_mac.zip"
|
|
|
|
Mac32UpdateFile="${Mac32UpdateFile}_${BetaSignature}"
|
|
|
|
Mac32SetupFile="tbeta${BetaVersion}_${BetaSignature}.zip"
|
|
|
|
DropboxMac32SetupFile="tbeta${BetaVersion}_${BetaSignature}_mac32.zip"
|
|
|
|
WinUpdateFile="${WinUpdateFile}_${BetaSignature}"
|
|
|
|
WinPortableFile="tbeta${BetaVersion}_${BetaSignature}.zip"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
#if [ "$BuildTarget" == "linux" ] || [ "$BuildTarget" == "linux32" ] || [ "$BuildTarget" == "mac" ] || [ "$BuildTarget" == "mac32" ] || [ "$BuildTarget" == "macstore" ]; then
|
|
|
|
|
|
|
|
if [ "$BuildTarget" != "mac" ] || [ "$DeployMac" == "1" ]; then
|
|
|
|
if [ ! -f "$DeployPath/$UpdateFile" ]; then
|
2016-04-27 13:59:08 +00:00
|
|
|
Error "$UpdateFile not found!";
|
2016-04-27 12:03:10 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -f "$DeployPath/$SetupFile" ]; then
|
2016-04-27 13:59:08 +00:00
|
|
|
Error "$SetupFile not found!"
|
2016-04-27 12:03:10 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$BuildTarget" == "mac" ]; then
|
|
|
|
if [ "$DeployMac32" == "1" ]; then
|
|
|
|
if [ ! -f "$Mac32DeployPath/$Mac32UpdateFile" ]; then
|
2016-04-27 13:59:08 +00:00
|
|
|
Error "$Mac32UpdateFile not found!"
|
2016-04-27 12:03:10 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -f "$Mac32DeployPath/$Mac32SetupFile" ]; then
|
2016-04-27 13:59:08 +00:00
|
|
|
Error "$Mac32SetupFile not found!"
|
2016-04-27 12:03:10 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$DeployWin" == "1" ]; then
|
|
|
|
if [ ! -f "$WinDeployPath/$WinUpdateFile" ]; then
|
2016-04-27 13:59:08 +00:00
|
|
|
Error "$WinUpdateFile not found!"
|
2016-04-27 12:03:10 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$BetaVersion" == "0" ]; then
|
|
|
|
if [ ! -f "$WinDeployPath/$WinSetupFile" ]; then
|
2016-04-27 13:59:08 +00:00
|
|
|
Error "$WinSetupFile not found!"
|
2016-04-27 12:03:10 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -f "$WinDeployPath/$WinPortableFile" ]; then
|
2016-04-27 13:59:08 +00:00
|
|
|
Error "$WinPortableFile not found!"
|
2016-04-27 12:03:10 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
mkdir -p "$DropboxDeployPath"
|
|
|
|
fi
|
|
|
|
#fi
|
|
|
|
|
|
|
|
if [ "$BuildTarget" == "linux" ] || [ "$BuildTarget" == "linux32" ] || [ "$BuildTarget" == "mac" ]; then
|
|
|
|
if [ "$BuildTarget" != "mac" ] || [ "$DeployMac" == "1" ]; then
|
|
|
|
scp "$DeployPath/$UpdateFile" "tmaster:tdesktop/www/$RemoteFolder/"
|
|
|
|
scp "$DeployPath/$SetupFile" "tmaster:tdesktop/www/$RemoteFolder/"
|
|
|
|
fi
|
|
|
|
if [ "$BuildTarget" == "mac" ]; then
|
|
|
|
if [ "$DeployMac32" == "1" ]; then
|
|
|
|
scp "$Mac32DeployPath/$Mac32UpdateFile" "tmaster:tdesktop/www/$Mac32RemoteFolder/"
|
|
|
|
scp "$Mac32DeployPath/$Mac32SetupFile" "tmaster:tdesktop/www/$Mac32RemoteFolder/"
|
|
|
|
fi
|
|
|
|
if [ "$DeployWin" == "1" ]; then
|
|
|
|
scp "$WinDeployPath/$WinUpdateFile" "tmaster:tdesktop/www/$WinRemoteFolder/"
|
|
|
|
if [ "$BetaVersion" == "0" ]; then
|
|
|
|
scp "$WinDeployPath/$WinSetupFile" "tmaster:tdesktop/www/$WinRemoteFolder/"
|
|
|
|
fi
|
|
|
|
scp "$WinDeployPath/$WinPortableFile" "tmaster:tdesktop/www/$WinRemoteFolder/"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$DeployMac" == "1" ]; then
|
|
|
|
cp -v "$DeployPath/$SetupFile" "$DropboxDeployPath/$DropboxSetupFile"
|
|
|
|
if [ -d "$DropboxDeployPath/Telegram.app.dSYM" ]; then
|
|
|
|
rm -rf "$DropboxDeployPath/Telegram.app.dSYM"
|
|
|
|
fi
|
|
|
|
cp -rv "$DeployPath/Telegram.app.dSYM" "$DropboxDeployPath/"
|
|
|
|
fi
|
|
|
|
if [ "$DeployMac32" == "1" ]; then
|
|
|
|
mv -v "$Mac32DeployPath/$Mac32SetupFile" "$DropboxDeployPath/$DropboxMac32SetupFile"
|
|
|
|
if [ -d "$DropboxDeployPath/Telegram32.app.dSYM" ]; then
|
|
|
|
rm -rf "$DropboxDeployPath/Telegram32.app.dSYM"
|
|
|
|
fi
|
|
|
|
mv -v "$Mac32DeployPath/Telegram.app.dSYM" "$DropboxDeployPath/Telegram32.app.dSYM"
|
|
|
|
fi
|
|
|
|
if [ "$DeployWin" == "1" ]; then
|
|
|
|
mv -v "$WinDeployPath/Telegram.pdb" "$DropboxDeployPath/"
|
|
|
|
mv -v "$WinDeployPath/Updater.exe" "$DropboxDeployPath/"
|
|
|
|
mv -v "$WinDeployPath/Updater.pdb" "$DropboxDeployPath/"
|
|
|
|
if [ "$BetaVersion" == "0" ]; then
|
|
|
|
mv -v "$WinDeployPath/$WinSetupFile" "$DropboxDeployPath/"
|
|
|
|
fi
|
|
|
|
mv -v "$WinDeployPath/$WinPortableFile" "$DropboxDeployPath/"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2016-04-27 13:59:08 +00:00
|
|
|
echo "Version $AppVersionStrFull was deployed!"
|
|
|
|
cd $FullExecPath
|
|
|
|
|