Linux Tutorial Irssi

From WebOS Internals
Revision as of 23:52, 17 September 2009 by Punzada (talk | contribs)
Jump to navigation Jump to search

Linux Tutorial - Irssi

Update 09/17/2009

I have managed to get the BitlBee service working with irssi for full AIM, MSN, Yahoo and Jabber support. I shall be doing my best to update this wiki with the best methods to get this working and configured easily and securely as soon as possible.

This Document Assumes the following

You have followed the procedure to Access Linux on the device and have enabled the Optware repositories and software Portal:Accessing_Linux

You have installed the Terminal application Application:Terminal


Once these procedures are done you should have access to:

The Optware software repositories through ipkg-opt

The Terminal Application through the WebOS (should load, be the root user, and function)


Installation

Within the Terminal application use the following command:

ipkg-opt install screen irssi

This command will automatically download GNU Screen and irssi as well as any necessary dependencies.

Note: GNU Screen is *not* necessary for irssi to function, it only provides further functionality to be able to close the Terminal application if desired, keep irssi running in the background and reattach to it. Also, I have found that running irssi within a screen session gives irssi all its various colors while running natively within the terminal app leaves it mono-colored.


Usage

In order to run irssi you simply need to type irssi into the Terminal application at the shell prompt and once hitting enter(return) it will load.

However this is NOT RECOMMENDED as by default the Terminal Application is loaded as the root user and you should avoid using internet facing applications as the root user if it is not necessary (some IRC networks such as EFnet will go as far as to instantly disconnect you if it detects you are connecting to their servers as root).

Once the Terminal Application is opened you may change to the user you set up when completing the steps to Access Linux via the su command

example:

root@castle:/var/home/root# su myuser
myuser@castle:/var/home/root$

from here you can simply enter irssi and hit return and it shall load.

Basic Commands

/connect ircserver

This will connect you to an irc network ex: /connect irc.freenode.net will connect you to the freenode network.

/join #channel

This will join the requested channel, ex: /join #webos-internals

Sym+n Will move to the 'next' window within the irssi interface Sym+p Will move you to the 'previous' window within the irssi interface

You can directly jump to a window (numbered in irssi) by hitting Orange Key+Space+Number.

GNU Screen History & Basics

If you're like me and you want to always keep your irssi session active as well as have the colors available to you a good solution is to use GNU Screen.

For those that don't know, screen acts as a window manager for terminal applications. Screen allows you to run multiple applications in a single terminal session, switch between the applications freely as well as being able to detach from it entirely, and reattach to it later while having those applications run in the background. Many consider screen to be one of the most important tools available for any type of command line work or administration - is is very powerful and very flexible, feel free to read up on it's customization and abilities to further enhance your experience with it.

Screen Usage

To start using screen it is very simple, follow the instructions above but before switching to your local user to run irssi, first type screen and hit enter

You will be greeted with screen's opening text, letting you know that it is running, and the GPL license, simply press the space bar here and you will be taken back into the prompt and it will appear as if you're back to where you started.

From this point on, follow the instructions above to change into your user that is not root, and open irssi like normal.

You will see commands listed as such: Sym-A C

This key combination is important because it means 'Press and hold Sym, then hit A, release both and hit C'

This is how GNU Screen functions and is vital to it's usage, the example above creates a new window with a fresh terminal session.

Attach / Detach

In order to detach from your screen session use the command Sym-A D

Once a session is detached you may close out of the terminal app and any applications running within your screen session will continue to run.

In order to reattach to a session you left running, load the Terminal Application again and type the following at the command prompt and hit enter: screen -r


Screen Commands To Know

Sym-A C - Create a new window/terminal session

Sym-A N - Change to next window/terminal session within the current screen session

Sym-A P - Change to previous window/terminal session with the current screen session

Sym-A D - Detach from current screen session

Bitlbee for Multi-IM

BitlBee for those that don't know is an IRC daemon that you can run to connect to basically all of the most popular IM protocols: XMPP/Jabber (including Google Talk), MSN Messenger, Yahoo! Messenger, AIM and ICQ.

As of now we are able to install bitlbee on the linux subsystem, run it in daemon mode (I wasn't able to get it started with xinetd - will be investiating this further), launch it from a script when we wish to connect and set irssi to automatically connect, identify and load all of your IM accounts at once.

The following procedure is how I have set mine up and there may be a sleeker/easier solution down the line

first to install the necessary files (must be performed as root or privledged user with sudo from within the terminal application):

ipkg-opt install screen irssi bitlbee

Configure Bitlbee

The only file that absolutely needs to be tweaked is located at /opt/etc/bitlbee/bitlbee.conf

RunMode = Daemon

User = myuser

ConfigDir = /home/myuser/

(note - replace myuser above with the user name set up when installing optware as shown above) edit the configuration file mentioned with your editor of choice (vi, nano, or copy it over and copy back with winscp whatever works for you) make sure any of those values that are leading with a # have it removed otherwise the value will not be set and it will be seen as a comment.

Startup Script

This script will load the daemon on-demand (may even be better this way as using less resources when you don't want to IM) and will automatically put the shell to your username instead of root (so you can use irssi more securely off the bat)

Create a file called "im" (without quotes) in your /var/home/root directory with the following:

#!/bin/sh
#load bitlbee daemon and automatically load screen with a regular user session
/opt/sbin/bitlbee
screen su myuser

You may now run this script at any time by opening up the terminal app and typing ./im

Configure Bitlbee for your IM clients

Running the 'im' script that you have now made will bring you to a prompt featuring your username such as

Important Note In order for these changes to take effect the filesystem must be mounted as rw, to do that as root user (or through sudo) please use the following command

mount -o remount,rw /

Configure irssi to automatically connect to Bitlbee

Configuration/Tweaks

Both irssi and GNU Screen are very rich applications with a plethora of scripts, customization and usage options that only a very small percentage of are covered in this document. If interested please search and find how you may be able to adjust them to fit your specific needs (and if you find anything worthwhile feel free to add it to this wiki!)

For information on irssi please visit their startup documentation http://irssi.org/documentation/startup

This site provides information that will help you in automating irssi to do tasks like autojoin set servers and channels and automatically identify your nickname with services.

Known Issues

When first loaded irssi tends to not properly format to the whole screen and a simple rotation to let the terminal rotate to the side and back to standard typing position will fix it (you will see the characters slowly refresh during this process)

Even with Screen running you can lose connection if the wifi radio turns off when the screen does, see http://www.webos-internals.org/wiki/Patch_webOS_Keep_Phone_Awake_While_in_Remote_Session

Terminal-irssi.jpg