Last active
July 12, 2016 00:16
-
-
Save Higgs1/01448cace611ef60c004efa6ac3c1c90 to your computer and use it in GitHub Desktop.
Telegram CLI Install Script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# To install Telegram-CLI, run the command: | |
# curl -s https://gist.githubusercontent.com/Higgs1/01448cace611ef60c004efa6ac3c1c90/raw | bash /dev/stdin | |
# Optionally specify an output file, otherwise will default to ./telegram-cli | |
GIT_REPO='https://github.com/Cojad/tg.git' | |
LUA='5.2' # LUA Version | |
PY='3.5' # Python Version | |
LIB_DEPS="lua${LUA} python${PY} readline config ssl event jansson" | |
BIN_DEPS="lua${LUA} make git upx|upx-ucl" | |
for p in $LIB_DEPS; do | |
BIN_DEPS="$BIN_DEPS lib${p}-dev" | |
done | |
if ! dpkg -s $BIN_DEPS &> /dev/null; then | |
sudo -n true &> /dev/null || | |
echo 'Some required packages are not installed, please enter sudo password to continue.' | |
sudo apt-get install -yy $BIN_DEPS | |
fi | |
export CFLAGS='-march=native -O3 -pipe -s' | |
DIR="$(mktemp -d)" | |
( cd "$DIR" && | |
git clone --recursive "$GIT_REPO" . && | |
sed -e s/-Werror//g -i Makefile.in && # Hack to remove -Werror | |
./configure --enable-python=$PY && | |
make -j$(nproc) && | |
strip -S --strip-unneeded -R .comment -R .note* bin/telegram-cli && | |
upx --brute -9 bin/telegram-cli | |
) && | |
install -Dm755 "$DIR/bin/telegram-cli" "${1:-.}" | |
rm -rf "$DIR" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment