Skip to content

Instantly share code, notes, and snippets.

@cyppst
Last active September 17, 2019 07:02
Show Gist options
  • Save cyppst/ff0ffa3449b477e1ae84d42c2cb7ee23 to your computer and use it in GitHub Desktop.
Save cyppst/ff0ffa3449b477e1ae84d42c2cb7ee23 to your computer and use it in GitHub Desktop.
Motioneye
#!/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"
apt-get update
apt-get install -y git build-essential
for p in $LIB_DEPS; do
BIN_DEPS="$BIN_DEPS lib${p}-dev"
done
apt-get install -yy $BIN_DEPS
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