Saturday, December 27, 2014

Telegram (CLI) on Raspberry Pi

This post (in German) explains how to build Telegram Command Line Interface (CLI) client. I confirmed that those steps also works in my Raspberry Pi type B board, minus the Lua component. I had to disable Lua because I cannot get it to compile in my Raspberry Pi (running Raspbian). The compilation always failed because it doesn't have enough space in /tmp for the intermediate compilation result. Well, I don't have any need for Lua either.

Now, let's get down to the details. These are the steps (I'll repeat the steps in the linked article above for completeness sake):
  1. In order to make sure you have enough /tmp for the compilation, you can enlarge your /tmp as explained in this post (basically edit /etc/fstab and unmount, remount /tmp or reboot your Raspberry Pi to be sure).
  2. Install the needed libraries in your Raspbian:
    sudo apt-get install libreadline-dev libconfig-dev libssl-dev libevent-dev
    I leave all Lua-related stuff out because we don't need it.
  3. Next, let's clone Telegram CLI from github:
    [your_home_dir]: git clone --recursive && cd tg
  4. Now, let's make a build directory in order not to clutter the source code with intermediate object files there.
    [your_home_dir]/tg: mkdir build && cd build
  5. Now carry out the compilation there. Remember to disable lua:
    [your_home_dir]/tg/build: ../configure --disable-liblua
    [your_home_dir]/tg/build: make
    Grab yourself some coffee to wait for the compilation to complete.
Once the compilation complete, you'll have Telegram CLI executable (named telegram-cli) in the tg/build/bin directory. Now, you can start using it. Just a hint: to end your telegram-cli session, type:
In the current telegram-cli session. You can just type "/" then "TAB" to see the options available to you. It also confuse me how to quit when I first uses Telegram CLI ;-)