"Fossies" - the Fresh Open Source Software Archive

Member "tdesktop-2.6.1/Telegram/build/deploy.sh" (24 Feb 2021, 7945 Bytes) of package /linux/misc/tdesktop-2.6.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "deploy.sh": 2.5.6_vs_2.5.7.

    1 set -e
    2 FullExecPath=$PWD
    3 pushd `dirname $0` > /dev/null
    4 FullScriptPath=`pwd`
    5 popd > /dev/null
    6 
    7 if [ ! -d "$FullScriptPath/../../../DesktopPrivate" ]; then
    8   echo ""
    9   echo "This script is for building the production version of Telegram Desktop."
   10   echo ""
   11   echo "For building custom versions please visit the build instructions page at:"
   12   echo "https://github.com/telegramdesktop/tdesktop/#build-instructions"
   13   exit
   14 fi
   15 
   16 Error () {
   17   cd $FullExecPath
   18   echo "$1"
   19   exit 1
   20 }
   21 
   22 DeployTarget="$1"
   23 
   24 if [ ! -f "$FullScriptPath/target" ]; then
   25   Error "Build target not found!"
   26 fi
   27 
   28 while IFS='' read -r line || [[ -n "$line" ]]; do
   29   BuildTarget="$line"
   30 done < "$FullScriptPath/target"
   31 
   32 while IFS='' read -r line || [[ -n "$line" ]]; do
   33   set $line
   34   eval $1="$2"
   35 done < "$FullScriptPath/version"
   36 
   37 if [ "$AlphaVersion" != "0" ]; then
   38   AppVersion="$AlphaVersion"
   39   AppVersionStrFull="${AppVersionStr}_${AlphaVersion}"
   40   AlphaKeyFile="talpha_${AppVersion}_key"
   41 elif [ "$BetaChannel" == "0" ]; then
   42   AppVersionStrFull="$AppVersionStr"
   43 else
   44   AppVersionStrFull="$AppVersionStr.beta"
   45 fi
   46 
   47 echo ""
   48 HomePath="$FullScriptPath/.."
   49 DeployMac="0"
   50 DeployOsx="0"
   51 DeployWin="0"
   52 DeployWin64="0"
   53 DeployLinux="0"
   54 DeployLinux32="0"
   55 if [ "$DeployTarget" == "mac" ]; then
   56   DeployMac="1"
   57   echo "Deploying version $AppVersionStrFull for macOS.."
   58 elif [ "$DeployTarget" == "osx" ]; then
   59   DeployOsx="1"
   60   echo "Deploying version $AppVersionStrFull for OS X 10.10 and 10.11.."
   61 elif [ "$DeployTarget" == "win" ]; then
   62   DeployWin="1"
   63   echo "Deploying version $AppVersionStrFull for Windows 32 bit.."
   64 elif [ "$DeployTarget" == "win64" ]; then
   65   DeployWin64="1"
   66   echo "Deploying version $AppVersionStrFull for Windows 64 bit.."
   67 elif [ "$DeployTarget" == "linux" ]; then
   68   DeployLinux="1"
   69   echo "Deploying version $AppVersionStrFull for Linux 64 bit.."
   70 elif [ "$DeployTarget" == "linux32" ]; then
   71   DeployLinux32="1"
   72   echo "Deploying version $AppVersionStrFull for Linux 32 bit.."
   73 else
   74   DeployMac="1"
   75   DeployWin="1"
   76   DeployWin64="1"
   77   DeployLinux="1"
   78   echo "Deploying four versions of $AppVersionStrFull: for Windows 32 bit, Windows 64 bit, macOS and Linux 64 bit.."
   79 fi
   80 if [ "$BuildTarget" == "mac" ]; then
   81   BackupPath="$HOME/Projects/backup/tdesktop"
   82 elif [ "$BuildTarget" == "linux" ]; then
   83   BackupPath="/media/psf/Home/Projects/backup/tdesktop"
   84 else
   85   Error "Can't deploy here"
   86 fi
   87 MacDeployPath="$BackupPath/$AppVersionStrMajor/$AppVersionStrFull/tmac"
   88 MacUpdateFile="tmacupd$AppVersion"
   89 MacSetupFile="tsetup.$AppVersionStrFull.dmg"
   90 MacRemoteFolder="tmac"
   91 OsxDeployPath="$BackupPath/$AppVersionStrMajor/$AppVersionStrFull/tosx"
   92 OsxUpdateFile="tosxupd$AppVersion"
   93 OsxSetupFile="tsetup-osx.$AppVersionStrFull.dmg"
   94 OsxRemoteFolder="tosx"
   95 WinDeployPath="$BackupPath/$AppVersionStrMajor/$AppVersionStrFull/tsetup"
   96 WinUpdateFile="tupdate$AppVersion"
   97 WinSetupFile="tsetup.$AppVersionStrFull.exe"
   98 WinPortableFile="tportable.$AppVersionStrFull.zip"
   99 WinRemoteFolder="tsetup"
  100 Win64DeployPath="$BackupPath/$AppVersionStrMajor/$AppVersionStrFull/tx64"
  101 Win64UpdateFile="tx64upd$AppVersion"
  102 Win64SetupFile="tsetup-x64.$AppVersionStrFull.exe"
  103 Win64PortableFile="tportable-x64.$AppVersionStrFull.zip"
  104 Win64RemoteFolder="tx64"
  105 LinuxDeployPath="$BackupPath/$AppVersionStrMajor/$AppVersionStrFull/tlinux"
  106 LinuxUpdateFile="tlinuxupd$AppVersion"
  107 LinuxSetupFile="tsetup.$AppVersionStrFull.tar.xz"
  108 LinuxRemoteFolder="tlinux"
  109 Linux32DeployPath="$BackupPath/$AppVersionStrMajor/$AppVersionStrFull/tlinux32"
  110 Linux32UpdateFile="tlinux32upd$AppVersion"
  111 Linux32SetupFile="tsetup32.$AppVersionStrFull.tar.xz"
  112 Linux32RemoteFolder="tlinux32"
  113 DeployPath="$BackupPath/$AppVersionStrMajor/$AppVersionStrFull"
  114 
  115 if [ "$AlphaVersion" != "0" ]; then
  116   if [ "$DeployTarget" == "win" ]; then
  117     AlphaFilePath="$WinDeployPath/$AlphaKeyFile"
  118   elif [ "$DeployTarget" == "win64" ]; then
  119     AlphaFilePath="$Win64DeployPath/$AlphaKeyFile"
  120   elif [ "$DeployTarget" == "osx" ]; then
  121     AlphaFilePath="$OsxDeployPath/$AlphaKeyFile"
  122   elif [ "$DeployTarget" == "linux" ]; then
  123     AlphaFilePath="$LinuxDeployPath/$AlphaKeyFile"
  124   elif [ "$DeployTarget" == "linux32" ]; then
  125     AlphaFilePath="$Linux32DeployPath/$AlphaKeyFile"
  126   else
  127     AlphaFilePath="$MacDeployPath/$AlphaKeyFile"
  128   fi
  129   if [ ! -f "$AlphaFilePath" ]; then
  130     Error "Alpha key file for $AppVersionStrFull not found."
  131   fi
  132 
  133   while IFS='' read -r line || [[ -n "$line" ]]; do
  134     AlphaSignature="$line"
  135   done < "$AlphaFilePath"
  136 
  137   MacUpdateFile="${MacUpdateFile}_${AlphaSignature}"
  138   MacSetupFile="talpha${AlphaVersion}_${AlphaSignature}.zip"
  139   OsxUpdateFile="${OsxUpdateFile}_${AlphaSignature}"
  140   OsxSetupFile="talpha${AlphaVersion}_${AlphaSignature}.zip"
  141   WinUpdateFile="${WinUpdateFile}_${AlphaSignature}"
  142   WinPortableFile="talpha${AlphaVersion}_${AlphaSignature}.zip"
  143   Win64UpdateFile="${Win64UpdateFile}_${AlphaSignature}"
  144   Win64PortableFile="talpha${AlphaVersion}_${AlphaSignature}.zip"
  145   LinuxUpdateFile="${LinuxUpdateFile}_${AlphaSignature}"
  146   LinuxSetupFile="talpha${AlphaVersion}_${AlphaSignature}.tar.xz"
  147   Linux32UpdateFile="${Linux32UpdateFile}_${AlphaSignature}"
  148   Linux32SetupFile="talpha${AlphaVersion}_${AlphaSignature}.tar.xz"
  149 fi
  150 
  151 if [ "$DeployMac" == "1" ]; then
  152   if [ ! -f "$MacDeployPath/$MacUpdateFile" ]; then
  153     Error "$MacDeployPath/$MacUpdateFile not found!";
  154   fi
  155   if [ ! -f "$MacDeployPath/$MacSetupFile" ]; then
  156     Error "$MacDeployPath/$MacSetupFile not found!"
  157   fi
  158 fi
  159 if [ "$DeployOsx" == "1" ]; then
  160   if [ ! -f "$OsxDeployPath/$OsxUpdateFile" ]; then
  161     Error "$OsxUpdateFile not found!"
  162   fi
  163   if [ ! -f "$OsxDeployPath/$OsxSetupFile" ]; then
  164     Error "$OsxSetupFile not found!"
  165   fi
  166 fi
  167 if [ "$DeployWin" == "1" ]; then
  168   if [ ! -f "$WinDeployPath/$WinUpdateFile" ]; then
  169     Error "$WinUpdateFile not found!"
  170   fi
  171   if [ "$AlphaVersion" == "0" ]; then
  172     if [ ! -f "$WinDeployPath/$WinSetupFile" ]; then
  173       Error "$WinSetupFile not found!"
  174     fi
  175   fi
  176   if [ ! -f "$WinDeployPath/$WinPortableFile" ]; then
  177     Error "$WinPortableFile not found!"
  178   fi
  179 fi
  180 if [ "$DeployWin64" == "1" ]; then
  181   if [ ! -f "$Win64DeployPath/$Win64UpdateFile" ]; then
  182     Error "$Win64UpdateFile not found!"
  183   fi
  184   if [ "$AlphaVersion" == "0" ]; then
  185     if [ ! -f "$Win64DeployPath/$Win64SetupFile" ]; then
  186       Error "$Win64SetupFile not found!"
  187     fi
  188   fi
  189   if [ ! -f "$Win64DeployPath/$Win64PortableFile" ]; then
  190     Error "$Win64PortableFile not found!"
  191   fi
  192 fi
  193 if [ "$DeployLinux" == "1" ]; then
  194   if [ ! -f "$LinuxDeployPath/$LinuxUpdateFile" ]; then
  195     Error "$LinuxDeployPath/$LinuxUpdateFile not found!"
  196   fi
  197   if [ ! -f "$LinuxDeployPath/$LinuxSetupFile" ]; then
  198     Error "$LinuxDeployPath/$LinuxSetupFile not found!"
  199   fi
  200 fi
  201 if [ "$DeployLinux32" == "1" ]; then
  202   if [ ! -f "$Linux32DeployPath/$Linux32UpdateFile" ]; then
  203     Error "$Linux32DeployPath/$Linux32UpdateFile not found!"
  204   fi
  205   if [ ! -f "$Linux32DeployPath/$Linux32SetupFile" ]; then
  206     Error "$Linux32DeployPath/$Linux32SetupFile not found!"
  207   fi
  208 fi
  209 
  210 $FullScriptPath/../../../DesktopPrivate/mount.sh
  211 
  212 declare -a Files
  213 if [ "$DeployMac" == "1" ]; then
  214   Files+=("tmac/$MacUpdateFile" "tmac/$MacSetupFile")
  215 fi
  216 if [ "$DeployOsx" == "1" ]; then
  217   Files+=("tosx/$OsxUpdateFile" "tosx/$OsxSetupFile")
  218 fi
  219 if [ "$DeployWin" == "1" ]; then
  220   Files+=("tsetup/$WinUpdateFile" "tsetup/$WinPortableFile")
  221   if [ "$AlphaVersion" == "0" ]; then
  222     Files+=("tsetup/$WinSetupFile")
  223   fi
  224 fi
  225 if [ "$DeployWin64" == "1" ]; then
  226   Files+=("tx64/$Win64UpdateFile" "tx64/$Win64PortableFile")
  227   if [ "$AlphaVersion" == "0" ]; then
  228     Files+=("tx64/$Win64SetupFile")
  229   fi
  230 fi
  231 if [ "$DeployLinux" == "1" ]; then
  232   Files+=("tlinux/$LinuxUpdateFile" "tlinux/$LinuxSetupFile")
  233 fi
  234 if [ "$DeployLinux32" == "1" ]; then
  235   Files+=("tlinux32/$Linux32UpdateFile" "tlinux32/$Linux32SetupFile")
  236 fi
  237 cd $DeployPath
  238 rsync -avR --progress ${Files[@]} "$FullScriptPath/../../../DesktopPrivate/remote/files"
  239 
  240 echo "Version $AppVersionStrFull was deployed!"
  241 cd $FullExecPath
  242