=more resialint code for teamviewer launcher
This commit is contained in:
parent
0edd03736c
commit
e7a7051698
|
@ -1,5 +1,7 @@
|
||||||
#! /usr/bin/env bash
|
#! /usr/bin/env bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
### based on the code shared at https://community.teamviewer.com/English/discussion/comment/116988/#Comment_116988
|
### based on the code shared at https://community.teamviewer.com/English/discussion/comment/116988/#Comment_116988
|
||||||
|
|
||||||
clear
|
clear
|
||||||
|
@ -17,13 +19,21 @@ TVQS=${TVQS:-$1}
|
||||||
#RemoteFile=https://download.teamviewer.com/download/version_11x/teamviewer_qs.tar.gz
|
#RemoteFile=https://download.teamviewer.com/download/version_11x/teamviewer_qs.tar.gz
|
||||||
# Prefer dl.teamviewer.com as it provides the `content-length` header
|
# Prefer dl.teamviewer.com as it provides the `content-length` header
|
||||||
RemoteFile=https://dl.teamviewer.com/download/version_11x/teamviewer_qs.tar.gz
|
RemoteFile=https://dl.teamviewer.com/download/version_11x/teamviewer_qs.tar.gz
|
||||||
|
RemoteSize="$(curl -sI "$RemoteFile" | grep -i '^Content-Length:.*$' | awk '{sub("\r",""); print $2} ')"
|
||||||
|
|
||||||
LocalFile=~/Downloads/TeamViewerQS.tgz
|
LocalFile=~/Downloads/TeamViewerQS.tgz
|
||||||
if [ "${TVQS}" == "gal" ]; then
|
if [ "${TVQS}" == "gal" ]; then
|
||||||
RemoteFile='https://customdesignservice.teamviewer.com/download/linux/v15/6fnv7gb/TeamViewerQS.tar.gz' # ?sv=2020-04-08&se=2022-08-11T19%3A34%3A09Z&sr=b&sp=r&sig=b2cQfGcmepA5re6sfBZTg3UODGCFVP3Duvdg9IBw9Wg%3D'
|
RemoteFileCustom='https://customdesignservice.teamviewer.com/download/linux/v15/6fnv7gb/TeamViewerQS.tar.gz'
|
||||||
|
RemoteSizeCustom="$(curl -sI "$RemoteFileCustom" | grep -i '^Content-Length:.*$' | awk '{sub("\r",""); print $2} ')"
|
||||||
|
|
||||||
|
if [[ "$RemoteSize" -gt "0" ]]; then
|
||||||
LocalFile=~/Downloads/TeamViewerQS-gal.tgz
|
LocalFile=~/Downloads/TeamViewerQS-gal.tgz
|
||||||
|
RemoteFile=$RemoteFileCustom
|
||||||
|
RemoteSize=$RemoteSizeCustom
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
LocalSize=$(wc -c "$LocalFile" 2>/dev/null | awk '{ print $1 }')
|
LocalSize="$(wc -c "$LocalFile" 2>/dev/null | awk '{ print $1 }')"
|
||||||
RemoteSize=$(curl -sI "$RemoteFile" | awk -v IGNORECASE=1 '/^Content-Length/ {sub("\r",""); print $2}')
|
|
||||||
if [[ ! -r "${LocalFile}" ]] || [ "$LocalSize" != "$RemoteSize" ]; then
|
if [[ ! -r "${LocalFile}" ]] || [ "$LocalSize" != "$RemoteSize" ]; then
|
||||||
echo "Downloading file into $LocalFile..."
|
echo "Downloading file into $LocalFile..."
|
||||||
curl -Lo "$LocalFile" "$RemoteFile"
|
curl -Lo "$LocalFile" "$RemoteFile"
|
||||||
|
|
Loading…
Reference in New Issue