2016-04-27 12:03:10 +00:00
|
|
|
set -e
|
|
|
|
FullExecPath=$PWD
|
|
|
|
pushd `dirname $0` > /dev/null
|
|
|
|
FullScriptPath=`pwd`
|
|
|
|
popd > /dev/null
|
|
|
|
|
2019-09-26 09:52:36 +00:00
|
|
|
if [ ! -d "$FullScriptPath/../../../DesktopPrivate" ]; then
|
2016-04-27 13:59:08 +00:00
|
|
|
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
|
|
|
|
2018-09-26 14:58:09 +00:00
|
|
|
if [ "$AlphaVersion" != "0" ]; then
|
|
|
|
AppVersion="$AlphaVersion"
|
|
|
|
AppVersionStrFull="${AppVersionStr}_${AlphaVersion}"
|
|
|
|
AlphaKeyFile="talpha_${AppVersion}_key"
|
|
|
|
elif [ "$BetaChannel" == "0" ]; then
|
2016-04-27 12:03:10 +00:00
|
|
|
AppVersionStrFull="$AppVersionStr"
|
|
|
|
else
|
2018-09-26 14:58:09 +00:00
|
|
|
AppVersionStrFull="$AppVersionStr.beta"
|
2016-04-27 12:03:10 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
echo ""
|
2016-04-27 13:59:08 +00:00
|
|
|
HomePath="$FullScriptPath/.."
|
2018-04-08 13:17:56 +00:00
|
|
|
DeployMac="0"
|
|
|
|
DeployWin="0"
|
2021-01-28 13:00:42 +00:00
|
|
|
DeployWin64="0"
|
2018-04-08 13:17:56 +00:00
|
|
|
DeployLinux="0"
|
|
|
|
if [ "$DeployTarget" == "mac" ]; then
|
|
|
|
DeployMac="1"
|
2019-11-05 12:27:42 +00:00
|
|
|
echo "Deploying version $AppVersionStrFull for macOS.."
|
2018-04-08 13:17:56 +00:00
|
|
|
elif [ "$DeployTarget" == "win" ]; then
|
|
|
|
DeployWin="1"
|
2021-01-28 13:00:42 +00:00
|
|
|
echo "Deploying version $AppVersionStrFull for Windows 32 bit.."
|
|
|
|
elif [ "$DeployTarget" == "win64" ]; then
|
|
|
|
DeployWin64="1"
|
|
|
|
echo "Deploying version $AppVersionStrFull for Windows 64 bit.."
|
2018-04-08 13:17:56 +00:00
|
|
|
elif [ "$DeployTarget" == "linux" ]; then
|
|
|
|
DeployLinux="1"
|
|
|
|
echo "Deploying version $AppVersionStrFull for Linux 64 bit.."
|
|
|
|
else
|
|
|
|
DeployMac="1"
|
|
|
|
DeployWin="1"
|
2021-01-28 13:00:42 +00:00
|
|
|
DeployWin64="1"
|
2018-04-08 13:17:56 +00:00
|
|
|
DeployLinux="1"
|
2021-01-28 13:00:42 +00:00
|
|
|
echo "Deploying four versions of $AppVersionStrFull: for Windows 32 bit, Windows 64 bit, macOS and Linux 64 bit.."
|
2018-04-08 13:17:56 +00:00
|
|
|
fi
|
|
|
|
if [ "$BuildTarget" == "mac" ]; then
|
2019-11-05 21:27:20 +00:00
|
|
|
BackupPath="$HOME/Projects/backup/tdesktop"
|
2018-04-08 13:17:56 +00:00
|
|
|
elif [ "$BuildTarget" == "linux" ]; then
|
2019-11-05 21:27:20 +00:00
|
|
|
BackupPath="/media/psf/Home/Projects/backup/tdesktop"
|
2016-04-27 12:03:10 +00:00
|
|
|
else
|
2018-04-08 13:17:56 +00:00
|
|
|
Error "Can't deploy here"
|
2016-04-27 12:03:10 +00:00
|
|
|
fi
|
2018-04-08 13:17:56 +00:00
|
|
|
MacDeployPath="$BackupPath/$AppVersionStrMajor/$AppVersionStrFull/tmac"
|
|
|
|
MacUpdateFile="tmacupd$AppVersion"
|
|
|
|
MacSetupFile="tsetup.$AppVersionStrFull.dmg"
|
|
|
|
MacRemoteFolder="tmac"
|
|
|
|
WinDeployPath="$BackupPath/$AppVersionStrMajor/$AppVersionStrFull/tsetup"
|
|
|
|
WinUpdateFile="tupdate$AppVersion"
|
|
|
|
WinSetupFile="tsetup.$AppVersionStrFull.exe"
|
|
|
|
WinPortableFile="tportable.$AppVersionStrFull.zip"
|
|
|
|
WinRemoteFolder="tsetup"
|
2021-01-28 13:00:42 +00:00
|
|
|
Win64DeployPath="$BackupPath/$AppVersionStrMajor/$AppVersionStrFull/tx64"
|
|
|
|
Win64UpdateFile="tx64upd$AppVersion"
|
|
|
|
Win64SetupFile="tsetup-x64.$AppVersionStrFull.exe"
|
|
|
|
Win64PortableFile="tportable-x64.$AppVersionStrFull.zip"
|
|
|
|
Win64RemoteFolder="tx64"
|
2018-04-08 13:17:56 +00:00
|
|
|
LinuxDeployPath="$BackupPath/$AppVersionStrMajor/$AppVersionStrFull/tlinux"
|
|
|
|
LinuxUpdateFile="tlinuxupd$AppVersion"
|
|
|
|
LinuxSetupFile="tsetup.$AppVersionStrFull.tar.xz"
|
|
|
|
LinuxRemoteFolder="tlinux"
|
|
|
|
DeployPath="$BackupPath/$AppVersionStrMajor/$AppVersionStrFull"
|
2016-04-27 12:03:10 +00:00
|
|
|
|
2018-09-26 14:58:09 +00:00
|
|
|
if [ "$AlphaVersion" != "0" ]; then
|
2016-04-27 12:03:10 +00:00
|
|
|
if [ "$DeployTarget" == "win" ]; then
|
2018-09-26 14:58:09 +00:00
|
|
|
AlphaFilePath="$WinDeployPath/$AlphaKeyFile"
|
2021-01-28 13:00:42 +00:00
|
|
|
elif [ "$DeployTarget" == "win64" ]; then
|
|
|
|
AlphaFilePath="$Win64DeployPath/$AlphaKeyFile"
|
2018-04-08 13:17:56 +00:00
|
|
|
elif [ "$DeployTarget" == "linux" ]; then
|
2018-09-26 14:58:09 +00:00
|
|
|
AlphaFilePath="$LinuxDeployPath/$AlphaKeyFile"
|
2016-04-27 12:03:10 +00:00
|
|
|
else
|
2018-09-26 14:58:09 +00:00
|
|
|
AlphaFilePath="$MacDeployPath/$AlphaKeyFile"
|
2016-04-27 12:03:10 +00:00
|
|
|
fi
|
2018-09-26 14:58:09 +00:00
|
|
|
if [ ! -f "$AlphaFilePath" ]; then
|
|
|
|
Error "Alpha key file for $AppVersionStrFull not found."
|
2016-04-27 12:03:10 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
while IFS='' read -r line || [[ -n "$line" ]]; do
|
2018-09-26 14:58:09 +00:00
|
|
|
AlphaSignature="$line"
|
|
|
|
done < "$AlphaFilePath"
|
2016-04-27 12:03:10 +00:00
|
|
|
|
2018-09-26 14:58:09 +00:00
|
|
|
MacUpdateFile="${MacUpdateFile}_${AlphaSignature}"
|
|
|
|
MacSetupFile="talpha${AlphaVersion}_${AlphaSignature}.zip"
|
|
|
|
WinUpdateFile="${WinUpdateFile}_${AlphaSignature}"
|
|
|
|
WinPortableFile="talpha${AlphaVersion}_${AlphaSignature}.zip"
|
2021-01-28 13:00:42 +00:00
|
|
|
Win64UpdateFile="${Win64UpdateFile}_${AlphaSignature}"
|
|
|
|
Win64PortableFile="talpha${AlphaVersion}_${AlphaSignature}.zip"
|
2018-09-26 14:58:09 +00:00
|
|
|
LinuxUpdateFile="${LinuxUpdateFile}_${AlphaSignature}"
|
|
|
|
LinuxSetupFile="talpha${AlphaVersion}_${AlphaSignature}.tar.xz"
|
2018-04-08 13:17:56 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$DeployMac" == "1" ]; then
|
|
|
|
if [ ! -f "$MacDeployPath/$MacUpdateFile" ]; then
|
|
|
|
Error "$MacDeployPath/$MacUpdateFile not found!";
|
2016-04-27 12:03:10 +00:00
|
|
|
fi
|
2018-04-08 13:17:56 +00:00
|
|
|
if [ ! -f "$MacDeployPath/$MacSetupFile" ]; then
|
|
|
|
Error "$MacDeployPath/$MacSetupFile not found!"
|
2017-03-15 10:31:36 +00:00
|
|
|
fi
|
2016-04-27 12:03:10 +00:00
|
|
|
fi
|
2018-04-08 13:17:56 +00:00
|
|
|
if [ "$DeployWin" == "1" ]; then
|
|
|
|
if [ ! -f "$WinDeployPath/$WinUpdateFile" ]; then
|
|
|
|
Error "$WinUpdateFile not found!"
|
2016-04-27 12:03:10 +00:00
|
|
|
fi
|
2018-09-26 14:58:09 +00:00
|
|
|
if [ "$AlphaVersion" == "0" ]; then
|
2018-04-08 13:17:56 +00:00
|
|
|
if [ ! -f "$WinDeployPath/$WinSetupFile" ]; then
|
|
|
|
Error "$WinSetupFile not found!"
|
2017-03-15 10:31:36 +00:00
|
|
|
fi
|
|
|
|
fi
|
2018-04-08 13:17:56 +00:00
|
|
|
if [ ! -f "$WinDeployPath/$WinPortableFile" ]; then
|
|
|
|
Error "$WinPortableFile not found!"
|
|
|
|
fi
|
|
|
|
fi
|
2021-01-28 13:00:42 +00:00
|
|
|
if [ "$DeployWin64" == "1" ]; then
|
|
|
|
if [ ! -f "$Win64DeployPath/$Win64UpdateFile" ]; then
|
|
|
|
Error "$Win64UpdateFile not found!"
|
|
|
|
fi
|
|
|
|
if [ "$AlphaVersion" == "0" ]; then
|
|
|
|
if [ ! -f "$Win64DeployPath/$Win64SetupFile" ]; then
|
|
|
|
Error "$Win64SetupFile not found!"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
if [ ! -f "$Win64DeployPath/$Win64PortableFile" ]; then
|
|
|
|
Error "$Win64PortableFile not found!"
|
|
|
|
fi
|
|
|
|
fi
|
2018-04-08 13:17:56 +00:00
|
|
|
if [ "$DeployLinux" == "1" ]; then
|
|
|
|
if [ ! -f "$LinuxDeployPath/$LinuxUpdateFile" ]; then
|
|
|
|
Error "$LinuxDeployPath/$LinuxUpdateFile not found!"
|
|
|
|
fi
|
|
|
|
if [ ! -f "$LinuxDeployPath/$LinuxSetupFile" ]; then
|
|
|
|
Error "$LinuxDeployPath/$LinuxSetupFile not found!"
|
|
|
|
fi
|
|
|
|
fi
|
2016-04-27 12:03:10 +00:00
|
|
|
|
2019-09-26 09:52:36 +00:00
|
|
|
$FullScriptPath/../../../DesktopPrivate/mount.sh
|
2018-04-08 13:17:56 +00:00
|
|
|
|
|
|
|
declare -a Files
|
|
|
|
if [ "$DeployMac" == "1" ]; then
|
|
|
|
Files+=("tmac/$MacUpdateFile" "tmac/$MacSetupFile")
|
|
|
|
fi
|
|
|
|
if [ "$DeployWin" == "1" ]; then
|
|
|
|
Files+=("tsetup/$WinUpdateFile" "tsetup/$WinPortableFile")
|
2018-09-26 14:58:09 +00:00
|
|
|
if [ "$AlphaVersion" == "0" ]; then
|
2018-04-08 13:17:56 +00:00
|
|
|
Files+=("tsetup/$WinSetupFile")
|
2016-04-27 12:03:10 +00:00
|
|
|
fi
|
|
|
|
fi
|
2021-01-28 13:00:42 +00:00
|
|
|
if [ "$DeployWin64" == "1" ]; then
|
|
|
|
Files+=("tx64/$Win64UpdateFile" "tx64/$Win64PortableFile")
|
|
|
|
if [ "$AlphaVersion" == "0" ]; then
|
|
|
|
Files+=("tx64/$Win64SetupFile")
|
|
|
|
fi
|
|
|
|
fi
|
2018-04-08 13:17:56 +00:00
|
|
|
if [ "$DeployLinux" == "1" ]; then
|
|
|
|
Files+=("tlinux/$LinuxUpdateFile" "tlinux/$LinuxSetupFile")
|
|
|
|
fi
|
|
|
|
cd $DeployPath
|
2019-09-26 09:52:36 +00:00
|
|
|
rsync -avR --progress ${Files[@]} "$FullScriptPath/../../../DesktopPrivate/remote/files"
|
2016-04-27 12:03:10 +00:00
|
|
|
|
2016-04-27 13:59:08 +00:00
|
|
|
echo "Version $AppVersionStrFull was deployed!"
|
|
|
|
cd $FullExecPath
|
|
|
|
|