Ä¿ÇǴнº, ½Ã½ºÅÛ ¿£Áö´Ï¾îÀÇ ½°ÅÍ
  ¸®´ª½º¿¡ ÅÚ·¹±×·¥(Telegram) CLI ¼³Ä¡ ÀÛ¼ºÀÏ : 2014/10/14 19:04
 
  • ±Û¾´ÀÌ : ÁÁÀºÁøÈ£ ( http://coffeenix.net/ )
  • Á¶È¸¼ö : 21875
     
    Á¦  ¸ñ : ¸®´ª½º¿¡ ÅÚ·¹±×·¥(Telegram) CLI ¼³Ä¡
    ÀÛ¼ºÀÚ : ÁÁÀºÁøÈ£(truefeel, http://coffeenix.net/ )
    ÀÛ¼ºÀÏ : 2014.9.29(¿ù)
    Á¤¸®ÀÏ : 2014.10.6(¿ù)



    1. ÅÚ·¹±×·¥(Telegram) CLI¹öÀü ¼³Ä¡

    * ÇÊ¿äÇÑ ÆÐÅ°Áö ¼³Ä¡ : libevent-devel, openssl-devel, readline-devel, libconfig-devel
    * lua script¸¦ »ç¿ëÇÏ·Á¸é :  lua, lua-devel

    https://github.com/vysheng/tg ¿¡¼­ ¼Ò½º¸¦ ³»·Á¹Þ´Â´Ù.

     
    # yum install libevent-devel openssl-devel readline-devel libconfig-devel lua lua-devel
    # ./configure
    # make
     


    ¡Ø CentOS¸¦ ±âÁØÀ¸·Î ÇßÀ¸¸ç, ´Ù¸¥ ¹èÆ÷ÆÇ¿¡¼­ ÇÊ¿äÇÑ ÆÐÅ°Áö ¼³Ä¡´Â https://github.com/vysheng/tg/blob/master/README.md ¸¦ Âü°íÇÒ °Í


    2. CentOS 5¿¡¼­ ¼³Ä¡

     
    # ./configure --disable-libconfig
    ... »ý·« ...
    checking for rl_save_prompt in -lreadline... no
    configure: error: no libreadline found
     


    LDFLAGS º¯¼ö¸¦ ÁöÁ¤Çؼ­ ÄÄÆÄÀÏÇÏ¸é µÈ´Ù. ±× Àü¿¡ /usr/lib/libncursesw.so ½Éº¼¸¯¸µÅ©°¡ ÀÖ´ÂÁö È®ÀÎÇÑ´Ù. ¾ø´Ù¸é ½Éº¼¸¯ ¸µÅ©¸¦ °Ç´Ù. (ncurses-devel ÆÐÅ°Áö°¡ ¼³Ä¡¾ÈµÈ °æ¿ì libncursesw.so ½Éº¼¸¯ ¸µÅ©°¡ ¾ø´Ù.)

     
    # cd /usr/lib
    # ln -s libncursesw.so.5 libncursesw.so
    #
    # cd -
    # LDFLAGS="-lncursesw " ./configure or LDFLAGS="-lncursesw " ./configure --disable-libconfig
    # make
     


    libconfig¸¦ »ç¿ëÇÏ·Á¸é CentOS(RHEL) 5´Â ÇØ´ç ¶óÀ̺귯¸®¸¦ Á¦°øÇÏÁö ¾Ê±â ¶§¹®¿¡ º°µµ·Î ¼³Ä¡ÇؾßÇÑ´Ù.

    1) x86_64

    http://damsl.cs.indiana.edu/yum/centos/5/x86_64/ ¿¡¼­ libconfig-1.4.8-1.x86_64.rpm °ú libconfig-devel-1.4.8-1.x86_64.rpm À» ¹Þ¾Æ ¼³Ä¡ÇÑ´Ù.

    2) 32bit

    http://hyperrealm.com/libconfig/ ¿¡¼­ ¼Ò½º¸¦ ¹Þ¾Æ ÄÄÆÄÀÏÇÑ´Ù. ¼³Ä¡µÈ libconfig ¶óÀ̺귯¸® °æ·Î°¡ /lib/ ³ª /usr/lib/ µî°ú °°ÀÌ ¾Ê´Ù¸é ÅÚ·¹±×·¥ CLI ÄÄÆÄÀϽÿ¡ LDFLAGSº¯¼ö¿¡ -L¿É¼ÇÀ¸·Î °æ·Î¸¦ ÁöÁ¤ÇØÁØ´Ù.

     
    # LDFLAGS="-lncursesw -L/usr/local/libconfig/lib" ./configure
     



    3. ½ÇÇà

     
    $ bin/telegram-cli -k server.pub
    change_user_group: can't find the user telegramd to switch to
    Telegram-cli version 1.0.5, Copyright (C) 2013-2014 Vitaly Valtman
    Telegram-cli comes with ABSOLUTELY NO WARRANTY; for details type `show_license'.
    This is free software, and you are welcome to redistribute it
    under certain conditions; type `show_license' for details.
    Telephone number (with '+' sign): +8210.....  <-- Æù¹øÈ£ ÀÔ·Â
    Code from sms (if you did not receive an SMS and want to be called, type "call"): 12345 <-- ½º¸¶Æ®Æù¿¡ ¼³Ä¡µÈ ÅÚ·¹±×·¥ ¾îÇà ¶Ç´Â SMS·Î ³¯¶ó¿Â ÀÎÁõ¹øÈ£ 5ÀÚ¸®¸¦ ÀÔ·ÂÇÑ´Ù.
    >
    > stats
    users_allocated¡¡¡¡¡¡1
    chats_allocated¡¡¡¡¡¡0
    secret_chats_allocated¡¡¡¡¡¡0
    peer_num¡¡¡¡¡¡1
    messages_allocated¡¡¡¡¡¡0
     


    °£´ÜÇÑ ¸í·É ¸î°¡Áö. ÀÚ¼¼ÇÑ °ÍÀº help¸í·ÉÀ¸·Î È®ÀÎ °¡´É.

    - msg <¹ÞÀ»»ç¶÷> <¸Þ½ÃÁö>
    - send_photo <¹ÞÀ»»ç¶÷> <ÆÄÀϸí> : »çÁø ÆÄÀÏÀ» »ó´ë¿¡¼­ Àü¼ÛÇÑ´Ù.
    - send_text  <¹ÞÀ»»ç¶÷> <ÆÄÀϸí> : local¿¡ ÀÖ´Â ÅؽºÆ®ÆÄÀÏ ³»¿ëÀ» ±×´ë·Î »ó´ë¿¡¼­ »Ñ·ÁÁØ´Ù.

    - contact_list : ´ëÈ­»ó´ë ¸ñ·Ï
    - dialog_list : ¿­·ÁÀÖ´Â ´ëȭâ ¸ñ·Ï
    - status_online °ú status_offline : on/off »óÅ Àüȯ

    ¸¸¾à, ÅÚ·¹±×·¥ ¾îÇÿ¡¼­ '¼³Á¤(Settings)' -> '´Ù¸¥ ¸ðµç ¼¼¼Ç Á¾·á(Terminate All Other Sessions)'À» Ŭ¸¯Çϸé, CLI ¿¬°áÀº ²÷±â°í, »õ·Î ÀÎÁõÀ» ¹Þ¾Æ¾ß ÇÑ´Ù. ÀÎÁõÁ¤º¸°¡ ÀúÀåµÈ ~/.telegram-cli/ µð·ºÅ丮¸¦ Áö¿ì°í ÀçÀÎÁõÀ» ¹ÞÀ» ¼ö ÀÖ´Ù.


    telegram-cli ½ÇÇà½Ã lua ½ºÅ©¸³Æ®¸¦ »ç¿ëÇؼ­,
    - ƯÁ¤ »óȲ¿¡ µû¶ó ¸Þ½ÃÁö¸¦ ÁöÁ¤ÇÑ À¯Àú, ±×·ì¿¡°Ô º¸³¾ ¼öµµ ÀÖ°í,
    - ¸Þ½ÃÁö¸¦ ¼ö½Å½Ã, ¸Þ½ÃÁö¿¡ µû¶ó¼­ °á°ú¸¦ »ó´ë¿¡°Ô returnÇØÁÙ ¼öµµ ÀÖ´Ù.

     
    $ bin/telegram-cli -s server_mon.lua
     



    4. configure ÇÒ ¶§ ¿¡·¯ ¸ðÀ½

    1) yum install libevent-devel ÇÊ¿ä

     
    # ./configure
    ... »ý·« ...
    checking for event_base_new in -levent... no
    configure: error: no libevent found
     


    2) yum install openssl-devel ÇÊ¿ä

     
    # ./configure
    ... »ý·« ...
    checking for openssl/ssl.h in /usr/local... no
    checking for openssl/ssl.h in /usr... no
    checking whether compiling and linking against OpenSSL works... no
    configure: error: No openssl found
     


    3) yum install readline-devel ÇÊ¿ä (CentOSÀÎ °æ¿ì´Â '2. CentOS 5¿¡¼­ ¼³Ä¡'¸¦ Âü°íÇÒ °Í)

     
    # ./configure
    ... »ý·« ...
    checking for rl_save_prompt in -lreadline... no
    configure: error: no libreadline found
     



    5. Âü°íÀÚ·á

    * Compilation under CentOS5 #144
      https://github.com/vysheng/tg/issues/144


    Ä¿ÇǴнº, ½Ã½ºÅÛ ¿£Áö´Ï¾îÀÇ ½°ÅÍ / URL : http://coffeenix.net/board_view.php?bd_code=1759