-
Notifications
You must be signed in to change notification settings - Fork 1
/
zoom-setup.sh
executable file
·112 lines (84 loc) · 2.81 KB
/
zoom-setup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#!/usr/bin/env bash
#---
#
# This shell script written in bash allows you to check for updates of Zoom meetings client
#
# @AUTHOR: davorpa
#
# @SOURCE:
#
# https://davorpa.github.io/shell-utils/scripts/zoom-setup.sh
#
# @LICENSE:
#
# This program is free software. It comes without any warranty, to
# the extent permitted by applicable law. You can redistribute it
# and/or modify it under the terms of the Do What The Fuck You Want
# To Public License, Version 2, as published by Davorpa TECH. See
# https://davorpa.github.io/shell-utils/scripts/COPYING for more details.
#
# @REFERENCES:
# - https://zoom.us/download
# - https://support.zoom.us/hc/es/sections/200704559-Instalacion
# - https://support.zoom.us/hc/es/articles/204206269-Instalacion-o-actualizacion-de-Zoom-en-Linux
# - https://support.zoom.us/hc/en-us/articles/205759689
# - https://support.zoom.us/hc/en-us/articles/201361963
#
#---
# ====================================
# Config vars
#
# TODO: Detect other Unix/Linux distros moreover Debian/Ubuntu
CMD_INSTALL="sudo apt install";
CMD_KEY="sudo apt-key add";
ZOOM_URL="https://zoom.us";
FOLDER="$HOME/Downloads";
# TODO: Detect by OS (Ubuntu|Debian|...) (x64|x32)
VERSION="latest";
ARCH="zoom_amd64.deb";
CERT_URL="$ZOOM_URL/linux/download/pubkey";
DOWNLOAD_URL="$ZOOM_URL/download";
FETCH_URL="$ZOOM_URL/client/$VERSION";
PACKAGE_URL="$FETCH_URL/$ARCH"; # https://zoom.us/client/latest/zoom_amd64.deb
# ====================================
# Error checks
#
# Detect "wget" command
command -v wget >/dev/null 2>&1 || {
# Output to error stream
echo >&2 -en "\e[31mFATAL:\e[0m I require \e[34mwget\e[0m to work but seems not installed. Try to set up it first ;)
\e[38;5;240m$CMD_INSTALL\e[0m \e[34mwget\e[0m
Aborting.
";
exit 127; # SIGNAL with error code
};
# ====================================
# Alehop!! DALE AL MAMBO ;-)
#
# 1. Install/update packages signing key
echo -en "
\e[104m* STEP 1\e[0m: Download and installing package signing keys: \e[96m$CERT_URL\e[0m
";
wget -qO - "$CERT_URL" | $CMD_KEY -;
# 2. Download remote package
echo -en "
\e[104m* STEP 2\e[0m: Downloading package: \e[96m$PACKAGE_URL\e[0m
";
(wget -qcNO "$FOLDER/$ARCH" "$PACKAGE_URL") && EXITCODE=$? || EXITCODE=$?;
[[ $EXITCODE -ne 0 ]] && {
echo >&2 -en "\e[31m$EXITCODE\e[0m"; # Output to error stream
exit $EXITCODE; # SIGNAL with error code
};
# 3. Install downloaded package
echo -en "
\e[104m* STEP 3\e[0m: Installing downloaded package... \e[96m$FOLDER/$ARCH\e[0m.
";
($CMD_INSTALL "$FOLDER/$ARCH") && EXITCODE=$? || EXITCODE=$?;
[[ $EXITCODE -ne 0 ]] && {
echo >&2 -en "\e[31m$EXITCODE\e[0m"; # Output to error stream
exit $EXITCODE; # SIGNAL with error code
};
# ====================================
# SIGNAL SUCCESS :)
#
exit 0;