41 lines
979 B
Bash
Executable File
41 lines
979 B
Bash
Executable File
#!/usr/bin/env bash
|
|
##makedesc: Install telegram (latest)
|
|
|
|
set -eo pipefail
|
|
|
|
installed() { command -v "$1" >/dev/null 2>&1; }
|
|
|
|
install() {
|
|
if [ "$(uname -s)" = "Darwin" ]; then
|
|
if installed brew; then
|
|
brew install --cask telegram
|
|
else
|
|
echo "ERROR: Install Homebrew first." >&2
|
|
exit 1
|
|
fi
|
|
return
|
|
fi
|
|
|
|
echo
|
|
echo "==============================================="
|
|
echo "Installing telegram"
|
|
echo "==============================================="
|
|
echo
|
|
|
|
mkdir -p "$HOME/install" "$HOME/.local/bin"
|
|
if installed wget; then
|
|
wget -q --show-progress "https://telegram.org/dl/desktop/linux" -O "$HOME/install/telegram.tar.gz"
|
|
else
|
|
curl -fsSL "https://telegram.org/dl/desktop/linux" -o "$HOME/install/telegram.tar.gz"
|
|
fi
|
|
tar -xJf "$HOME/install/telegram.tar.gz" -C "$HOME/.local/bin"
|
|
|
|
echo
|
|
echo "Finish!"
|
|
echo
|
|
}
|
|
|
|
case "$1" in
|
|
*) install ;;
|
|
esac
|