Difference between pages "Initramfs" and "Package:Irssi"

From Funtoo
(Difference between pages)
Jump to navigation Jump to search
 
 
Line 1: Line 1:
== What is initramfs? ==
{{Ebuild
[http://en.wikipedia.org/wiki/Initramfs Wikipedia] defines initramfs as:
|Summary=A modular textUI IRC client with IPv6 support.
<blockquote>
|CatPkg=net-irc/irssi
initramfs, abbreviated from "initial ram file system", is the successor of initrd. It is a cpio archive of the initial file system that gets loaded into memory during the Linux startup process. The Linux kernel mounts it as root file system and starts the init process from it. This will complete certain tasks before the real root file system is loaded; thus, initramfs needs to contain all of the device drivers and tools needed to mount the real root filesystem.
|Maintainer=
</blockquote>
|Homepage=http://www.irssi.org/
}}
 
=== Description ===
irssi is a small command line IRC client based on ncurses. It's a great thing to use when you SSH into a server, or just simply for your main IRC client.
 
=== Installation ===
The install of irssi is pretty straight forward. There are not many USE flags, but one that is worth looking at is the {{c|SSL}} flag. This enables you to use SSL when connecting to servers.
{{console|body=
###i## echo "net-irc/irssi ssl" >> /etc/portage/package.use
###i## emerge irssi
}}
=== Using irssi ===
Using irssi initially can be a little intimidating if you're not used to command line programs. To first start irssi, you just simply run:
{{console|body=
$ ##i##irssi
}}
There are flags you can pass to the command line while starting irssi, such as:
{{console|body=
$ ##i##irssi -n mynick -c irc.freenode.org
}}
This would connect you to Freenode with the nick 'mynick'. Or alternatively you can just run the {{c|irssi}} command and connect via SSL if you need to:
{{file|body=
/connect -ssl irc.freenode.org
}}
This will automatically connect you over port 6697.
 
When you have connected to the server of your choice, you can join a channel simply by:
{{file|body=
/j #funtoo
}}
If you want to leave any channel you've entered you can use the {{c|part}} command:
{{file|body=
/part #funtoo reasons...
}}
There are a few ways of navigating through your channels, you can use {{c|alt+<nowiki>{1-9}{q-p}</nowiki>}}, or alternatively you can use the {{c|window}} command that is in irssi:
{{file|body=
/window 1
/window 2
/window 3
}}
For as many channels you are apart of.
 
When you're ready to leave, you can simply type in:
{{file|body=
/exit
}}
Which will close out connections to the IRC networks you've joined, and take you back to your console window.
=== Themes and scripts ===
==== Scripts ====
There are a few things you can do to make irssi look a little bit better and add some cool features. There are a few plugins that are pretty useful, such as {{c|fnotify.pl}} which is a script that utilizes {{f|libnotify}} to send you popup notifications for when your nick is pinged or you are sent a private message.
 
{{file|name=fnotify.pl|lang=perl|desc=fnotify.pl|body=
# todo: grap topic changes


== Do I need an initramfs? ==
use strict;
The reason to build a kernel with an initramfs is mostly for interoperability (e.g. live-cd's) and special features like an included busybox, ssh, etc. But mostly, and that's why we are doing this here now, to have a proper kernel up and running quick'n dirty in a reasonable time without fighting hours and days until a more or less exotic hardware is perfectly run by the kernel. After having a proper basic kernel running with the help of an initramfs, I really recommend you to go a step further and build a true kernel with all features includes without an initramfs. However, relying only on a kernel to boot a system can be quite time consuming, so we have provided several initramfs options for Funtoo. If you have decided to use an initramfs, not just a kernel, check out the options below and choose the one that you like the most.
use vars qw($VERSION %IRSSI);


== better-initramfs ==
use Irssi;
Piotr's better-initramfs is a popular approach among Funtoo'ers to building an initramfs. It is quick, nice, and shiny. The biggest plus is that, once built, it is kernel version independent.
$VERSION = '0.0.3';
%IRSSI = (
authors    => 'Thorsten Leemhuis',
contact    => 'fedora@leemhuis.info',
name        => 'fnotify',
description => 'Write a notification to a file that shows who is talking to you in which channel.',
url        => 'http://www.leemhuis.info/files/fnotify/',
license    => 'GNU General Public License',
changed    => '$Date: 2007-01-13 12:00:00 +0100 (Sat, 13 Jan 2007) $'
);


=== Installation ===
#--------------------------------------------------------------------
To install better-initramfs on your system, change to the <code>/opt</code> directory (or any other directory that you deem suitable) and clone the better-initramfs repository from bitbucket.
# In parts based on knotify.pl 0.1.1 by Hugo Haas
<console>
# http://larve.net/people/hugo/2005/01/knotify.pl
###i## cd /opt
# which is based on osd.pl 0.3.3 by Jeroen Coekaerts, Koenraad Heijlen
###i## git clone https://bitbucket.org/piotrkarbowski/better-initramfs.git
# http://www.irssi.org/scripts/scripts/osd.pl
</console>
#
# Other parts based on notify.pl from Luke Macken
# http://fedora.feedjack.org/user/918/
#
#--------------------------------------------------------------------


=== Building <code>/initramfs.cpio.gz</code> ===
#--------------------------------------------------------------------
Now that you have better-initramfs on your system, we can make the <code>initramfs.cpio.gz</code> image and move it to <code>/boot</code>.
# Private message parsing
{{fancynote| do not run <code>make prepare</code> or <code>make image</code> until you have configured your kernel. If you have not installed / configured a kernel yet, check out: [[Building_a_Kernel_from_Source| Building a Kernel From Source]] and [[Funtoo_Linux_Kernels| Funtoo Linux Kernels]].}}
#--------------------------------------------------------------------
<console>
###i## cd better-initramfs
###i## bootstrap/bootstrap-all
###i## make prepare
###i## make image
###i## cp output/initramfs.cpio.gz /boot
</console>


=== Configuring <code>/etc/boot.conf</code> ===
sub priv_msg {
Now that the <code>initramfs.cpio.gz</code> file is in <code>/boot</code>, we can configure what we want the initramfs to do for us when the system boots. Below is a table of options that better-initramfs supports (from [https://bitbucket.org/piotrkarbowski/better-initramfs better-initramfs Bitbucket page]):
my ($server,$msg,$nick,$address,$target) = @_;
==== Options ====
filewrite($nick." " .$msg );
{| {{table}}
}
!Option
!Description
|-
|rescueshell
|Drop to the rescueshell before mounting rootfs to <code>/newroot</code>
|-
|sshd
|Run the sshd server when the initramfs loads. This allows you to ssh into your initramfs to fix any errors that may have occurred while booting.
|-
|sshd_wait=x
|Wait x number of seconds after starting sshd to continue booting the system.
|-
|sshd_port=x
|Change the port that sshd "listens" on. The default port for sshd is port 22.
|-
|binit_net_if=interface
|Choose which interface the network should be configured on. For example: wlan0, eth0, etc.
|-
|binit_net_addr=<ipaddr/cidr>
|Configure <code>ipaddr</code> with <code>cidr</code> netmask. For example: <code>11.11.11.2/24</code>. If you do not add a netmask, the netmask is assumed to be 32. Furthermore, you will have to configure <code>binit_net_gw</code>.
|-
|binit_net_gw=ipaddr
|The address of your gateway. Only needed if you want to connect to WAN.
|-
|rw
|Mount the rootfs as read-write. By default, the rootfs is mounted as read only.
|-
|mdev
|Use mdev instead of devtmpfs. This option can prove handy on older kernels.
|-
|softraid
|Detect and run RAID arrays.
|-
|init=
|Change the init system. For example, if you are using systemd, change this to <code>/usr/lib/systemd/systemd</code>. The default for this option (<code>/sbin/init</code>) will work fine with OpenRC.
|-
|tuxonice
|Try resuming with TuxOnIce.
|-
|uswsusp
|Try resuming the system with userspace software suspend. This depends on the <code>resume</code> option.
|-
|swsusp
|Try resuming the system with in-kernel suspend. This depends on the <code>resume</code> option.
|-
|resume=<device/path>
|Specify the device and path from which you want to resume.
|-
|lvm
|Scan for volume groups. If any are found, activate them.
|-
|luks
|Run <code>cryptsetup luksOpen</code> on the <code>enc_root</code> variable.
|-
|luks_trim
|Enable support for TRIM on your LUKS encrypted root device. This option is very helpful for those using SSDs.
|-
|enc_root=<device>
|The device that you wish to decrypt using <code>cryptsetup luksOpen</code>.
|-
|root=<device>
|The name of your root device.
|-
|rootfstype=<fstype>
|Specify the type of filesystem that your rootfs uses.
|-
|rootdelay=<time (as integer)>
|How long the initramfs should wait before attempting to mount devices.
|-
|rootflags=x
|Pass x flags to <code>mount</code> as it mounts your rootfs.
|}


==== Examples ====
#--------------------------------------------------------------------
Below are examples of different use cases for better-initramfs and how your <code>/etc/boot.conf</code> should be configured for them.
# Printing hilight's
{{fancynote| Realize that your <code>enc_root</code>, <code>root</code>, and <code>rootfstype</code> variables may be different from the examples provided below.}}
#--------------------------------------------------------------------


==== Regular ext4 root ====
sub hilight {
{{file|name=/etc/boot.conf|desc= |body=
    my ($dest, $text, $stripped) = @_;
"Funtoo Linux" {
    if ($dest->{level} & MSGLEVEL_HILIGHT) {
kernel vmlinuz[-v]
filewrite($dest->{target}. " " .$stripped );
initrd /initramfs.cpio.gz
    }
params += root=/dev/sdaX rootfstype=ext4
}
}
}}


==== Encrypted root with lvm ====
#--------------------------------------------------------------------
{{file|name=/etc/boot.conf|desc= |body=
# The actual printing
"Funtoo Linux" {
#--------------------------------------------------------------------
kernel vmlinuz[-v]
 
initrd /initramfs.cpio.gz
sub filewrite {
params += enc_root=/dev/sdaX lvm luks luks_trim root=/dev/mapper/funtoo--vg-root rootfstype=ext4
my ($text) = @_;
# FIXME: there is probably a better way to get the irssi-dir...
        open(FILE,">>$ENV{HOME}/.irssi/fnotify");
print FILE $text . "\n";
        close (FILE);
}
}
Irssi::signal_add_last("message private", "priv_msg");
Irssi::signal_add_last("print text", "hilight");
#- end
}}
}}
Another very useful script is for colored nicks, to better tell people apart. Which can be found at [http://scripts.irssi.org irssi scripts] called {{f|nickcolor.pl}}. 


==== Encrypted root with lvm and RAID ====
When you have the scripts you would like you would put them into {{f|~/.irssi/scripts}} and set a link to {{f|~/.irssi/scripts/autorun}}.
{{file|name=/etc/boot.conf|desc= |body=
{{console|body=
"Funtoo Linux" {
$ ##i##wget -O ~/.irssi/scripts/nickcolor.pl http://scripts.irssi.org/scripts/nickcolor.pl
kernel vmlinuz[-v]
$ ##i##cd ~/.irssi/scripts/autorun
initrd /initramfs.cpio.gz
$ ##i##ln -s ~/.irssi/scripts/nickcolor.pl .
params += enc_root=/dev/md0 lvm luks luks_trim softraid root=/dev/mapper/funtoo--vg-root rootfstype=ext4
$ ##i##ln -s ~/.irssi/scripts/fnotify.pl .
}
}}
You can do this for as many scripts as you've chosen to use. They will automatically load when you start irssi. You can also manually load scripts:
{{file|body=
/load ~/.irssi/scripts/fnotify.pl
Irssi: Loaded script fnotify
}}
Whichever works best for you is what you should do.  
==== Themes ====
You can choose from many themes on the [http://irssi.org/themes irssi themes] page if you don't like the default look of it. Once you've chosen the them you like, you can simply put it in your {{f|~/.irssi/}} directory and when you run just run:
{{file|body=
/set theme mycooltheme
}}
}}
[[Category:Kernel]]
And there you have it, the theme you have chosen is now there.
=== Conclusion ===
irssi is a great IRC client, and really helpful if you spend a lot of time in a terminal emulator or on a server.
 
== External Resources ==
[http://www.irssi.org/documentation Further documentation]
 
{{EbuildFooter}}
[[Category:IRC]]

Revision as of 07:49, January 22, 2015

Irssi

   Tip

We welcome improvements to this page. To edit this page, Create a Funtoo account. Then log in and then click here to edit this page. See our editing guidelines to becoming a wiki-editing pro.


Description

irssi is a small command line IRC client based on ncurses. It's a great thing to use when you SSH into a server, or just simply for your main IRC client.

Installation

The install of irssi is pretty straight forward. There are not many USE flags, but one that is worth looking at is the SSL flag. This enables you to use SSL when connecting to servers.

root # echo "net-irc/irssi ssl" >> /etc/portage/package.use
root # emerge irssi

Using irssi

Using irssi initially can be a little intimidating if you're not used to command line programs. To first start irssi, you just simply run:

user $ irssi

There are flags you can pass to the command line while starting irssi, such as:

user $ irssi -n mynick -c irc.freenode.org

This would connect you to Freenode with the nick 'mynick'. Or alternatively you can just run the irssi command and connect via SSL if you need to:

   
/connect -ssl irc.freenode.org

This will automatically connect you over port 6697.

When you have connected to the server of your choice, you can join a channel simply by:

   
/j #funtoo

If you want to leave any channel you've entered you can use the part command:

   
/part #funtoo reasons...

There are a few ways of navigating through your channels, you can use alt+{1-9}{q-p}, or alternatively you can use the window command that is in irssi:

   
/window 1
/window 2
/window 3

For as many channels you are apart of.

When you're ready to leave, you can simply type in:

   
/exit

Which will close out connections to the IRC networks you've joined, and take you back to your console window.

Themes and scripts

Scripts

There are a few things you can do to make irssi look a little bit better and add some cool features. There are a few plugins that are pretty useful, such as fnotify.pl which is a script that utilizes libnotify to send you popup notifications for when your nick is pinged or you are sent a private message.

   fnotify.pl (perl source code) - fnotify.pl
# todo: grap topic changes

use strict;
use vars qw($VERSION %IRSSI);

use Irssi;
$VERSION = '0.0.3';
%IRSSI = (
	authors     => 'Thorsten Leemhuis',
	contact     => 'fedora@leemhuis.info',
	name        => 'fnotify',
	description => 'Write a notification to a file that shows who is talking to you in which channel.',
	url         => 'http://www.leemhuis.info/files/fnotify/',
	license     => 'GNU General Public License',
	changed     => '$Date: 2007-01-13 12:00:00 +0100 (Sat, 13 Jan 2007) $'
);

#--------------------------------------------------------------------
# In parts based on knotify.pl 0.1.1 by Hugo Haas
# http://larve.net/people/hugo/2005/01/knotify.pl
# which is based on osd.pl 0.3.3 by Jeroen Coekaerts, Koenraad Heijlen
# http://www.irssi.org/scripts/scripts/osd.pl
#
# Other parts based on notify.pl from Luke Macken
# http://fedora.feedjack.org/user/918/
#
#--------------------------------------------------------------------

#--------------------------------------------------------------------
# Private message parsing
#--------------------------------------------------------------------

sub priv_msg {
	my ($server,$msg,$nick,$address,$target) = @_;
	filewrite($nick." " .$msg );
}

#--------------------------------------------------------------------
# Printing hilight's
#--------------------------------------------------------------------

sub hilight {
    my ($dest, $text, $stripped) = @_;
    if ($dest->{level} & MSGLEVEL_HILIGHT) {
	filewrite($dest->{target}. " " .$stripped );
    }
}

#--------------------------------------------------------------------
# The actual printing
#--------------------------------------------------------------------

sub filewrite {
	my ($text) = @_;
	# FIXME: there is probably a better way to get the irssi-dir...
        open(FILE,">>$ENV{HOME}/.irssi/fnotify");
	print FILE $text . "\n";
        close (FILE);
}

Irssi::signal_add_last("message private", "priv_msg");
Irssi::signal_add_last("print text", "hilight");

#- end

Another very useful script is for colored nicks, to better tell people apart. Which can be found at irssi scripts called nickcolor.pl.

When you have the scripts you would like you would put them into ~/.irssi/scripts and set a link to ~/.irssi/scripts/autorun.

user $ wget -O ~/.irssi/scripts/nickcolor.pl http://scripts.irssi.org/scripts/nickcolor.pl
user $ cd ~/.irssi/scripts/autorun
user $ ln -s ~/.irssi/scripts/nickcolor.pl .
user $ ln -s ~/.irssi/scripts/fnotify.pl .

You can do this for as many scripts as you've chosen to use. They will automatically load when you start irssi. You can also manually load scripts:

   
/load ~/.irssi/scripts/fnotify.pl
Irssi: Loaded script fnotify

Whichever works best for you is what you should do.

Themes

You can choose from many themes on the irssi themes page if you don't like the default look of it. Once you've chosen the them you like, you can simply put it in your ~/.irssi/ directory and when you run just run:

   
/set theme mycooltheme

And there you have it, the theme you have chosen is now there.

Conclusion

irssi is a great IRC client, and really helpful if you spend a lot of time in a terminal emulator or on a server.

External Resources

Further documentation